diff options
| author | Benoit Daloze <eregontp@gmail.com> | 2023-08-30 22:43:40 +0200 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-09-01 13:18:30 +0000 |
| commit | f1f6f1b39ebec35462efed9b20bfac4b6409133f (patch) | |
| tree | 6550bf054ba070b31bb05177a4418158cac46597 | |
| parent | 4172036bc6ba77aded874f67b15d657bd7ee3241 (diff) | |
[ruby/yarp] Make operator_loc the last field for GlobalVariableWriteNode
* Consistent with ClassVariableWriteNode, ConstantWriteNode, InstanceVariableWriteNode, LocalVariableWriteNode.
* Fixes desugaring of global variable with operators.
https://github.com/ruby/yarp/commit/fb5a53fc0b
| -rw-r--r-- | test/yarp/errors_test.rb | 4 | ||||
| -rw-r--r-- | test/yarp/snapshots/seattlerb/bug202.txt | 2 | ||||
| -rw-r--r-- | test/yarp/snapshots/unparser/corpus/literal/assignment.txt | 2 | ||||
| -rw-r--r-- | test/yarp/snapshots/variables.txt | 8 | ||||
| -rw-r--r-- | test/yarp/snapshots/whitequark/gvasgn.txt | 2 | ||||
| -rw-r--r-- | yarp/config.yml | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb index 9e60f5d98b..f29bd746c8 100644 --- a/test/yarp/errors_test.rb +++ b/test/yarp/errors_test.rb @@ -1003,8 +1003,8 @@ module YARP expected = BeginNode( Location(), StatementsNode([ - GlobalVariableWriteNode(Location(), Location(), NilNode()), - GlobalVariableWriteNode(Location(), Location(), NilNode()) + GlobalVariableWriteNode(Location(), NilNode(), Location()), + GlobalVariableWriteNode(Location(), NilNode(), Location()) ]), nil, nil, diff --git a/test/yarp/snapshots/seattlerb/bug202.txt b/test/yarp/snapshots/seattlerb/bug202.txt index 7bb548f798..64e666ef3f 100644 --- a/test/yarp/snapshots/seattlerb/bug202.txt +++ b/test/yarp/snapshots/seattlerb/bug202.txt @@ -1,7 +1,7 @@ ProgramNode(0...22)( [:测试], StatementsNode(0...22)( - [GlobalVariableWriteNode(0...11)((0...7), (8...9), IntegerNode(10...11)()), + [GlobalVariableWriteNode(0...11)((0...7), IntegerNode(10...11)(), (8...9)), LocalVariableWriteNode(12...22)( :测试, 0, diff --git a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt index 78ab4d3d78..6fb76babca 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt @@ -1,7 +1,7 @@ ProgramNode(0...704)( [:a, :b, :foo, :c, :x], StatementsNode(0...704)( - [GlobalVariableWriteNode(0...6)((0...2), (3...4), IntegerNode(5...6)()), + [GlobalVariableWriteNode(0...6)((0...2), IntegerNode(5...6)(), (3...4)), MultiWriteNode(7...24)( [GlobalVariableTargetNode(8...10)(), GlobalVariableTargetNode(12...14)()], diff --git a/test/yarp/snapshots/variables.txt b/test/yarp/snapshots/variables.txt index 419942d1eb..11f622ce9b 100644 --- a/test/yarp/snapshots/variables.txt +++ b/test/yarp/snapshots/variables.txt @@ -28,8 +28,8 @@ ProgramNode(0...293)( ), GlobalVariableWriteNode(50...58)( (50...54), - (55...56), - IntegerNode(57...58)() + IntegerNode(57...58)(), + (55...56) ), GlobalVariableReadNode(60...64)(), InstanceVariableReadNode(66...70)(:@abc), @@ -57,12 +57,12 @@ ProgramNode(0...293)( ), GlobalVariableWriteNode(110...121)( (110...114), - (115...116), ArrayNode(117...121)( [IntegerNode(117...118)(), IntegerNode(120...121)()], nil, nil - ) + ), + (115...116) ), MultiWriteNode(123...137)( [InstanceVariableTargetNode(123...127)(:@foo), diff --git a/test/yarp/snapshots/whitequark/gvasgn.txt b/test/yarp/snapshots/whitequark/gvasgn.txt index d6a5327590..c4030831e3 100644 --- a/test/yarp/snapshots/whitequark/gvasgn.txt +++ b/test/yarp/snapshots/whitequark/gvasgn.txt @@ -1,6 +1,6 @@ ProgramNode(0...9)( [], StatementsNode(0...9)( - [GlobalVariableWriteNode(0...9)((0...4), (5...6), IntegerNode(7...9)())] + [GlobalVariableWriteNode(0...9)((0...4), IntegerNode(7...9)(), (5...6))] ) ) diff --git a/yarp/config.yml b/yarp/config.yml index 8ebfb772bf..543a770dd1 100644 --- a/yarp/config.yml +++ b/yarp/config.yml @@ -1221,10 +1221,10 @@ nodes: fields: - name: name_loc type: location - - name: operator_loc - type: location - name: value type: node + - name: operator_loc + type: location comment: | Represents writing to a global variable. |
