From 552fb72159d3bb27ff40ecc121bbc52a3fff89a1 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 23 Jun 2000 07:05:59 +0000 Subject: 2000-06-23 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 75c0ad8acd..7b47c7f6ed 100644 --- a/parse.y +++ b/parse.y @@ -83,6 +83,7 @@ static int in_defined = 0; static NODE *arg_blk_pass(); static NODE *new_call(); static NODE *new_fcall(); +static NODE *new_super(); static NODE *gettable(); static NODE *assignable(); @@ -451,7 +452,7 @@ command_call : operation call_args { if (!compile_for_eval && !cur_mid && !in_single) yyerror("super called outside of method"); - $$ = NEW_SUPER($2); + $$ = new_super($2); fixpos($$, $2); } @@ -1390,7 +1391,7 @@ method_call : operation '(' opt_call_args close_paren if (!compile_for_eval && !cur_mid && !in_single && !in_defined) yyerror("super called outside of method"); - $$ = NEW_SUPER($3); + $$ = new_super($3); } | kSUPER { @@ -4387,6 +4388,17 @@ new_fcall(m,a) return NEW_FCALL(m,a); } +static NODE* +new_super(a) + NODE *a; +{ + if (a && nd_type(a) == NODE_BLOCK_PASS) { + a->nd_iter = NEW_SUPER(a->nd_head); + return a; + } + return NEW_SUPER(a); +} + static struct local_vars { ID *tbl; int nofree; -- cgit v1.2.3