ruby-changes:49320
From: nobu <ko1@a...>
Date: Sun, 24 Dec 2017 11:38:33 +0900 (JST)
Subject: [ruby-changes:49320] nobu:r61437 (trunk): compile.c: toplevel return arguments
nobu 2017-12-24 11:38:27 +0900 (Sun, 24 Dec 2017) New Revision: 61437 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61437 Log: compile.c: toplevel return arguments * compile.c (compile_return): evaluate arguments to top-level return but ignore the results. Modified files: trunk/compile.c trunk/test/ruby/test_syntax.rb Index: compile.c =================================================================== --- compile.c (revision 61436) +++ compile.c (revision 61437) @@ -5367,7 +5367,6 @@ compile_return(rb_iseq_t *iseq, LINK_ANC https://github.com/ruby/ruby/blob/trunk/compile.c#L5367 /* plain top-level, leave directly */ type = ISEQ_TYPE_METHOD; } - retval = 0; break; default: break; Index: test/ruby/test_syntax.rb =================================================================== --- test/ruby/test_syntax.rb (revision 61436) +++ test/ruby/test_syntax.rb (revision 61437) @@ -1006,6 +1006,7 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1006 begin raise; ensure return; end; self begin raise; ensure return; end and self nil&defined?0--begin e=no_method_error(); return; 0;end + return puts('ignored') #=> ignored end; .split(/\n/).map {|s|[(line+=1), *s.split(/#=> /, 2)]} failed = proc do |n, s| -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/