mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y (parser_append_options): shorter alias LOC
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e47da4ddf3
commit
c0d22698e3
1 changed files with 14 additions and 11 deletions
25
parse.y
25
parse.y
|
@ -10575,27 +10575,30 @@ static NODE *
|
|||
parser_append_options(struct parser_params *p, NODE *node)
|
||||
{
|
||||
static const YYLTYPE default_location = {{1, 0}, {1, 0}};
|
||||
const YYLTYPE *const LOC = &default_location;
|
||||
|
||||
if (p->do_print) {
|
||||
node = block_append(p, node,
|
||||
NEW_FCALL(rb_intern("print"),
|
||||
NEW_ARRAY(NEW_GVAR(idLASTLINE, &default_location), &NULL_LOC), &default_location));
|
||||
NODE *print = NEW_FCALL(rb_intern("print"),
|
||||
NEW_ARRAY(NEW_GVAR(idLASTLINE, LOC), LOC),
|
||||
LOC);
|
||||
node = block_append(p, node, print);
|
||||
}
|
||||
|
||||
if (p->do_loop) {
|
||||
if (p->do_split) {
|
||||
node = block_append(p, NEW_GASGN(rb_intern("$F"),
|
||||
NEW_CALL(NEW_GVAR(idLASTLINE, &default_location),
|
||||
rb_intern("split"), 0, &default_location),
|
||||
&NULL_LOC),
|
||||
node);
|
||||
NODE *split = NEW_GASGN(rb_intern("$F"),
|
||||
NEW_CALL(NEW_GVAR(idLASTLINE, LOC),
|
||||
rb_intern("split"), 0, LOC),
|
||||
LOC);
|
||||
node = block_append(p, split, node);
|
||||
}
|
||||
if (p->do_chomp) {
|
||||
node = block_append(p, NEW_CALL(NEW_GVAR(idLASTLINE, &default_location),
|
||||
rb_intern("chomp!"), 0, &default_location), node);
|
||||
NODE *chomp = NEW_CALL(NEW_GVAR(idLASTLINE, LOC),
|
||||
rb_intern("chomp!"), 0, LOC);
|
||||
node = block_append(p, chomp, node);
|
||||
}
|
||||
|
||||
node = NEW_WHILE(NEW_VCALL(idGets, &NULL_LOC), node, 1, &NULL_LOC);
|
||||
node = NEW_WHILE(NEW_VCALL(idGets, LOC), node, 1, LOC);
|
||||
}
|
||||
|
||||
return node;
|
||||
|
|
Loading…
Reference in a new issue