Skip to content

Commit

Permalink
[Truffle] Add spec for z super with a block.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed May 8, 2015
1 parent 36fbd3b commit d15ad1d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
15 changes: 15 additions & 0 deletions spec/ruby/language/fixtures/super.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,19 @@ class AnonymousModuleIncludedTwice < AnonymousModuleIncludedTwiceBase
whatever
whatever
end

module ZSuperWithBlock
class A
def a
yield
end
end

class B < A
def a
super { 14 }
end
end
end

end
5 changes: 5 additions & 0 deletions spec/ruby/language/super_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,9 @@ def a(arg)
it "invokes methods from a chain of anonymous modules" do
Super::AnonymousModuleIncludedTwice.new.a([]).should == ["anon", "anon", "non-anon"]
end

it "can accept a block but still pass the original arguments" do

This comment has been minimized.

Copy link
@eregon

eregon May 11, 2015

Member

What are the original arguments here? "no argument" ?

This comment has been minimized.

Copy link
@chrisseaton

chrisseaton May 11, 2015

Author Contributor

Yes - perhaps I should include some actual arguments.

Super::ZSuperWithBlock::B.new.a.should == 14
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ public RubyNode visitZSuperNode(org.jruby.ast.ZSuperNode node) {

if (node.getIterNode() != null) {
currentCallMethodName = environment.getNamedMethodName();
node.getIterNode().accept(this);
blockNode = null;
blockNode = node.getIterNode().accept(this);
} else {
blockNode = null;
}
Expand Down

0 comments on commit d15ad1d

Please sign in to comment.