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

ruby-changes:49109

From: mame <ko1@a...>
Date: Thu, 14 Dec 2017 15:02:34 +0900 (JST)
Subject: [ruby-changes:49109] mame:r61224 (trunk): node.[ch], parse.y, compile.c: rename nd_column to nd_first_column

mame	2017-12-14 15:02:26 +0900 (Thu, 14 Dec 2017)

  New Revision: 61224

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

  Log:
    node.[ch], parse.y, compile.c: rename nd_column to nd_first_column
    
    nd_set_column -> nd_first_set_column
    nd_lineno -> nd_first_lineno
    nd_set_lineno -> nd_first_set_lineno

  Modified files:
    trunk/compile.c
    trunk/node.c
    trunk/node.h
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61223)
+++ parse.y	(revision 61224)
@@ -8955,8 +8955,8 @@ node_newnode(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8955
 
     nd_set_line(n, ruby_sourceline);
     /* mark not cared lineno to 0 and column to -1 */
-    nd_set_lineno(n,  0);
-    nd_set_column(n, -1);
+    nd_set_first_lineno(n,  0);
+    nd_set_first_column(n, -1);
     nd_set_last_lineno(n,  0);
     nd_set_last_column(n, -1);
     return n;
@@ -10798,8 +10798,8 @@ arg_blk_pass(NODE *node1, NODE *node2) https://github.com/ruby/ruby/blob/trunk/parse.y#L10798
 {
     if (node2) {
 	node2->nd_head = node1;
-	nd_set_lineno(node2, nd_lineno(node1));
-	nd_set_column(node2, nd_column(node1));
+	nd_set_first_lineno(node2, nd_first_lineno(node1));
+	nd_set_first_column(node2, nd_first_column(node1));
 	return node2;
     }
     return node1;
Index: node.c
===================================================================
--- node.c	(revision 61223)
+++ node.c	(revision 61224)
@@ -24,7 +24,7 @@ https://github.com/ruby/ruby/blob/trunk/node.c#L24
 #define A_LIT(lit) AR(rb_inspect(lit))
 #define A_NODE_HEADER(node, term) \
     rb_str_catf(buf, "@ %s (line: %d, code_range: (%d,%d)-(%d,%d))"term, \
-	ruby_node_name(nd_type(node)), nd_line(node), nd_lineno(node), nd_column(node), nd_last_lineno(node), nd_last_column(node))
+	ruby_node_name(nd_type(node)), nd_line(node), nd_first_lineno(node), nd_first_column(node), nd_last_lineno(node), nd_last_column(node))
 #define A_FIELD_HEADER(len, name, term) \
     rb_str_catf(buf, "+- %.*s:"term, (len), (name))
 #define D_FIELD_HEADER(len, name, term) (A_INDENT, A_FIELD_HEADER(len, name, term))
Index: node.h
===================================================================
--- node.h	(revision 61223)
+++ node.h	(revision 61224)
@@ -281,10 +281,10 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L281
 #define nd_set_line(n,l) \
     (n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
 
-#define nd_column(n) ((int)((n)->nd_loc.first_loc.column))
-#define nd_set_column(n, v) ((n)->nd_loc.first_loc.column = (v))
-#define nd_lineno(n) ((int)((n)->nd_loc.first_loc.lineno))
-#define nd_set_lineno(n, v) ((n)->nd_loc.first_loc.lineno = (v))
+#define nd_first_column(n) ((int)((n)->nd_loc.first_loc.column))
+#define nd_set_first_column(n, v) ((n)->nd_loc.first_loc.column = (v))
+#define nd_first_lineno(n) ((int)((n)->nd_loc.first_loc.lineno))
+#define nd_set_first_lineno(n, v) ((n)->nd_loc.first_loc.lineno = (v))
 
 #define nd_last_column(n) ((int)((n)->nd_loc.last_loc.column))
 #define nd_set_last_column(n, v) ((n)->nd_loc.last_loc.column = (v))
Index: compile.c
===================================================================
--- compile.c	(revision 61223)
+++ compile.c	(revision 61224)
@@ -4512,8 +4512,8 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR https://github.com/ruby/ruby/blob/trunk/compile.c#L4512
     const NODE *const node_else = type == NODE_IF ? node->nd_else : node->nd_body;
 
     const int line = nd_line(node);
-    const int lineno = nd_lineno(node);
-    const int column = nd_column(node);
+    const int lineno = nd_first_lineno(node);
+    const int column = nd_first_column(node);
     const int last_lineno = nd_last_lineno(node);
     const int last_column = nd_last_column(node);
     DECL_ANCHOR(cond_seq);
@@ -4545,8 +4545,8 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR https://github.com/ruby/ruby/blob/trunk/compile.c#L4545
 	if (else_label->refcnt) {
 	    ADD_TRACE_BRANCH_COVERAGE(
 		ret,
-		node_body ? nd_lineno(node_body) : lineno,
-		node_body ? nd_column(node_body) : column,
+		node_body ? nd_first_lineno(node_body) : lineno,
+		node_body ? nd_first_column(node_body) : column,
 		node_body ? nd_last_lineno(node_body) : last_lineno,
 		node_body ? nd_last_column(node_body) : last_column,
 		type == NODE_IF ? "then" : "else",
@@ -4562,8 +4562,8 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR https://github.com/ruby/ruby/blob/trunk/compile.c#L4562
 	if (then_label->refcnt) {
 	    ADD_TRACE_BRANCH_COVERAGE(
 		ret,
-		node_else ? nd_lineno(node_else) : lineno,
-		node_else ? nd_column(node_else) : column,
+		node_else ? nd_first_lineno(node_else) : lineno,
+		node_else ? nd_first_column(node_else) : column,
 		node_else ? nd_last_lineno(node_else) : last_lineno,
 		node_else ? nd_last_column(node_else) : last_column,
 		type == NODE_IF ? "else" : "then",
@@ -4602,13 +4602,13 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4602
 
     CHECK(COMPILE(head, "case base", node->nd_head));
 
-    DECL_BRANCH_BASE(branches, nd_lineno(node), nd_column(node), nd_last_lineno(node), nd_last_column(node), "case");
+    DECL_BRANCH_BASE(branches, nd_first_lineno(node), nd_first_column(node), nd_last_lineno(node), nd_last_column(node), "case");
 
     node = node->nd_body;
     type = nd_type(node);
     line = nd_line(node);
-    lineno = nd_lineno(node);
-    column = nd_column(node);
+    lineno = nd_first_lineno(node);
+    column = nd_first_column(node);
     last_lineno = nd_last_lineno(node);
     last_column = nd_last_column(node);
 
@@ -4630,8 +4630,8 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4630
 	ADD_INSN(body_seq, line, pop);
 	ADD_TRACE_BRANCH_COVERAGE(
 		body_seq,
-		node->nd_body ? nd_lineno(node->nd_body) : lineno,
-		node->nd_body ? nd_column(node->nd_body) : column,
+		node->nd_body ? nd_first_lineno(node->nd_body) : lineno,
+		node->nd_body ? nd_first_column(node->nd_body) : column,
 		node->nd_body ? nd_last_lineno(node->nd_body) : last_lineno,
 		node->nd_body ? nd_last_column(node->nd_body) : last_column,
 		"when",
@@ -4668,8 +4668,8 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4668
 	}
 	type = nd_type(node);
 	line = nd_line(node);
-	lineno = nd_lineno(node);
-	column = nd_column(node);
+	lineno = nd_first_lineno(node);
+	column = nd_first_column(node);
 	last_lineno = nd_last_lineno(node);
 	last_column = nd_last_column(node);
     }
@@ -4677,7 +4677,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4677
     if (node) {
 	ADD_LABEL(cond_seq, elselabel);
 	ADD_INSN(cond_seq, line, pop);
-	ADD_TRACE_BRANCH_COVERAGE(cond_seq, nd_lineno(node), nd_column(node), nd_last_lineno(node), nd_last_column(node), "else", branches);
+	ADD_TRACE_BRANCH_COVERAGE(cond_seq, nd_first_lineno(node), nd_first_column(node), nd_last_lineno(node), nd_last_column(node), "else", branches);
 	CHECK(COMPILE_(cond_seq, "else", node, popped));
 	ADD_INSNL(cond_seq, line, jump, endlabel);
     }
@@ -4685,7 +4685,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4685
 	debugs("== else (implicit)\n");
 	ADD_LABEL(cond_seq, elselabel);
 	ADD_INSN(cond_seq, nd_line(orig_node), pop);
-	ADD_TRACE_BRANCH_COVERAGE(cond_seq, nd_lineno(orig_node), nd_column(orig_node), nd_last_lineno(orig_node), nd_last_column(orig_node), "else", branches);
+	ADD_TRACE_BRANCH_COVERAGE(cond_seq, nd_first_lineno(orig_node), nd_first_column(orig_node), nd_last_lineno(orig_node), nd_last_column(orig_node), "else", branches);
 	if (!popped) {
 	    ADD_INSN(cond_seq, nd_line(orig_node), putnil);
 	}
@@ -4716,23 +4716,23 @@ compile_case2(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L4716
     DECL_ANCHOR(body_seq);
     VALUE branches = 0;
 
-    DECL_BRANCH_BASE(branches, nd_lineno(orig_node), nd_column(orig_node), nd_last_lineno(orig_node), nd_last_column(orig_node), "case");
+    DECL_BRANCH_BASE(branches, nd_first_lineno(orig_node), nd_first_column(orig_node), nd_last_lineno(orig_node), nd_last_column(orig_node), "case");
 
     INIT_ANCHOR(body_seq);
     endlabel = NEW_LABEL(nd_line(node));
 
     while (node && nd_type(node) == NODE_WHEN) {
 	const int line = nd_line(node);
-	const int lineno = nd_lineno(node);
-	const int column = nd_column(node);
+	const int lineno = nd_first_lineno(node);
+	const int column = nd_first_column(node);
 	const int last_lineno = nd_last_lineno(node);
 	const int last_column = nd_last_column(node);
 	LABEL *l1 = NEW_LABEL(line);
 	ADD_LABEL(body_seq, l1);
 	ADD_TRACE_BRANCH_COVERAGE(
 		body_seq,
-		node->nd_body ? nd_lineno(node->nd_body) : lineno,
-		node->nd_body ? nd_column(node->nd_body) : column,
+		node->nd_body ? nd_first_lineno(node->nd_body) : lineno,
+		node->nd_body ? nd_first_column(node->nd_body) : column,
 		node->nd_body ? nd_last_lineno(node->nd_body) : last_lineno,
 		node->nd_body ? nd_last_column(node->nd_body) : last_column,
 		"when",
@@ -4770,8 +4770,8 @@ compile_case2(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L4770
     /* else */
     ADD_TRACE_BRANCH_COVERAGE(
 	ret,
-	node ? nd_lineno(node) : nd_lineno(orig_node),
-	node ? nd_column(node) : nd_column(orig_node),
+	node ? nd_first_lineno(node) : nd_first_lineno(orig_node),
+	node ? nd_first_column(node) : nd_first_column(orig_node),
 	node ? nd_last_lineno(node) : nd_last_lineno(orig_node),
 	node ? nd_last_column(node) : nd_last_column(orig_node),
 	"else",
@@ -4788,8 +4788,8 @@ static int https://github.com/ruby/ruby/blob/trunk/compile.c#L4788
 compile_loop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped, const enum node_type type)
 {
     const int line = (int)nd_line(node);
-    const int lineno = nd_lineno(node);
-    const int column = nd_column(node);
+    const int lineno = nd_first_lineno(node);
+    const int column = nd_first_column(node);
     const int last_lineno = nd_last_lineno(node);
     const int last_column = nd_last_column(node);
     LABEL *prev_start_label = ISEQ_COMPILE_DATA(iseq)->start_label;
@@ -4830,8 +4830,8 @@ compile_loop(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4830
     DECL_BRANCH_BASE(branches, lineno, column, last_lineno, last_column, type == NODE_WHILE ? "while" : "until");
     ADD_TRACE_BRANCH_COVERAGE(
 	ret,
-	node->nd_body ? nd_lineno(node->nd_body) : lineno,
-	node->nd_body ? nd_column(node->nd_body) : column,
+	node->nd_body ? nd_first_lineno(node->nd_body) : lineno,
+	node->nd_body ? nd_first_column(node->nd_body) : column,
 	node->nd_body ? nd_last_lineno(node->nd_body) : last_lineno,
 	node->nd_body ? nd_last_column(node->nd_body) : last_column,
 	"body",
@@ -6080,10 +6080,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L6080
 		else_label = NEW_LABEL(line);
 		end_label = NEW_LABEL(line);
 
-		DECL_BRANCH_BASE(branches, nd_lineno(node), nd_column(node), nd_last_lineno(node), nd_last_column(node), "&.");
+		DECL_BRANCH_BASE(branches, nd_first_lineno(node), nd_first_column(node), nd_last_lineno(node), nd_last_column(node), "&.");
 		ADD_INSN(recv, line, dup);
 		ADD_INSNL(recv, line, branchnil, else_label);
-		ADD_TRACE_BRANCH_COVERAGE(recv, nd_lineno(node), nd_column(node), nd_last_lineno(node), nd_last_column(node), "then", branches);
+		ADD_TRACE_BRANCH_COVERAGE(recv, nd_first_lineno(node), nd_first_column(node), nd_last_lineno(node), nd_last_column(node), "then", branches);
 	    }
 	}
 	else if (type == NODE_FCALL || type == NODE_VCALL) {
@@ -6118,7 +6118,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L6118
 	if (else_label && end_label) {
 	    ADD_INSNL(ret, line, jump, end_label);
 	    ADD_LABEL(ret, else_label);
-	    ADD_TRACE_BRANCH_COVERAGE(ret, nd_lineno(node), nd_column(node), nd_last_lineno(node), nd_last_column(node), "else", branches);
+	    ADD_TRACE_BRANCH_COVERAGE(ret, nd_first_lineno(node), nd_first_column(node), nd_last_lineno(node), nd_last_column(node), "else", branches);
 	    ADD_LABEL(ret, end_label);
 	}
 	if (popped) {

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

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