ruby-changes:22771
From: nobu <ko1@a...>
Date: Sun, 26 Feb 2012 12:26:51 +0900 (JST)
Subject: [ruby-changes:22771] nobu:r34820 (ruby_1_9_3): merge revision(s) 34819:
nobu 2012-02-26 12:26:37 +0900 (Sun, 26 Feb 2012) New Revision: 34820 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34820 Log: merge revision(s) 34819: * compile.c (iseq_compile_each): call on special object instead of self. since stabby lambda is a syntax, so it should not be affected by the context. [ruby-core:42349][Bug #5966] * insns.def (send): no special deal for FCALL. self should be put on TOS instead. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/compile.c branches/ruby_1_9_3/insns.def branches/ruby_1_9_3/test/ruby/test_lambda.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 34819) +++ ruby_1_9_3/ChangeLog (revision 34820) @@ -1,3 +1,12 @@ +Sun Feb 26 12:26:26 2012 Nobuyoshi Nakada <nobu@r...> + + * compile.c (iseq_compile_each): call on special object instead of + self. since stabby lambda is a syntax, so it should not be + affected by the context. [ruby-core:42349][Bug #5966] + + * insns.def (send): no special deal for FCALL. self should be put + on TOS instead. + Sat Feb 25 23:47:49 2012 Nobuyoshi Nakada <nobu@r...> * file.c (utime_internal): fix a variable missed to replace. Index: ruby_1_9_3/insns.def =================================================================== --- ruby_1_9_3/insns.def (revision 34819) +++ ruby_1_9_3/insns.def (revision 34820) @@ -1009,7 +1009,7 @@ ID id = op_id; /* get receiver */ - recv = (flag & VM_CALL_FCALL_BIT) ? GET_SELF() : TOPN(num); + recv = TOPN(num); klass = CLASS_OF(recv); me = vm_method_search(id, klass, ic); CALL_METHOD(num, blockptr, flag, id, me, recv); Index: ruby_1_9_3/compile.c =================================================================== --- ruby_1_9_3/compile.c (revision 34819) +++ ruby_1_9_3/compile.c (revision 34820) @@ -208,7 +208,7 @@ ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(0)) #define ADD_CALL_RECEIVER(seq, line) \ - ADD_INSN((seq), (line), putnil) + ADD_INSN((seq), (line), putself) #define ADD_CALL(seq, line, id, argc) \ ADD_SEND_R((seq), (line), (id), (argc), (VALUE)Qfalse, (VALUE)INT2FIX(VM_CALL_FCALL_BIT)) @@ -5052,7 +5052,7 @@ /* compile same as lambda{...} */ VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, nd_line(node)); VALUE argc = INT2FIX(0); - ADD_CALL_RECEIVER(ret, nd_line(node)); + ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); ADD_CALL_WITH_BLOCK(ret, nd_line(node), ID2SYM(idLambda), argc, block); if (poped) { Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 34819) +++ ruby_1_9_3/version.h (revision 34820) @@ -1,10 +1,10 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 149 +#define RUBY_PATCHLEVEL 150 -#define RUBY_RELEASE_DATE "2012-02-25" +#define RUBY_RELEASE_DATE "2012-02-26" #define RUBY_RELEASE_YEAR 2012 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 25 +#define RUBY_RELEASE_DAY 26 #include "ruby/version.h" Index: ruby_1_9_3/test/ruby/test_lambda.rb =================================================================== --- ruby_1_9_3/test/ruby/test_lambda.rb (revision 34819) +++ ruby_1_9_3/test/ruby/test_lambda.rb (revision 34820) @@ -63,4 +63,11 @@ def foo assert_equal(nil, ->(&b){ b }.call) end + + def test_in_basic_object + bug5966 = '[ruby-core:42349]' + called = false + BasicObject.new.instance_eval {->() {called = true}.()} + assert_equal(true, called, bug5966) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/