diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-23 07:05:59 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-23 07:05:59 +0000 |
commit | 552fb72159d3bb27ff40ecc121bbc52a3fff89a1 (patch) | |
tree | d6abf2514a01ce6f2ff5160cea2d132933af3973 /parse.y | |
parent | 44cf56d6e70dbe06a160b004494ba40dd4cfb426 (diff) |
2000-06-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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; |