node.c: compress logop sequence
* node.c (dump_node): compress sequence of same logical binary operators, NODE_AND/NODE_OR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
026ded9384
commit
d1b386a224
9
node.c
9
node.c
@ -158,6 +158,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
|
|||||||
int field_flag;
|
int field_flag;
|
||||||
int i;
|
int i;
|
||||||
const char *next_indent = default_indent;
|
const char *next_indent = default_indent;
|
||||||
|
enum node_type type;
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
D_NULL_NODE;
|
D_NULL_NODE;
|
||||||
@ -166,7 +167,8 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
|
|||||||
|
|
||||||
D_NODE_HEADER(node);
|
D_NODE_HEADER(node);
|
||||||
|
|
||||||
switch (nd_type(node)) {
|
type = nd_type(node);
|
||||||
|
switch (type) {
|
||||||
case NODE_BLOCK:
|
case NODE_BLOCK:
|
||||||
ANN("statement sequence");
|
ANN("statement sequence");
|
||||||
ANN("format: [nd_head]; ...; [nd_next]");
|
ANN("format: [nd_head]; ...; [nd_next]");
|
||||||
@ -334,7 +336,12 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
|
|||||||
ANN("format: [nd_1st] || [nd_2nd]");
|
ANN("format: [nd_1st] || [nd_2nd]");
|
||||||
ANN("example: foo || bar");
|
ANN("example: foo || bar");
|
||||||
andor:
|
andor:
|
||||||
|
while (1) {
|
||||||
F_NODE(nd_1st, "left expr");
|
F_NODE(nd_1st, "left expr");
|
||||||
|
if (!node->nd_2nd || nd_type(node->nd_2nd) != type)
|
||||||
|
break;
|
||||||
|
node = node->nd_2nd;
|
||||||
|
}
|
||||||
LAST_NODE;
|
LAST_NODE;
|
||||||
F_NODE(nd_2nd, "right expr");
|
F_NODE(nd_2nd, "right expr");
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user