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

ruby-changes:34671

From: nobu <ko1@a...>
Date: Tue, 8 Jul 2014 16:01:26 +0900 (JST)
Subject: [ruby-changes:34671] nobu:r46754 (trunk): parse.y: expand is_asgn_or_id

nobu	2014-07-08 16:01:10 +0900 (Tue, 08 Jul 2014)

  New Revision: 46754

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

  Log:
    parse.y: expand is_asgn_or_id
    
    * parse.y (new_op_assign_gen): expand is_asgn_or_id(), which call
      id_type() function multiple times now.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 46753)
+++ parse.y	(revision 46754)
@@ -63,11 +63,6 @@ static inline int id_type(ID); https://github.com/ruby/ruby/blob/trunk/parse.y#L63
 #define is_class_id(id) (id_type(id)==ID_CLASS)
 #define is_junk_id(id) (id_type(id)==ID_JUNK)
 
-#define is_asgn_or_id(id) ((is_notop_id(id)) && \
-	((id_type(id)) == ID_GLOBAL || \
-	 (id_type(id)) == ID_INSTANCE || \
-	 (id_type(id)) == ID_CLASS))
-
 enum lex_state_bits {
     EXPR_BEG_bit,		/* ignore newline, +/- is a sign. */
     EXPR_END_bit,		/* newline significant, +/- is an operator. */
@@ -9610,8 +9605,13 @@ new_op_assign_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/parse.y#L9605
 	if (op == tOROP) {
 	    lhs->nd_value = rhs;
 	    asgn = NEW_OP_ASGN_OR(gettable(vid), lhs);
-	    if (is_asgn_or_id(vid)) {
-		asgn->nd_aid = vid;
+	    if (is_notop_id(vid)) {
+		switch (id_type(vid)) {
+		  case ID_GLOBAL:
+		  case ID_INSTANCE:
+		  case ID_CLASS:
+		    asgn->nd_aid = vid;
+		}
 	    }
 	}
 	else if (op == tANDOP) {

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

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