ruby-changes:66468
From: Yusuke <ko1@a...>
Date: Mon, 14 Jun 2021 10:09:39 +0900 (JST)
Subject: [ruby-changes:66468] 70313ec01a (master): parse.y: Fix the location of a target constant of OP_CDECL
https://git.ruby-lang.org/ruby.git/commit/?id=70313ec01a From 70313ec01a674e15d301f2dabb368cd90c78fa40 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Mon, 14 Jun 2021 10:02:02 +0900 Subject: 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))] ``` --- parse.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parse.y b/parse.y index e333730..0790641 100644 --- a/parse.y +++ b/parse.y @@ -2381,7 +2381,8 @@ arg : lhs '=' lex_ctxt arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L2381 | 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) %*/ } -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/