mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: Fix locations of NODEs related to for statement
* parse.y: Fix to only include a range of for_var. e.g. The locations of the NODE_ARGS and NODE_DVAR are fixed: ``` for a in m do n end ``` * Before ``` NODE_ARGS (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 19) NODE_DVAR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 19) ``` * After ``` NODE_ARGS (line: 1, first_lineno: 1, first_column: 4, last_lineno: 1, last_column: 5) NODE_DVAR (line: 1, first_lineno: 1, first_column: 4, last_lineno: 1, last_column: 5) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
857827e3ee
commit
5bf3657b9f
1 changed files with 7 additions and 7 deletions
14
parse.y
14
parse.y
|
@ -2909,22 +2909,22 @@ primary : literal
|
|||
|
||||
switch (nd_type($2)) {
|
||||
case NODE_MASGN:
|
||||
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, &@$));
|
||||
m->nd_next = node_assign($2, new_for(new_dvar(id, &@2), 0, 0, &@2), &@2);
|
||||
args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0, &@2));
|
||||
break;
|
||||
case NODE_LASGN:
|
||||
case NODE_DASGN:
|
||||
case NODE_DASGN_CURR:
|
||||
$2->nd_value = new_dvar(id, &@$);
|
||||
$2->nd_value = new_dvar(id, &@2);
|
||||
m->nd_plen = 1;
|
||||
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, &@2));
|
||||
break;
|
||||
default:
|
||||
{
|
||||
NODE *masgn = new_masgn(new_list($2, &@$), 0, &@$);
|
||||
m->nd_next = node_assign(masgn, new_dvar(id, &@$), &@$);
|
||||
args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0, &@$));
|
||||
NODE *masgn = new_masgn(new_list($2, &@2), 0, &@2);
|
||||
m->nd_next = node_assign(masgn, new_dvar(id, &@2), &@2);
|
||||
args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0, &@2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue