From 2e5cf0b7116751344ebefda08a70ca2de570c89b Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 24 Dec 2017 02:38:27 +0000 Subject: [PATCH] compile.c: toplevel return arguments * compile.c (compile_return): evaluate arguments to top-level return but ignore the results. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 1 - test/ruby/test_syntax.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/compile.c b/compile.c index 95d0e5f891..0c966a7b4b 100644 --- a/compile.c +++ b/compile.c @@ -5367,7 +5367,6 @@ compile_return(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, /* plain top-level, leave directly */ type = ISEQ_TYPE_METHOD; } - retval = 0; break; default: break; diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 5582c70556..aa82f52987 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1006,6 +1006,7 @@ eom 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|