1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: Set a location of NODE_NIL in not()

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yui-knk 2017-12-03 06:53:18 +00:00
parent 61997a2168
commit 1b055cffbc

15
parse.y
View file

@ -389,7 +389,8 @@ set_line_body(NODE *body, int line)
static NODE *cond_gen(struct parser_params*,NODE*,int,const YYLTYPE*);
#define cond(node,location) cond_gen(parser, (node), FALSE, location)
#define method_cond(node,location) cond_gen(parser, (node), TRUE, location)
#define new_nil() NEW_NIL()
static NODE *new_nil_gen(struct parser_params*,const YYLTYPE*);
#define new_nil(location) new_nil_gen(parser,location)
static NODE *new_if_gen(struct parser_params*,NODE*,NODE*,NODE*,const YYLTYPE*);
#define new_if(cc,left,right,location) new_if_gen(parser, (cc), (left), (right), (location))
static NODE *new_unless_gen(struct parser_params*,NODE*,NODE*,NODE*,const YYLTYPE*);
@ -641,7 +642,7 @@ static VALUE new_qcall_gen(struct parser_params *parser, VALUE q, VALUE r, VALUE
#define new_command_call(q,r,m,a) dispatch4(command_call, (r), (q), (m), (a))
#define new_command(m,a) dispatch2(command, (m), (a));
#define new_nil() Qnil
#define new_nil(location) Qnil
static VALUE new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs);
#define new_op_assign(lhs, op, rhs, location) new_op_assign_gen(parser, (lhs), (op), (rhs))
static VALUE new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE type, VALUE attr, VALUE op, VALUE rhs);
@ -2786,7 +2787,7 @@ primary : literal
}
| keyword_not '(' rparen
{
$$ = call_uni_op(method_cond(new_nil(), &@2), METHOD_NOT, &@$);
$$ = call_uni_op(method_cond(new_nil(&@2), &@2), METHOD_NOT, &@$);
}
| fcall brace_block
{
@ -10551,6 +10552,14 @@ cond_gen(struct parser_params *parser, NODE *node, int method_op, const YYLTYPE
return cond0(parser, node, method_op, location);
}
static NODE*
new_nil_gen(struct parser_params *parser, const YYLTYPE *location)
{
NODE *node_nil = NEW_NIL();
node_nil->nd_loc = *location;
return node_nil;
}
static NODE*
new_if_gen(struct parser_params *parser, NODE *cc, NODE *left, NODE *right, const YYLTYPE *location)
{