Permalink
Browse files

Fix super with explicit args, but implicit block

Remove some extra prints from debugging this stuff

git-svn-id: http://svn.codehaus.org/jruby/branches/enebo_block@2832 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
1 parent a190726 commit 6b5cc1875ada3df3d5037879445dd99646639abe @enebo enebo committed Jan 23, 2007
@@ -1349,6 +1349,9 @@ private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyO
IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self);
Block block = getBlock(context, self, aBlock, iVisited.getIterNode());
+ // If no explicit block passed to super, then use the one passed in.
+ if (block == null) block = aBlock;
+
return context.callSuper(args, block);
}
case NodeTypes.SVALUENODE: {
View
@@ -48,9 +48,7 @@
h = Hash.new {|h,k| h[k] = k.to_i*10 }
test_ok(!nil, h.default_proc)
-puts "A"
test_equal(100, h[10])
-puts "B"
test_equal(20, h.default(2))
#behavior change in 1.8.5 led to this:
@@ -368,7 +368,7 @@ def print_tree(node, indent="")
['IterNode',0,0,6,8]
]
-test_tree(list, <<'END', "operation brace_block [parens no-args block", true)
+test_tree(list, <<'END', "operation brace_block [parens no-args block")
foo() {}
END
View
@@ -258,4 +258,18 @@ def single(a = 1) super end
# call Base#single with 1 argument; the arg is supplied
test_equal(1, Optional3.new.single)
+class SuperBase
+ def create_table(a)
+ test_equal(true, block_given?)
+ end
+end
+
+class SuperDerived < SuperBase
+ def create_table(name)
+ super("HEH")
+ end
+end
+
+SuperDerived.new.create_table("A") { }
+

0 comments on commit 6b5cc18

Please sign in to comment.