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

* proc.c (rb_proc_new), vm.c (invoke_block): removed u3.state magic.

[ruby-core:14310]

* test/ruby/test_symbol.rb (test_to_proc): a test from Frederick
  Cheung <frederick.cheung AT gmail.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-12-24 04:55:37 +00:00
parent 7521299325
commit 4542f21a42
4 changed files with 14 additions and 10 deletions

View file

@ -1,3 +1,11 @@
Mon Dec 24 13:55:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* proc.c (rb_proc_new), vm.c (invoke_block): removed u3.state magic.
[ruby-core:14310]
* test/ruby/test_symbol.rb (test_to_proc): a test from Frederick
Cheung <frederick.cheung AT gmail.com>.
Mon Dec 24 13:43:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (rb_thread_atfork): should not leave living_threads

7
proc.c
View file

@ -1414,10 +1414,7 @@ rb_proc_new(
VALUE (*func)(ANYARGS), /* VALUE yieldarg[, VALUE procarg] */
VALUE val)
{
rb_proc_t *proc;
VALUE procval = rb_iterate((VALUE(*)(VALUE))mproc, 0, func, val);
GetProcPtr(procval, proc);
((NODE*)proc->block.iseq)->u3.state = 1;
VALUE procval = rb_iterate(mproc, 0, func, val);
return procval;
}
@ -1442,7 +1439,7 @@ method_proc(VALUE method)
* end
* end
*/
procval = rb_iterate((VALUE (*)(VALUE))mlambda, 0, bmcall, method);
procval = rb_iterate(mlambda, 0, bmcall, method);
GetProcPtr(procval, proc);
proc->is_from_method = 1;
return procval;

View file

@ -74,4 +74,8 @@ class TestSymbol < Test::Unit::TestCase
assert_inspect_evaled(':$0')
assert_inspect_evaled(':$1')
end
def test_to_proc
assert_equal %w(1 2 3), (1..3).map(&:to_s)
end
end

5
vm.c
View file

@ -568,11 +568,6 @@ invoke_block(rb_thread_t *th, rb_block_t *block, VALUE self,
val = vm_eval_body(th);
}
else {
if (((NODE*)block->iseq)->u3.state == 1) {
VALUE args = rb_ary_new4(argc, argv);
argc = 1;
argv = &args;
}
val = vm_yield_with_cfunc(th, block, self, argc, argv);
}
return val;