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

ruby-changes:34285

From: nobu <ko1@a...>
Date: Fri, 6 Jun 2014 22:19:47 +0900 (JST)
Subject: [ruby-changes:34285] nobu:r46366 (trunk): node.h: remove NODE_PRIVATE_RECV

nobu	2014-06-06 22:19:31 +0900 (Fri, 06 Jun 2014)

  New Revision: 46366

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

  Log:
    node.h: remove NODE_PRIVATE_RECV
    
    * compile.c (private_recv_p): check by node type, instead of a
      magic number.
    * node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/node.h
    trunk/parse.y
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46365)
+++ ChangeLog	(revision 46366)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun  6 22:19:26 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (private_recv_p): check by node type, instead of a
+	  magic number.
+
+	* node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove
+
 Fri Jun  6 17:07:08 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* compile.c (iseq_compile_each), parse.y (new_attr_op_assign_gen):
Index: compile.c
===================================================================
--- compile.c	(revision 46365)
+++ compile.c	(revision 46366)
@@ -2791,7 +2791,7 @@ compile_cpath(LINK_ANCHOR *ret, rb_iseq_ https://github.com/ruby/ruby/blob/trunk/compile.c#L2791
     }
 }
 
-#define private_recv_p(node) ((node)->nd_recv == NODE_PRIVATE_RECV)
+#define private_recv_p(node) (nd_type((node)->nd_recv) == NODE_SELF)
 
 #define defined_expr defined_expr0
 static int
Index: parse.y
===================================================================
--- parse.y	(revision 46365)
+++ parse.y	(revision 46366)
@@ -444,7 +444,6 @@ static NODE *aryset_gen(struct parser_pa https://github.com/ruby/ruby/blob/trunk/parse.y#L444
 #define aryset(node1,node2) aryset_gen(parser, (node1), (node2))
 static NODE *attrset_gen(struct parser_params*,NODE*,ID);
 #define attrset(node,id) attrset_gen(parser, (node), (id))
-static inline NODE *attr_receiver(NODE *recv);
 
 static void rb_backref_error_gen(struct parser_params*,NODE*);
 #define rb_backref_error(n) rb_backref_error_gen(parser,(n))
@@ -1206,7 +1205,7 @@ stmt		: keyword_alias fitem {lex_state = https://github.com/ruby/ruby/blob/trunk/parse.y#L1205
 			else if ($5 == tANDOP) {
 			    $5 = 1;
 			}
-			$$ = NEW_OP_ASGN1(attr_receiver($1), $5, args);
+			$$ = NEW_OP_ASGN1($1, $5, args);
 			fixpos($$, $1);
 		    /*%
 			$$ = dispatch2(aref_field, $1, escape_Qundef($3));
@@ -1998,7 +1997,7 @@ arg		: lhs '=' arg https://github.com/ruby/ruby/blob/trunk/parse.y#L1997
 			else if ($5 == tANDOP) {
 			    $5 = 1;
 			}
-			$$ = NEW_OP_ASGN1(attr_receiver($1), $5, args);
+			$$ = NEW_OP_ASGN1($1, $5, args);
 			fixpos($$, $1);
 		    /*%
 			$1 = dispatch2(aref_field, $1, escape_Qundef($3));
@@ -8825,7 +8824,6 @@ new_bv_gen(struct parser_params *parser, https://github.com/ruby/ruby/blob/trunk/parse.y#L8824
 static NODE *
 aryset_gen(struct parser_params *parser, NODE *recv, NODE *idx)
 {
-    recv = attr_receiver(recv);
     return NEW_ATTRASGN(recv, tASET, idx);
 }
 
@@ -8895,18 +8893,9 @@ rb_id_attrget(ID id) https://github.com/ruby/ruby/blob/trunk/parse.y#L8893
     return attrsetname_to_attr(rb_id2str(id));
 }
 
-static inline NODE *
-attr_receiver(NODE *recv)
-{
-    if (recv && nd_type(recv) == NODE_SELF)
-	recv = NODE_PRIVATE_RECV;
-    return recv;
-}
-
 static NODE *
 attrset_gen(struct parser_params *parser, NODE *recv, ID id)
 {
-    recv = attr_receiver(recv);
     return NEW_ATTRASGN(recv, rb_id_attrset(id), 0);
 }
 
@@ -9650,7 +9639,6 @@ new_attr_op_assign_gen(struct parser_par https://github.com/ruby/ruby/blob/trunk/parse.y#L9639
     else if (op == tANDOP) {
 	op = 1;
     }
-    lhs = attr_receiver(lhs);
     asgn = NEW_OP_ASGN2(lhs, attr, op, rhs);
     fixpos(asgn, lhs);
     return asgn;
Index: node.h
===================================================================
--- node.h	(revision 46365)
+++ node.h	(revision 46366)
@@ -465,8 +465,6 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L465
 #define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
 #define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
 
-#define NODE_PRIVATE_RECV ((NODE *)1)
-
 #define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
 #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
 #define NEW_MEMO_FOR(type, value) \

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

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