ruby-changes:50393
From: naruse <ko1@a...>
Date: Wed, 21 Feb 2018 14:42:48 +0900 (JST)
Subject: [ruby-changes:50393] naruse:r62509 (ruby_2_5): merge revision(s) 61523: [Backport #14261]
naruse 2018-02-21 14:42:42 +0900 (Wed, 21 Feb 2018) New Revision: 62509 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62509 Log: merge revision(s) 61523: [Backport #14261] parse.y: assignable_error * parse.y (assignable_gen): should return valid NODE always even on errors. [ruby-core:84565] [Bug #14261] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/parse.y branches/ruby_2_5/test/ruby/test_parse.rb branches/ruby_2_5/version.h Index: ruby_2_5/test/ruby/test_parse.rb =================================================================== --- ruby_2_5/test/ruby/test_parse.rb (revision 62508) +++ ruby_2_5/test/ruby/test_parse.rb (revision 62509) @@ -746,6 +746,12 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_parse.rb#L746 end END end + assert_raise(SyntaxError) do + eval "#{<<~"begin;"}\n#{<<~'end;'}", nil, __FILE__, __LINE__+1 + begin; + x, true + end; + end end def test_block_dup Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 62508) +++ ruby_2_5/version.h (revision 62509) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.0" #define RUBY_RELEASE_DATE "2018-02-21" -#define RUBY_PATCHLEVEL 26 +#define RUBY_PATCHLEVEL 27 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 2 Index: ruby_2_5/parse.y =================================================================== --- ruby_2_5/parse.y (revision 62508) +++ ruby_2_5/parse.y (revision 62509) @@ -1983,18 +1983,10 @@ mlhs_node : user_variable https://github.com/ruby/ruby/blob/trunk/ruby_2_5/parse.y#L1983 lhs : user_variable { $$ = assignable(var_field($1), 0, &@$); - /*%%%*/ - if (!$$) $$ = new_begin(0, &@$); - /*% - %*/ } | keyword_variable { $$ = assignable(var_field($1), 0, &@$); - /*%%%*/ - if (!$$) $$ = new_begin(0, &@$); - /*% - %*/ } | primary_value '[' opt_call_args rbracket { @@ -9957,11 +9949,13 @@ assignable_gen(struct parser_params *par https://github.com/ruby/ruby/blob/trunk/ruby_2_5/parse.y#L9949 #ifdef RIPPER ID id = get_id(lhs); # define assignable_result(x) (lhs) +# define assignable_error() (lhs) # define parser_yyerror(parser, x) (lhs = assign_error_gen(parser, lhs)) #else # define assignable_result(x) assignable_result0(x, location) +# define assignable_error() new_begin(0, location) #endif - if (!id) return assignable_result(0); + if (!id) return assignable_error(); switch (id) { case keyword_self: yyerror0("Can't change the value of self"); @@ -10024,7 +10018,7 @@ assignable_gen(struct parser_params *par https://github.com/ruby/ruby/blob/trunk/ruby_2_5/parse.y#L10018 compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to set", rb_id2str(id)); } error: - return assignable_result(0); + return assignable_error(); #undef assignable_result #undef parser_yyerror } Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 62508) +++ ruby_2_5 (revision 62509) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r61523 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/