Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 346abae265c2
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e3cb1d4978dc
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Oct 1, 2014

  1. Update spectator mspec config

    elia committed Oct 1, 2014

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    cdd55fe View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d5baaac View commit details
  3. Avoid mutable strings

    elia committed Oct 1, 2014

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    e3cb1d4 View commit details
Showing with 16 additions and 3 deletions.
  1. +1 −1 .spectator-mspec
  2. +7 −0 lib/opal/builder_processors.rb
  3. +6 −0 lib/opal/source_map.rb
  4. +2 −2 stdlib/source_map/vlq.rb
2 changes: 1 addition & 1 deletion .spectator-mspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BASE_DIR_REGEXP: '(?:opal/corelib|stdlib)'
SPEC_DIR_REGEXP: '(?:spec/corelib/(?:core|language)|spec/stdlib/.*?/spec\b)'
SPEC_DIR_REGEXP: '(?:spec/corelib/(?:core|language)|spec/opal|spec/stdlib/.*?/spec\b)'
RSPEC_COMMAND: 'bundle exec ./bin/opal-mspec'
7 changes: 7 additions & 0 deletions lib/opal/builder_processors.rb
Original file line number Diff line number Diff line change
@@ -37,6 +37,13 @@ def source_map
column = source.scan("\n[^\n]*$").size
offset = ::SourceMap::Offset.new(line, column)
mappings << ::SourceMap::Mapping.new(source_file, offset, offset)

# Ensure mappings isn't empty: https://github.com/maccman/sourcemap/issues/11
unless mappings.any?
zero_offset = ::SourceMap::Offset.new(0,0)
mappings = [::SourceMap::Mapping.new(source_file,zero_offset,zero_offset)]
end

::SourceMap::Map.new(mappings)
end
end
6 changes: 6 additions & 0 deletions lib/opal/source_map.rb
Original file line number Diff line number Diff line change
@@ -45,6 +45,12 @@ def map
mapping
end

# Ensure mappings isn't empty: https://github.com/maccman/sourcemap/issues/11
unless mappings.any?
zero_offset = ::SourceMap::Offset.new(0,0)
mappings = [::SourceMap::Mapping.new(source_file,zero_offset,zero_offset)]
end

::SourceMap::Map.new(mappings.compact)
end
end
4 changes: 2 additions & 2 deletions stdlib/source_map/vlq.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ module VLQ
#
# Returns a VLQ String.
def self.encode(ary)
result = ""
result = []
ary.each do |n|
vlq = n < 0 ? ((-n) << 1) + 1 : n << 1
begin
@@ -35,7 +35,7 @@ def self.encode(ary)
result << BASE64_DIGITS[digit]
end while vlq > 0
end
result
result.join
end

# Public: Decode a VLQ string.