mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
node.h: add nd_last_loc and nd_set_last_loc
Just refactoring. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9178645dbc
commit
4abc1a24af
2 changed files with 8 additions and 12 deletions
2
node.h
2
node.h
|
@ -290,6 +290,8 @@ typedef struct RNode {
|
||||||
#define nd_set_last_column(n, v) ((n)->nd_loc.last_loc.column = (v))
|
#define nd_set_last_column(n, v) ((n)->nd_loc.last_loc.column = (v))
|
||||||
#define nd_last_lineno(n) ((int)((n)->nd_loc.last_loc.lineno))
|
#define nd_last_lineno(n) ((int)((n)->nd_loc.last_loc.lineno))
|
||||||
#define nd_set_last_lineno(n, v) ((n)->nd_loc.last_loc.lineno = (v))
|
#define nd_set_last_lineno(n, v) ((n)->nd_loc.last_loc.lineno = (v))
|
||||||
|
#define nd_last_loc(n) ((n)->nd_loc.last_loc)
|
||||||
|
#define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
|
||||||
|
|
||||||
#define nd_head u1.node
|
#define nd_head u1.node
|
||||||
#define nd_alen u2.argc
|
#define nd_alen u2.argc
|
||||||
|
|
18
parse.y
18
parse.y
|
@ -1673,8 +1673,7 @@ command : fcall command_args %prec tLOWEST
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->nd_args = $2;
|
$$->nd_args = $2;
|
||||||
nd_set_last_lineno($1, nd_last_lineno($2));
|
nd_set_last_loc($1, nd_last_loc($2));
|
||||||
nd_set_last_column($1, nd_last_column($2));
|
|
||||||
/*%
|
/*%
|
||||||
$$ = dispatch2(command, $1, $2);
|
$$ = dispatch2(command, $1, $2);
|
||||||
%*/
|
%*/
|
||||||
|
@ -1687,8 +1686,7 @@ command : fcall command_args %prec tLOWEST
|
||||||
fixpos($$, $1);
|
fixpos($$, $1);
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$->nd_loc = @$;
|
$$->nd_loc = @$;
|
||||||
nd_set_last_lineno($1, nd_last_lineno($2));
|
nd_set_last_loc($1, nd_last_loc($2));
|
||||||
nd_set_last_column($1, nd_last_column($2));
|
|
||||||
/*%
|
/*%
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
|
@ -3720,8 +3718,7 @@ method_call : fcall paren_args
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->nd_args = $2;
|
$$->nd_args = $2;
|
||||||
nd_set_last_lineno($1, @2.last_loc.lineno);
|
nd_set_last_loc($1, @2.last_loc);
|
||||||
nd_set_last_column($1, @2.last_loc.column);
|
|
||||||
/*%
|
/*%
|
||||||
$$ = method_arg(dispatch1(fcall, $1), $2);
|
$$ = method_arg(dispatch1(fcall, $1), $2);
|
||||||
%*/
|
%*/
|
||||||
|
@ -9066,8 +9063,7 @@ block_append_gen(struct parser_params *parser, NODE *head, NODE *tail, const YYL
|
||||||
}
|
}
|
||||||
end->nd_next = tail;
|
end->nd_next = tail;
|
||||||
h->nd_end = tail->nd_end;
|
h->nd_end = tail->nd_end;
|
||||||
nd_set_last_lineno(head, nd_last_lineno(tail));
|
nd_set_last_loc(head, nd_last_loc(tail));
|
||||||
nd_set_last_column(head, nd_last_column(tail));
|
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9089,8 +9085,7 @@ list_append_gen(struct parser_params *parser, NODE *list, NODE *item)
|
||||||
last->nd_next = new_list(item, &item->nd_loc);
|
last->nd_next = new_list(item, &item->nd_loc);
|
||||||
list->nd_next->nd_end = last->nd_next;
|
list->nd_next->nd_end = last->nd_next;
|
||||||
|
|
||||||
nd_set_last_lineno(list, nd_last_lineno(item));
|
nd_set_last_loc(list, nd_last_loc(item));
|
||||||
nd_set_last_column(list, nd_last_column(item));
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -9117,8 +9112,7 @@ list_concat(NODE *head, NODE *tail)
|
||||||
head->nd_next->nd_end = tail;
|
head->nd_next->nd_end = tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
nd_set_last_lineno(head, nd_last_lineno(tail));
|
nd_set_last_loc(head, nd_last_loc(tail));
|
||||||
nd_set_last_column(head, nd_last_column(tail));
|
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue