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

ruby-changes:39846

From: nobu <ko1@a...>
Date: Thu, 24 Sep 2015 17:25:21 +0900 (JST)
Subject: [ruby-changes:39846] nobu:r51927 (trunk): parse.y: fix token

nobu	2015-09-24 17:25:11 +0900 (Thu, 24 Sep 2015)

  New Revision: 51927

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

  Log:
    parse.y: fix token
    
    * parse.y (paren_args): fix separator token at `foo::bar()` in
      ripper.

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ripper/test_parser_events.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51926)
+++ ChangeLog	(revision 51927)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Sep 24 17:25:09 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (paren_args): fix separator token at `foo::bar()` in
+	  ripper.
+
 Thu Sep 24 00:00:17 2015  Rei Odaira  <Rei.Odaira@g...>
 
 	* complex.c: ruby/config.h must be included before math.h
Index: parse.y
===================================================================
--- parse.y	(revision 51926)
+++ parse.y	(revision 51927)
@@ -3663,7 +3663,7 @@ method_call	: fcall paren_args https://github.com/ruby/ruby/blob/trunk/parse.y#L3663
 			$$ = NEW_CALL($1, $3, $5);
 			nd_set_line($$, $<num>4);
 		    /*%
-			$$ = dispatch3(call, $1, ripper_id2sym('.'), $3);
+			$$ = dispatch3(call, $1, ripper_id2sym(idCOLON2), $3);
 			$$ = method_optarg($$, $5);
 		    %*/
 		    }
@@ -10979,7 +10979,7 @@ ripper_id2sym(ID id) https://github.com/ruby/ruby/blob/trunk/parse.y#L10979
     const char *name;
     char buf[8];
 
-    if (id <= 256) {
+    if (ISASCII(id)) {
         buf[0] = (char)id;
         buf[1] = '\0';
         return ID2SYM(rb_intern2(buf, 1));
Index: test/ripper/test_parser_events.rb
===================================================================
--- test/ripper/test_parser_events.rb	(revision 51926)
+++ test/ripper/test_parser_events.rb	(revision 51927)
@@ -346,12 +346,41 @@ class TestRipper::ParserEvents < Test::U https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L346
     }
     assert_equal true, thru_call
     assert_equal "[call(ref(self),.,foo)]", tree
+
+    thru_call = false
+    assert_nothing_raised {
+      tree = parse("self.foo()", :on_call) {thru_call = true}
+    }
+    assert_equal true, thru_call
+    assert_equal "[call(ref(self),.,foo,[])]", tree
+
     thru_call = false
     assert_nothing_raised(bug2233) {
       tree = parse("foo.()", :on_call) {thru_call = true}
     }
     assert_equal true, thru_call
     assert_equal "[call(vcall(foo),.,call,[])]", tree
+
+    thru_call = false
+    assert_nothing_raised {
+      tree = parse("self::foo", :on_call) {thru_call = true}
+    }
+    assert_equal true, thru_call
+    assert_equal "[call(ref(self),::,foo)]", tree
+
+    thru_call = false
+    assert_nothing_raised {
+      tree = parse("self::foo()", :on_call) {thru_call = true}
+    }
+    assert_equal true, thru_call
+    assert_equal "[call(ref(self),::,foo,[])]", tree
+
+    thru_call = false
+    assert_nothing_raised(bug2233) {
+      tree = parse("foo::()", :on_call) {thru_call = true}
+    }
+    assert_equal true, thru_call
+    assert_equal "[call(vcall(foo),::,call,[])]", tree
   end
 
   def test_excessed_comma

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

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