Skip to content

Commit

Permalink
Fix code generator for (::Foo = bar)
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Sep 26, 2013
1 parent 6e0f547 commit ffa9d79
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 124 deletions.
8 changes: 6 additions & 2 deletions lib/opal/grammar.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/opal/grammar.y
Expand Up @@ -363,6 +363,9 @@ lhs:
result = s(:colon2, val[0], val[2].intern)
}
| '::@' CONSTANT
{
result = s(:colon3, val[1].intern)
}
| backref

cname:
Expand Down
4 changes: 4 additions & 0 deletions lib/opal/grammar_helpers.rb
Expand Up @@ -222,6 +222,10 @@ def new_assign(lhs, rhs)
lhs << rhs
lhs[0] = :casgn
lhs
when :colon3
lhs << rhs
lhs[0] = :casgn3
lhs
else
raise "Bad lhs for new_assign: #{lhs[0]}"
end
Expand Down
5 changes: 5 additions & 0 deletions lib/opal/parser.rb
Expand Up @@ -2049,6 +2049,11 @@ def process_colon3(exp, level)
end
end

def process_casgn3(sexp, level)
cid, rhs = sexp
[f("$opal.Object._scope.#{cid} = "), process(rhs)]
end

# super a, b, c
#
# s(:super, arg1, arg2, ...)
Expand Down
6 changes: 6 additions & 0 deletions spec/filters/bugs/class.rb
@@ -0,0 +1,6 @@
opal_filter "Class" do
fails "Class.new raises a TypeError if passed a metaclass"
fails "Class.new creates a class that can be given a name by assigning it to a constant"
fails "Class.new raises a TypeError when given a non-Class"
fails "Class#new passes the block to #initialize"
end
9 changes: 0 additions & 9 deletions spec/rubyspec/core/class/fixtures/classes.rb

This file was deleted.

113 changes: 0 additions & 113 deletions spec/rubyspec/core/class/new_spec.rb

This file was deleted.

1 change: 1 addition & 0 deletions spec/rubyspecs
Expand Up @@ -229,3 +229,4 @@ core/matchdata/to_a_spec
core/range/begin_spec
core/range/end_spec
core/symbol/to_proc_spec
core/class/new_spec

0 comments on commit ffa9d79

Please sign in to comment.