summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-06-14 10:02:02 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-06-14 10:02:02 +0900
commit70313ec01a674e15d301f2dabb368cd90c78fa40 (patch)
tree563d2d2ac813dd0c23923847deb2a0ce65e07cc2 /parse.y
parent32b18fe9d04e9c95ac0b8d5df258226867efc063 (diff)
parse.y: Fix the location of a target constant of OP_CDECL
``` p RubyVM::AbstractSyntaxTree.parse("::Foo += 1").children #=> before: [[], nil, (OP_CDECL@1:0-1:10 (COLON3@1:0-1:10 :Foo) :+ (LIT@1:9-1:10 1))] #=> after: [[], nil, (OP_CDECL@1:0-1:10 (COLON3@1:0-1:5 :Foo) :+ (LIT@1:9-1:10 1))] ```
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index e3337309350..0790641f449 100644
--- a/parse.y
+++ b/parse.y
@@ -2381,7 +2381,8 @@ arg : lhs '=' lex_ctxt arg_rhs
| tCOLON3 tCONSTANT tOP_ASGN lex_ctxt arg_rhs
{
/*%%%*/
- $$ = new_const_op_assign(p, NEW_COLON3($2, &@$), $3, $5, $4, &@$);
+ YYLTYPE loc = code_loc_gen(&@1, &@2);
+ $$ = new_const_op_assign(p, NEW_COLON3($2, &loc), $3, $5, $4, &@$);
/*% %*/
/*% ripper: opassign!(top_const_field!($2), $3, $5) %*/
}