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

* eval.c (block_pass): do not change wrapper information.

* eval.c (rb_yield_0):  preserve wrapper information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2001-07-03 05:57:16 +00:00
parent 066cfdc133
commit 604a8f1883
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Tue Jul 3 14:56:27 2001 Shugo Maeda <shugo@ruby-lang.org>
* eval.c (block_pass): do not change wrapper information.
* eval.c (rb_yield_0): preserve wrapper information.
Tue Jul 3 14:49:51 2001 Shugo Maeda <shugo@ruby-lang.org>
* error.c (rb_name_error): raise NameError instead of LoadError.

9
eval.c
View file

@ -582,6 +582,7 @@ new_blktag()
_block.vmode = scope_vmode; \
_block.flags = BLOCK_D_SCOPE; \
_block.dyna_vars = ruby_dyna_vars; \
_block.wrapper = ruby_wrapper; \
ruby_block = &_block;
#define POP_BLOCK_TAG(tag) do { \
@ -3605,6 +3606,7 @@ rb_yield_0(val, self, klass, pcall)
NODE *node;
volatile VALUE result = Qnil;
volatile VALUE old_cref;
volatile VALUE old_wrapper;
struct BLOCK * volatile block;
struct SCOPE * volatile old_scope;
struct FRAME frame;
@ -3623,6 +3625,8 @@ rb_yield_0(val, self, klass, pcall)
ruby_frame = &(frame);
old_cref = (VALUE)ruby_cref;
ruby_cref = (NODE*)ruby_frame->cbase;
old_wrapper = ruby_wrapper;
ruby_wrapper = block->wrapper;
old_scope = ruby_scope;
ruby_scope = block->scope;
ruby_block = block->prev;
@ -3726,6 +3730,7 @@ rb_yield_0(val, self, klass, pcall)
ruby_block = block;
ruby_frame = ruby_frame->prev;
ruby_cref = (NODE*)old_cref;
ruby_wrapper = old_wrapper;
if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
scope_dup(old_scope);
ruby_scope = old_scope;
@ -6515,7 +6520,6 @@ block_pass(self, node)
int state;
volatile int orphan;
volatile int safe = ruby_safe_level;
volatile VALUE old_wrapper = ruby_wrapper;
if (NIL_P(block)) {
return rb_eval(self, node->nd_iter);
@ -6531,8 +6535,6 @@ block_pass(self, node)
Data_Get_Struct(block, struct BLOCK, data);
orphan = blk_orphan(data);
ruby_wrapper = data->wrapper;
/* PUSH BLOCK from data */
old_block = ruby_block;
_block = *data;
@ -6570,7 +6572,6 @@ block_pass(self, node)
}
}
ruby_block = old_block;
ruby_wrapper = old_wrapper;
ruby_safe_level = safe;
switch (state) {/* escape from orphan procedure */