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

ruby-changes:40237

From: nobu <ko1@a...>
Date: Wed, 28 Oct 2015 13:29:48 +0900 (JST)
Subject: [ruby-changes:40237] nobu:r52318 (trunk): parse.y: fix op_assign type

nobu	2015-10-28 13:29:41 +0900 (Wed, 28 Oct 2015)

  New Revision: 52318

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

  Log:
    parse.y: fix op_assign type
    
    * parse.y (new_attr_op_assign): fix op_assign type, which is
      already an ID since r52284.  [Feature #11537]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ripper/test_parser_events.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52317)
+++ ChangeLog	(revision 52318)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Oct 28 13:29:39 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (new_attr_op_assign): fix op_assign type, which is
+	  already an ID since r52284.  [Feature #11537]
+
 Tue Oct 27 23:14:14 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* defs/id.def: enable anonymous IDs not to expose internal IDs for
Index: parse.y
===================================================================
--- parse.y	(revision 52317)
+++ parse.y	(revision 52318)
@@ -521,7 +521,7 @@ static int id_is_var_gen(struct parser_p https://github.com/ruby/ruby/blob/trunk/parse.y#L521
 
 static VALUE new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs);
 static VALUE new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE type, VALUE attr, VALUE op, VALUE rhs);
-#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), ripper_id2sym(type), (attr), (op), (rhs))
+#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), (type), (attr), (op), (rhs))
 
 #endif /* !RIPPER */
 
Index: test/ripper/test_parser_events.rb
===================================================================
--- test/ripper/test_parser_events.rb	(revision 52317)
+++ test/ripper/test_parser_events.rb	(revision 52318)
@@ -789,6 +789,16 @@ class TestRipper::ParserEvents < Test::U https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L789
     tree = parse('a::X ||= c 1', :on_opassign) {thru_opassign = true}
     assert_equal true, thru_opassign
     assert_equal "[opassign(const_path_field(vcall(a),X),||=,command(c,[1]))]", tree
+
+    thru_opassign = false
+    tree = parse("self.foo += 1", :on_opassign) {thru_opassign = true}
+    assert_equal true, thru_opassign
+    assert_equal "[opassign(field(ref(self),.,foo),+=,1)]", tree
+
+    thru_opassign = false
+    tree = parse("self.?foo += 1", :on_opassign) {thru_opassign = true}
+    assert_equal true, thru_opassign
+    assert_equal "[opassign(field(ref(self),.?,foo),+=,1)]", tree
   end
 
   def test_opassign_error

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

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