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: d0422e047700
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e6144f87ac39
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Oct 28, 2013

  1. Copy the full SHA
    e11f3e2 View commit details
  2. Cleanup Array#unshift

    meh committed Oct 28, 2013
    Copy the full SHA
    2b3e7af View commit details

Commits on Oct 29, 2013

  1. Add 'arguments' and 'undefined' as a reserved javascript keyword

    Yes, they aren't, but using them as Ruby variable names ends up breaking
    everything, especially if you use them as parameter names.
    meh committed Oct 29, 2013
    Copy the full SHA
    e6144f8 View commit details
Showing with 15 additions and 10 deletions.
  1. +3 −3 corelib/array.rb
  2. +8 −3 corelib/enumerator.rb
  3. +4 −4 lib/opal/nodes/helpers.rb
6 changes: 3 additions & 3 deletions corelib/array.rb
Original file line number Diff line number Diff line change
@@ -1318,11 +1318,11 @@ def uniq!
def unshift(*objects)
%x{
for (var i = objects.length - 1; i >= 0; i--) {
#{self}.unshift(objects[i]);
self.unshift(objects[i]);
}
return #{self};
}

self
end

def zip(*others, &block)
11 changes: 8 additions & 3 deletions corelib/enumerator.rb
Original file line number Diff line number Diff line change
@@ -2,16 +2,21 @@ class Enumerator
include Enumerable

class Yielder
def initialize(enumerator = nil, &block)
def initialize(enumerator, block, to)
@enumerator = enumerator
@block = block
@to = to
end

def yield(*values)
@block.call(*values)
@to.call(*values)
end

alias << yield

def call
@block.call(self)
end
end

def initialize(obj = nil, method = :each, *args, &block)
@@ -28,7 +33,7 @@ def each(&block)
return enum_for :each unless block_given?

if @block
@block.call(Yielder.new(self, &block))
Yielder.new(self, @block, block).call
else
@object.__send__(@method, *@args, &block)
end
8 changes: 4 additions & 4 deletions lib/opal/nodes/helpers.rb
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ module Helpers
# Reserved javascript keywords - we cannot create variables with the
# same name
RESERVED = %w[
break case catch char continue debugger default delete do else finally
for function if in instanceof new return switch this throw try typeof
var let void while with class enum export extends import super true
false native const static
arguments break case catch char class const continue debugger default
delete do else enum export extends false finally for function if import
in instanceof let native new return static switch super this throw try
true typeof var void while with undefined
]

def property(name)