mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
proc.c: set ep properly
* proc.c (proc_new): link ep to calling block. [ruby-core:70980] [Bug #11566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c09cdd9f5e
commit
2475db5764
3 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Oct 5 15:34:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* proc.c (proc_new): link ep to calling block.
|
||||||
|
[ruby-core:70980] [Bug #11566]
|
||||||
|
|
||||||
Mon Oct 5 00:53:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Oct 5 00:53:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* dir.c (rb_dir_getwd): make ASCII-8BIT if filesystem encoding is
|
* dir.c (rb_dir_getwd): make ASCII-8BIT if filesystem encoding is
|
||||||
|
|
1
proc.c
1
proc.c
|
@ -601,6 +601,7 @@ proc_new(VALUE klass, int8_t is_lambda)
|
||||||
if (RUBY_VM_IFUNC_P(procval)) {
|
if (RUBY_VM_IFUNC_P(procval)) {
|
||||||
VALUE newprocval = rb_proc_alloc(klass);
|
VALUE newprocval = rb_proc_alloc(klass);
|
||||||
rb_proc_t *proc = RTYPEDDATA_DATA(newprocval);
|
rb_proc_t *proc = RTYPEDDATA_DATA(newprocval);
|
||||||
|
proc->block = *block;
|
||||||
proc->block.iseq = (rb_iseq_t *)procval;
|
proc->block.iseq = (rb_iseq_t *)procval;
|
||||||
proc->block.proc = newprocval;
|
proc->block.proc = newprocval;
|
||||||
return newprocval;
|
return newprocval;
|
||||||
|
|
|
@ -117,18 +117,29 @@ class TestSymbol < Test::Unit::TestCase
|
||||||
ary_ids = ary.collect{|x| x.object_id }
|
ary_ids = ary.collect{|x| x.object_id }
|
||||||
assert_equal ary_ids, ary.collect(&:object_id)
|
assert_equal ary_ids, ary.collect(&:object_id)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_to_proc_yield
|
||||||
assert_ruby_status([], <<-"end;", timeout: 5.0)
|
assert_ruby_status([], <<-"end;", timeout: 5.0)
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
true.tap(&:itself)
|
true.tap(&:itself)
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_to_proc_new_proc
|
||||||
assert_ruby_status([], <<-"end;", timeout: 5.0)
|
assert_ruby_status([], <<-"end;", timeout: 5.0)
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
2.times {Proc.new(&:itself)}
|
2.times {Proc.new(&:itself)}
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_to_proc_no_method
|
||||||
|
assert_separately([], <<-"end;", timeout: 5.0)
|
||||||
|
bug11566 = '[ruby-core:70980] [Bug #11566]'
|
||||||
|
assert_raise(NoMethodError, bug11566) {Proc.new(&:foo).(1)}
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
def test_call
|
def test_call
|
||||||
o = Object.new
|
o = Object.new
|
||||||
def o.foo(x, y); x + y; end
|
def o.foo(x, y); x + y; end
|
||||||
|
|
Loading…
Add table
Reference in a new issue