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

ruby-changes:49866

From: mame <ko1@a...>
Date: Sun, 21 Jan 2018 01:21:25 +0900 (JST)
Subject: [ruby-changes:49866] mame:r61984 (trunk): parse.y: remove double meaning of const_path_field/top_const_field

mame	2018-01-21 01:21:20 +0900 (Sun, 21 Jan 2018)

  New Revision: 61984

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

  Log:
    parse.y: remove double meaning of const_path_field/top_const_field

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61983)
+++ parse.y	(revision 61984)
@@ -408,8 +408,6 @@ static NODE *new_ary_op_assign(struct pa https://github.com/ruby/ruby/blob/trunk/parse.y#L408
 static NODE *new_attr_op_assign(struct parser_params *p, NODE *lhs, ID atype, ID attr, ID op, NODE *rhs, const YYLTYPE *loc);
 static NODE *new_const_op_assign(struct parser_params *p, NODE *lhs, ID op, NODE *rhs, const YYLTYPE *loc);
 
-#define const_path_field(w, n, loc) NEW_COLON2(w, n, loc)
-#define top_const_field(n,loc) NEW_COLON3(n,loc)
 static NODE *const_decl(struct parser_params *p, NODE* path, const YYLTYPE *loc);
 
 static NODE *opt_arg_append(NODE*, NODE*);
@@ -495,9 +493,7 @@ static VALUE new_xstring(struct parser_p https://github.com/ruby/ruby/blob/trunk/parse.y#L493
 #define new_brace_body(param, stmt, loc) dispatch2(brace_block, escape_Qundef(param), stmt)
 #define new_do_body(param, stmt, loc) dispatch2(do_block, escape_Qundef(param), stmt)
 
-#define const_path_field(w, n, loc) dispatch2(const_path_field, (w), (n))
-#define top_const_field(n,loc) dispatch1(top_const_field, (n))
-static VALUE const_decl(struct parser_params *p, VALUE path, const YYLTYPE *loc);
+static VALUE const_decl(struct parser_params *p, VALUE path);
 
 static VALUE var_field(struct parser_params *p, VALUE a);
 static VALUE assign_error(struct parser_params *p, VALUE a);
@@ -1245,9 +1241,9 @@ command_asgn	: lhs '=' command_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1241
 		    {
 		    /*%%%*/
 			YYLTYPE loc = code_loc_gen(&@1, &@3);
+			$$ = new_const_op_assign(p, NEW_COLON2($1, $3, &loc), $4, $5, &@$);
 		    /*% %*/
-			$$ = const_path_field($1, $3, &loc);
-			$$ = new_const_op_assign(p, $$, $4, $5, &@$);
+		    /*% ripper: opassign!(const_path_field!($1, $3), $4, $5) %*/
 		    }
 		| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
 		    {
@@ -1598,11 +1594,17 @@ mlhs_node	: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1594
 		    }
 		| primary_value tCOLON2 tCONSTANT
 		    {
-			$$ = const_decl(p, const_path_field($1, $3, &@$), &@$);
+		    /*%%%*/
+			$$ = const_decl(p, NEW_COLON2($1, $3, &@$), &@$);
+		    /*% %*/
+		    /*% ripper: const_decl(p, const_path_field!($1, $3)) %*/
 		    }
 		| tCOLON3 tCONSTANT
 		    {
-			$$ = const_decl(p, top_const_field($2, &@$), &@$);
+		    /*%%%*/
+			$$ = const_decl(p, NEW_COLON3($2, &@$), &@$);
+		    /*% %*/
+		    /*% ripper: const_decl(p, top_const_field!($2)) %*/
 		    }
 		| backref
 		    {
@@ -1658,11 +1660,17 @@ lhs		: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1660
 		    }
 		| primary_value tCOLON2 tCONSTANT
 		    {
-			$$ = const_decl(p, const_path_field($1, $3, &@$), &@$);
+		    /*%%%*/
+			$$ = const_decl(p, NEW_COLON2($1, $3, &@$), &@$);
+		    /*% %*/
+		    /*% ripper: const_decl(p, const_path_field!($1, $3)) %*/
 		    }
 		| tCOLON3 tCONSTANT
 		    {
-			$$ = const_decl(p, top_const_field($2, &@$), &@$);
+		    /*%%%*/
+			$$ = const_decl(p, NEW_COLON3($2, &@$), &@$);
+		    /*% %*/
+		    /*% ripper: const_decl(p, top_const_field!($2)) %*/
 		    }
 		| backref
 		    {
@@ -1834,14 +1842,16 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1842
 		    {
 		    /*%%%*/
 			YYLTYPE loc = code_loc_gen(&@1, &@3);
+			$$ = new_const_op_assign(p, NEW_COLON2($1, $3, &loc), $4, $5, &@$);
 		    /*% %*/
-			$$ = const_path_field($1, $3, &loc);
-			$$ = new_const_op_assign(p, $$, $4, $5, &@$);
+		    /*% ripper: opassign!(const_path_field!($1, $3), $4, $5) %*/
 		    }
 		| tCOLON3 tCONSTANT tOP_ASGN arg_rhs
 		    {
-			$$ = top_const_field($2, &@$);
-			$$ = new_const_op_assign(p, $$, $3, $4, &@$);
+		    /*%%%*/
+			$$ = new_const_op_assign(p, NEW_COLON3($2, &@$), $3, $4, &@$);
+		    /*% %*/
+		    /*% ripper: opassign!(top_const_field!($2), $3, $4) %*/
 		    }
 		| backref tOP_ASGN arg_rhs
 		    {
@@ -10045,7 +10055,7 @@ new_command_qcall(struct parser_params* https://github.com/ruby/ruby/blob/trunk/parse.y#L10055
 }
 
 static VALUE
-const_decl(struct parser_params *p, VALUE path, const YYLTYPE *loc)
+const_decl(struct parser_params *p, VALUE path)
 {
     if (p->in_def) {
 	path = dispatch1(assign_error, path);

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

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