1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (rb_eval_string_wrap): should push frame (and adjust

cbase) before wrapped eval.

* eval.c (rb_eval_cmd): ditto.

* eval.c (eval): should update ruby_class always after all.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-07-03 09:37:08 +00:00
parent 08eef47e5b
commit f7ac4f227d
2 changed files with 25 additions and 7 deletions

View file

@ -1,3 +1,12 @@
Tue Jul 3 18:35:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_eval_string_wrap): should push frame (and adjust
cbase) before wrapped eval.
* eval.c (rb_eval_cmd): ditto.
* eval.c (eval): should update ruby_class always after all.
Tue Jul 3 14:56:27 2001 Shugo Maeda <shugo@ruby-lang.org>
* eval.c (block_pass): do not change wrapper information.

23
eval.c
View file

@ -1275,11 +1275,17 @@ rb_eval_string_wrap(str, state)
PUSH_CLASS();
ruby_class = ruby_wrapper = rb_module_new();
ruby_top_self = rb_obj_clone(ruby_top_self);
rb_extend_object(ruby_top_self, ruby_class);
rb_extend_object(ruby_top_self, ruby_wrapper);
PUSH_FRAME();
ruby_frame->last_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = self;
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_wrapper,0,0);
val = rb_eval_string_protect(str, &status);
ruby_top_self = self;
POP_FRAME();
POP_CLASS();
ruby_wrapper = wrapper;
if (state) {
@ -1333,16 +1339,19 @@ rb_eval_cmd(cmd, arg)
RARRAY(arg)->len, RARRAY(arg)->ptr);
}
PUSH_CLASS();
PUSH_TAG(PROT_NONE);
saved_scope = ruby_scope;
ruby_scope = top_scope;
PUSH_FRAME();
ruby_frame->last_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = ruby_top_self;
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_wrapper,0,0);
ruby_class = ruby_wrapper ? ruby_wrapper : rb_cObject;
if (OBJ_TAINTED(cmd)) {
ruby_safe_level = 4;
}
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
val = eval(ruby_top_self, cmd, Qnil, 0, 0);
}
@ -1352,7 +1361,7 @@ rb_eval_cmd(cmd, arg)
ruby_scope = saved_scope;
ruby_safe_level = safe;
POP_TAG();
POP_CLASS();
POP_FRAME();
jump_tag_but_local_jump(state);
return val;
@ -4868,7 +4877,6 @@ eval(self, src, scope, file, line)
file = ruby_sourcefile;
line = ruby_sourceline;
}
PUSH_CLASS();
if (!NIL_P(scope)) {
if (!rb_obj_is_block(scope)) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Binding)",
@ -4895,13 +4903,14 @@ eval(self, src, scope, file, line)
self = data->self;
ruby_frame->iter = data->iter;
ruby_class = ruby_cbase;
}
else {
if (ruby_frame->prev) {
ruby_frame->iter = ruby_frame->prev->iter;
}
}
PUSH_CLASS();
ruby_class = ruby_cbase;
ruby_in_eval++;
if (TYPE(ruby_class) == T_ICLASS) {