parse.y: Fix locations of array
* parse.y (make_array): Set locations of ary to include locations of start token (tLBRACK, tWORDS_BEG, ...) and end token (']', tSTRING_END, ...) of array. e.g. The locations of the NODE_ARRAY is fixed: ``` [1, 2, 3] ``` * Before ``` NODE_ARRAY (line: 1, code_range: (1,1)-(1,8)) ``` * After ``` NODE_ARRAY (line: 1, code_range: (1,0)-(1,9)) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
284e3ae137
commit
15c977803d
3
parse.y
3
parse.y
@ -551,9 +551,10 @@ static NODE *new_rescue_gen(struct parser_params *parser, NODE *b, NODE *res, NO
|
||||
static NODE *new_undef_gen(struct parser_params *parser, NODE *i, const YYLTYPE *location);
|
||||
#define new_undef(i, location) new_undef_gen(parser, i, location)
|
||||
|
||||
static NODE *nd_set_loc(NODE *nd, const YYLTYPE *location);
|
||||
static NODE *new_zarray_gen(struct parser_params *parser, const YYLTYPE *location);
|
||||
#define new_zarray(location) new_zarray_gen(parser, location)
|
||||
#define make_array(ary, location) ((ary) ? (ary) : new_zarray(location))
|
||||
#define make_array(ary, location) ((ary) ? (nd_set_loc(ary, location), ary) : new_zarray(location))
|
||||
|
||||
static NODE *new_ivar_gen(struct parser_params *parser, ID id, const YYLTYPE *location);
|
||||
#define new_ivar(id, location) new_ivar_gen(parser,id,location)
|
||||
|
Loading…
x
Reference in New Issue
Block a user