ruby-changes:47291
From: nagachika <ko1@a...>
Date: Sun, 23 Jul 2017 17:16:04 +0900 (JST)
Subject: [ruby-changes:47291] nagachika:r59406 (ruby_2_4): merge revision(s) 58638, 58640: [Backport #11873]
nagachika 2017-07-23 17:15:57 +0900 (Sun, 23 Jul 2017) New Revision: 59406 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59406 Log: merge revision(s) 58638,58640: [Backport #11873] test_syntax.rb: test_brace_after_local_variable * test/ruby/test_syntax.rb (test_brace_after_local_variable): another test using braces. [Bug #11873] parse.y: do after cmdarg in paren * parse.y (parser_yylex): set state to ENDARG after a string literal, so that `do` after a literal should be `do_block` and bound to the outer method, as well as a numeric/symbol literal. [ruby-core:72482] [Bug #11873] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/parse.y branches/ruby_2_4/test/ruby/test_syntax.rb branches/ruby_2_4/version.h Index: ruby_2_4/test/ruby/test_syntax.rb =================================================================== --- ruby_2_4/test/ruby/test_syntax.rb (revision 59405) +++ ruby_2_4/test/ruby/test_syntax.rb (revision 59406) @@ -898,6 +898,10 @@ eom https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_syntax.rb#L898 assert_valid_syntax %q{a b(c d), 1 do end}, bug11873 assert_valid_syntax %q{a b{c(d)}, 1 do end}, bug11873 assert_valid_syntax %q{a b(c(d)), 1 do end}, bug11873 + assert_valid_syntax %q{a b{c d}, "x" do end}, bug11873 + assert_valid_syntax %q{a b(c d), "x" do end}, bug11873 + assert_valid_syntax %q{a b{c(d)}, "x" do end}, bug11873 + assert_valid_syntax %q{a b(c(d)), "x" do end}, bug11873 end def test_block_after_cmdarg_in_paren @@ -938,6 +942,15 @@ eom https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_syntax.rb#L942 end assert_equal(:ok, result) end + + def test_brace_after_local_variable + obj = Object.new + def obj.m; yield; end + result = assert_nothing_raised(SyntaxError) do + obj.instance_eval("m = 1; m {:ok}") + end + assert_equal(:ok, result) + end def test_return_toplevel feature4840 = '[ruby-core:36785] [Feature #4840]' Index: ruby_2_4/parse.y =================================================================== --- ruby_2_4/parse.y (revision 59405) +++ ruby_2_4/parse.y (revision 59406) @@ -8019,7 +8019,7 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/ruby_2_4/parse.y#L8019 if (token == tSTRING_END || token == tREGEXP_END || token == tLABEL_END) { rb_gc_force_recycle((VALUE)lex_strterm); lex_strterm = 0; - SET_LEX_STATE(token == tLABEL_END ? EXPR_BEG|EXPR_LABEL : EXPR_END); + SET_LEX_STATE(token == tLABEL_END ? EXPR_BEG|EXPR_LABEL : EXPR_ENDARG); } } return token; Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59405) +++ ruby_2_4/version.h (revision 59406) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.2" #define RUBY_RELEASE_DATE "2017-07-23" -#define RUBY_PATCHLEVEL 157 +#define RUBY_PATCHLEVEL 158 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 7 Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59405) +++ ruby_2_4 (revision 59406) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58638,58640 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/