[前][次][番号順一覧][スレッド一覧]

ruby-changes:53245

From: nobu <ko1@a...>
Date: Wed, 31 Oct 2018 08:43:19 +0900 (JST)
Subject: [ruby-changes:53245] nobu:r65460 (trunk): parse.y: last location from bison

nobu	2018-10-31 08:43:13 +0900 (Wed, 31 Oct 2018)

  New Revision: 65460

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65460

  Log:
    parse.y: last location from bison
    
    * parse.y (command): set the last location from the location
      managed by bison, so that other nodes are not needed.
      [ruby-core:89648] [Bug #15271]

  Modified files:
    trunk/parse.y
    trunk/test/ruby/test_syntax.rb
Index: parse.y
===================================================================
--- parse.y	(revision 65459)
+++ parse.y	(revision 65460)
@@ -1351,7 +1351,7 @@ command		: fcall command_args       %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1351
 		    {
 		    /*%%%*/
 			$1->nd_args = $2;
-			nd_set_last_loc($1, nd_last_loc($2));
+			nd_set_last_loc($1, @2.end_pos);
 			$$ = $1;
 		    /*% %*/
 		    /*% ripper: command!($1, $2) %*/
@@ -1363,7 +1363,7 @@ command		: fcall command_args       %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1363
 			$1->nd_args = $2;
 			$$ = method_add_block(p, $1, $3, &@$);
 			fixpos($$, $1);
-			nd_set_last_loc($1, nd_last_loc($2));
+			nd_set_last_loc($1, @2.end_pos);
 		    /*% %*/
 		    /*% ripper: method_add_block!(command!($1, $2), $3) %*/
 		    }
Index: test/ruby/test_syntax.rb
===================================================================
--- test/ruby/test_syntax.rb	(revision 65459)
+++ test/ruby/test_syntax.rb	(revision 65460)
@@ -179,6 +179,11 @@ class TestSyntax < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L179
       bug13756 = '[ruby-core:82113] [Bug #13756]'
       assert_valid_syntax("defined? foo(**{})", bug13756)
     end;
+    assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+    begin;
+      bug15271 = '[ruby-core:89648] [Bug #15271]'
+      assert_valid_syntax("a **{}", bug15271)
+    end;
   end
 
   def test_keyword_self_reference

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]