diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-09 02:19:50 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-09 02:19:50 +0000 |
commit | 3d66cc4c6b9585227b6489497d66dbc065c6f6a6 (patch) | |
tree | c92c837c765644f1ba35a315090fbfb6cc90369d /eval.c | |
parent | 32481c4126c09a659dd240a44fe27a2af513dd52 (diff) |
* ext/dbm/dbm.c (fdbm_select): [ruby-dev:25132]
* ext/sdbm/init.c: ditto.
* ext/gdbm/gdbm.c: ditto.
* eval.c (proc_invoke): merge Guy Decoux's argument preserve
patch in [ruby-core:03874].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -3237,11 +3237,19 @@ rb_eval(self, n) } } if (nd_type(node) == NODE_ZSUPER) { - if (ruby_frame->prev && (ruby_frame->prev->flags & FRAME_DMETH)) { - rb_raise(rb_eRuntimeError, "super: specify arguments explicitly"); - } argc = ruby_frame->argc; - argv = ruby_scope->local_vars + 2; + if (argc && ruby_frame->prev && + (ruby_frame->prev->flags & FRAME_DMETH)) { + if (TYPE(RBASIC(ruby_scope)->klass) != T_ARRAY || + RARRAY(RBASIC(ruby_scope)->klass)->len != argc) { + rb_raise(rb_eRuntimeError, + "super: specify arguments explicitly"); + } + argv = RARRAY(RBASIC(ruby_scope)->klass)->ptr; + } + else { + argv = ruby_scope->local_vars + 2; + } } else { BEGIN_CALLARGS; @@ -8194,7 +8202,7 @@ proc_invoke(proc, args, self, klass) volatile int safe = ruby_safe_level; volatile VALUE old_wrapper = ruby_wrapper; volatile int pcall, avalue = Qtrue; - VALUE bvar = Qnil; + VALUE bvar = Qnil, tmp = args; Data_Get_Struct(proc, struct BLOCK, data); pcall = (data->flags & BLOCK_LAMBDA) ? YIELD_LAMBDA_CALL : 0; @@ -8217,6 +8225,14 @@ proc_invoke(proc, args, self, klass) _block.block_obj = bvar; if (self != Qundef) _block.frame.self = self; if (klass) _block.frame.last_class = klass; + _block.frame.argc = RARRAY(tmp)->len; + if (_block.frame.argc && (ruby_frame->flags & FRAME_DMETH)) { + NEWOBJ(scope, struct SCOPE); + OBJSETUP(scope, tmp, T_SCOPE); + scope->local_tbl = _block.scope->local_tbl; + scope->local_vars = _block.scope->local_vars; + _block.scope = scope; + } ruby_block = &_block; PUSH_ITER(ITER_CUR); |