parse.y: simplified

* parse.y (primary): turned nested if-else blocks into a switch
  statement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-04-29 03:49:05 +00:00
parent 810522e0ff
commit 9efec44c07

30
parse.y
View File

@ -2908,23 +2908,23 @@ primary : literal
NODE *m = NEW_ARGS_AUX(0, 0); NODE *m = NEW_ARGS_AUX(0, 0);
NODE *args, *scope; NODE *args, *scope;
if (nd_type($2) == NODE_MASGN) { switch (nd_type($2)) {
case NODE_MASGN:
m->nd_next = node_assign($2, NEW_FOR(NEW_DVAR(id), 0, 0)); m->nd_next = node_assign($2, NEW_FOR(NEW_DVAR(id), 0, 0));
args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0)); args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
} break;
else { case NODE_LASGN:
if (nd_type($2) == NODE_LASGN || case NODE_DASGN:
nd_type($2) == NODE_DASGN || case NODE_DASGN_CURR:
nd_type($2) == NODE_DASGN_CURR) { $2->nd_value = NEW_DVAR(id);
$2->nd_value = NEW_DVAR(id); m->nd_plen = 1;
m->nd_plen = 1; m->nd_next = $2;
m->nd_next = $2; args = new_args(m, 0, 0, 0, new_args_tail(0, 0, 0));
args = new_args(m, 0, 0, 0, new_args_tail(0, 0, 0)); break;
} default:
else { m->nd_next = node_assign(NEW_MASGN(NEW_LIST($2), 0), NEW_DVAR(id));
m->nd_next = node_assign(NEW_MASGN(NEW_LIST($2), 0), NEW_DVAR(id)); args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0));
args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0)); break;
}
} }
scope = NEW_NODE(NODE_SCOPE, tbl, $8, args); scope = NEW_NODE(NODE_SCOPE, tbl, $8, args);
tbl[0] = 1; tbl[1] = id; tbl[0] = 1; tbl[1] = id;