Project

General

Profile

Bug #14062 ยป top-level-return-warn-argument.patch

jeremyevans0 (Jeremy Evans), 07/26/2019 10:15 PM

View differences:

compile.c
switch (t) {
case ISEQ_TYPE_TOP:
case ISEQ_TYPE_MAIN:
if (retval) {
rb_warn("return at top-level with argument");
}
if (is == iseq) {
/* plain top-level, leave directly */
type = ISEQ_TYPE_METHOD;
test/ruby/test_syntax.rb
end
end
def test_return_toplevel_with_argument
assert_warn(/return at top-level with argument/) {eval("return 1")}
end
def test_syntax_error_in_rescue
bug12613 = '[ruby-core:76531] [Bug #12613]'
assert_syntax_error("#{<<-"begin;"}\n#{<<-"end;"}", /Invalid retry/, bug12613)
    (1-1/1)