Repository: ruby/yarp
Pull request #1369 (2023-08-30 20:58:43)

Desugaring fixes
Some nodes were incorrectly desugared, with some location field and the value nodes being swapped.
This is fixed by making the ordering consistent in this PR.
If that's not desired, an alternative would be to provide lambdas to helpers like `desugar_or_write_node` to get the correct order (that can also be done in addition to making the order consistent).


Patch:
diff --git a/bin/parse b/bin/parse
index cd6e84c3..c03689ef 100755
--- a/bin/parse
+++ b/bin/parse
@@ -16,4 +16,5 @@ else
 end
 
 result.mark_newlines if ENV['MARK_NEWLINES']
+result = result.value.accept(YARP::DesugarVisitor.new) if ENV['DESUGAR']
 pp result
diff --git a/config.yml b/config.yml
index 8ebfb772..1bad27e8 100644
--- a/config.yml
+++ b/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.
 
@@ -1595,10 +1595,10 @@ nodes:
         type: constant
       - name: depth
         type: uint32
-      - name: value
-        type: node
       - name: name_loc
         type: location
+      - name: value
+        type: node
       - name: operator_loc
         type: location
     comment: |
@@ -1703,9 +1703,6 @@ nodes:
                 ^^^^^
           end
   - name: NumberedReferenceReadNode
-    fields:
-      - name: number
-        type: uint32
     comment: |
       Represents reading a numbered reference to a capture in the previous match.
 
diff --git a/include/yarp.h b/include/yarp.h
index 378efe0c..6488d01a 100644
--- a/include/yarp.h
+++ b/include/yarp.h
@@ -16,7 +16,6 @@
 #include "yarp/version.h"
 
 #include <assert.h>
-#include <errno.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdint.h>
diff --git a/lib/yarp/desugar_visitor.rb b/lib/yarp/desugar_visitor.rb
index d0c0494e..a988449d 100644
--- a/lib/yarp/desugar_visitor.rb
+++ b/lib/yarp/desugar_visitor.rb
@@ -42,7 +42,7 @@ module YARP
     #
     # becomes
     #
-    # Foo || Foo = bar
+    # defined?(Foo) ? Foo : Foo = bar
     def visit_constant_or_write_node(node)
       desugar_or_write_defined_node(node, ConstantReadNode, ConstantWriteNode)
     end
@@ -56,69 +56,6 @@ module YARP
       desugar_operator_write_node(node, ConstantReadNode, ConstantWriteNode)
     end
 
-    # Foo::Bar &&= baz
-    #
-    # becomes
-    #
-    # Foo::Bar && Foo::Bar = baz
-    def visit_constant_path_and_write_node(node)
-      AndNode.new(
-        node.target,
-        ConstantPathWriteNode.new(node.target, node.value, node.operator_loc, node.location),
-        node.operator_loc,
-        node.location
-      )
-    end
-
-    # Foo::Bar ||= baz
-    #
-    # becomes
-    #
-    # Foo::Bar || Foo::Bar = baz
-    def visit_constant_path_or_write_node(node)
-      IfNode.new(
-        node.operator_loc,
-        DefinedNode.new(nil, node.target, nil, node.operator_loc, node.target.location),
-        StatementsNode.new([node.target], node.location),
-        ElseNode.new(
-          node.operator_loc,
-          StatementsNode.new(
-            [ConstantPathWriteNode.new(node.target, node.value, node.operator_loc, node.location)],
-            node.location
-          ),
-          node.operator_loc,
-          node.location
-        ),
-        node.operator_loc,
-        node.location
-      )
-    end
-
-    # Foo::Bar += baz
-    #
-    # becomes
-    #
-    # Foo::Bar = Foo::Bar + baz
-    def visit_constant_path_operator_write_node(node)
-      ConstantPathWriteNode.new(
-        node.target,
-        CallNode.new(
-          node.target,
-          nil,
-          node.operator_loc.copy(length: node.operator_loc.length - 1),
-          nil,
-          ArgumentsNode.new([node.value], node.value.location),
-          nil,
-          nil,
-          0,
-          node.operator_loc.slice.chomp("="),
-          node.location
-        ),
-        node.operator_loc.copy(start_offset: node.operator_loc.end_offset - 1, length: 1),
-        node.location
-      )
-    end
-
     # $foo &&= bar
     #
     # becomes
@@ -132,7 +69,7 @@ module YARP
     #
     # becomes
     #
-    # $foo || $foo = bar
+    # defined?($foo) ? $foo : $foo = bar
     def visit_global_variable_or_write_node(node)
       desugar_or_write_defined_node(node, GlobalVariableReadNode, GlobalVariableWriteNode)
     end
@@ -244,7 +181,7 @@ module YARP
       )
     end
 
-    # Don't desugar `x ||= y` to `defined?(x) ? x : x = y`
+    # Desugar `x ||= y` to `defined?(x) ? x : x = y`
     def desugar_or_write_defined_node(node, read_class, write_class, arguments: [])
       IfNode.new(
         node.operator_loc,
diff --git a/rust/yarp/build.rs b/rust/yarp/build.rs
index a623926f..df90a06f 100644
--- a/rust/yarp/build.rs
+++ b/rust/yarp/build.rs
@@ -246,8 +246,7 @@ fn write_node(file: &mut File, node: &Node) -> Result<(), Box<dyn std::error::Er
             NodeFieldType::OptionalLocation => {
                 writeln!(file, "    pub fn {}(&self) -> Option<Location<'pr>> {{", field.name)?;
                 writeln!(file, "        let pointer: *mut yp_location_t = unsafe {{ &mut (*self.pointer).{} }};", field.name)?;
-                writeln!(file, "        let start = unsafe {{ (*pointer).start }};")?;
-                writeln!(file, "        if start.is_null() {{")?;
+                writeln!(file, "        if pointer.is_null() {{")?;
                 writeln!(file, "            None")?;
                 writeln!(file, "        }} else {{")?;
                 writeln!(file, "            Some(Location {{ pointer: unsafe {{ NonNull::new_unchecked(pointer) }}, marker: PhantomData }})")?;
diff --git a/rust/yarp/src/lib.rs b/rust/yarp/src/lib.rs
index 9c5809b0..25e06cc5 100644
--- a/rust/yarp/src/lib.rs
+++ b/rust/yarp/src/lib.rs
@@ -348,40 +348,4 @@ mod tests {
 
         assert_eq!(locals[0].as_slice(), b"x");
     }
-
-    #[test]
-    fn optional_loc_test() {
-        let source = r#"
-module Example
-  x = call_func(3, 4)
-  y = x.call_func 5, 6
-end
-"#;
-        let result = parse(source.as_ref());
-
-        let node = result.node();
-        let module = node.as_program_node().unwrap().statements().body().iter().next().unwrap();
-        let module = module.as_module_node().unwrap();
-        let body = module.body();
-        let writes = body.iter().next().unwrap().as_statements_node().unwrap().body().iter().collect::<Vec<_>>();
-        assert_eq!(writes.len(), 2);
-
-        let asgn = &writes[0];
-        let call = asgn.as_local_variable_write_node().unwrap().value();
-        let call = call.as_call_node().unwrap();
-
-        let operator_loc = call.operator_loc();
-        assert!(operator_loc.is_none());
-        let closing_loc = call.closing_loc();
-        assert!(closing_loc.is_some());
-
-        let asgn = &writes[1];
-        let call = asgn.as_local_variable_write_node().unwrap().value();
-        let call = call.as_call_node().unwrap();
-
-        let operator_loc = call.operator_loc();
-        assert!(operator_loc.is_some());
-        let closing_loc = call.closing_loc();
-        assert!(closing_loc.is_none());
-    }
 }
diff --git a/src/yarp.c b/src/yarp.c
index 7df7ca06..5381eabe 100644
--- a/src/yarp.c
+++ b/src/yarp.c
@@ -613,38 +613,6 @@ yp_scope_node_init(yp_node_t *node, yp_scope_node_t *scope) {
 /* Node creation functions                                                    */
 /******************************************************************************/
 
-// Parse the decimal number represented by the range of bytes. returns
-// UINT32_MAX if the number fails to parse. This function assumes that the range
-// of bytes has already been validated to contain only decimal digits.
-static uint32_t
-parse_decimal_number(yp_parser_t *parser, const uint8_t *start, const uint8_t *end) {
-    ptrdiff_t diff = end - start;
-    assert(diff > 0 && ((unsigned long) diff < SIZE_MAX));
-    size_t length = (size_t) diff;
-
-    char *digits = calloc(length + 1, sizeof(char));
-    memcpy(digits, start, length);
-    digits[length] = '\0';
-
-    char *endptr;
-    errno = 0;
-    unsigned long value = strtoul(digits, &endptr, 10);
-
-    if ((digits == endptr) || (*endptr != '\0') || (errno == ERANGE)) {
-        yp_diagnostic_list_append(&parser->error_list, start, end, "invalid decimal number");
-        value = UINT32_MAX;
-    }
-
-    free(digits);
-
-    if (value > UINT32_MAX) {
-        yp_diagnostic_list_append(&parser->error_list, start, end, "invalid decimal number");
-        value = UINT32_MAX;
-    }
-
-    return (uint32_t) value;
-}
-
 // Parse out the options for a regular expression.
 static inline yp_node_flags_t
 yp_regular_expression_flags_create(const yp_token_t *closing) {
@@ -3321,8 +3289,7 @@ yp_numbered_reference_read_node_create(yp_parser_t *parser, const yp_token_t *na
         {
             .type = YP_NODE_NUMBERED_REFERENCE_READ_NODE,
             .location = YP_LOCATION_TOKEN_VALUE(name),
-        },
-        .number = parse_decimal_number(parser, name->start + 1, name->end)
+        }
     };
 
     return node;


Test patch:
diff --git a/test/yarp/desugar_visitor_test.rb b/test/yarp/desugar_visitor_test.rb
index c03b02e6..3966d7bf 100644
--- a/test/yarp/desugar_visitor_test.rb
+++ b/test/yarp/desugar_visitor_test.rb
@@ -6,7 +6,7 @@ module YARP
   class DesugarVisitorTest < TestCase
     def test_and_write
       assert_desugars("(AndNode (ClassVariableReadNode) (ClassVariableWriteNode (CallNode)))", "@@foo &&= bar")
-      assert_desugars("(AndNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode)) (ConstantPathWriteNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode)) (CallNode)))", "Foo::Bar &&= baz")
+      assert_not_desugared("Foo::Bar &&= baz", "Desugaring would execute Foo twice or need temporary variables")
       assert_desugars("(AndNode (ConstantReadNode) (ConstantWriteNode (CallNode)))", "Foo &&= bar")
       assert_desugars("(AndNode (GlobalVariableReadNode) (GlobalVariableWriteNode (CallNode)))", "$foo &&= bar")
       assert_desugars("(AndNode (InstanceVariableReadNode) (InstanceVariableWriteNode (CallNode)))", "@foo &&= bar")
@@ -16,7 +16,7 @@ module YARP
 
     def test_or_write
       assert_desugars("(IfNode (DefinedNode (ClassVariableReadNode)) (StatementsNode (ClassVariableReadNode)) (ElseNode (StatementsNode (ClassVariableWriteNode (CallNode)))))", "@@foo ||= bar")
-      assert_desugars("(IfNode (DefinedNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode))) (StatementsNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode))) (ElseNode (StatementsNode (ConstantPathWriteNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode)) (CallNode)))))", "Foo::Bar ||= baz")
+      assert_not_desugared("Foo::Bar ||= baz", "Desugaring would execute Foo twice or need temporary variables")
       assert_desugars("(IfNode (DefinedNode (ConstantReadNode)) (StatementsNode (ConstantReadNode)) (ElseNode (StatementsNode (ConstantWriteNode (CallNode)))))", "Foo ||= bar")
       assert_desugars("(IfNode (DefinedNode (GlobalVariableReadNode)) (StatementsNode (GlobalVariableReadNode)) (ElseNode (StatementsNode (GlobalVariableWriteNode (CallNode)))))", "$foo ||= bar")
       assert_desugars("(OrNode (InstanceVariableReadNode) (InstanceVariableWriteNode (CallNode)))", "@foo ||= bar")
@@ -26,7 +26,7 @@ module YARP
 
     def test_operator_write
       assert_desugars("(ClassVariableWriteNode (CallNode (ClassVariableReadNode) (ArgumentsNode (CallNode))))", "@@foo += bar")
-      assert_desugars("(ConstantPathWriteNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode)) (CallNode (ConstantPathNode (ConstantReadNode) (ConstantReadNode)) (ArgumentsNode (CallNode))))", "Foo::Bar += baz")
+      assert_not_desugared("Foo::Bar += baz", "Desugaring would execute Foo twice or need temporary variables")
       assert_desugars("(ConstantWriteNode (CallNode (ConstantReadNode) (ArgumentsNode (CallNode))))", "Foo += bar")
       assert_desugars("(GlobalVariableWriteNode (CallNode (GlobalVariableReadNode) (ArgumentsNode (CallNode))))", "$foo += bar")
       assert_desugars("(InstanceVariableWriteNode (CallNode (InstanceVariableReadNode) (ArgumentsNode (CallNode))))", "@foo += bar")
@@ -51,9 +51,36 @@ module YARP
       "(#{parts.join(" ")})"
     end
 
+    # Ensure every node is only present once in the AST.
+    # If the same node is present twice it would most likely indicate it is executed twice, which is invalid semantically.
+    # This also acts as a sanity check that Node#child_nodes returns only nodes or nil (which caught a couple bugs).
+    class EnsureEveryNodeOnceInAST < Visitor
+      def initialize
+        @all_nodes = {}.compare_by_identity
+      end
+
+      def visit(node)
+        if node
+          if @all_nodes.include?(node)
+            raise "#{node.inspect} is present multiple times in the desugared AST and likely executed multiple times"
+          else
+            @all_nodes[node] = true
+          end
+        end
+        super(node)
+      end
+    end
+
     def assert_desugars(expected, source)
       ast = YARP.parse(source).value.accept(DesugarVisitor.new)
       assert_equal expected, ast_inspect(ast.statements.body.last)
+
+      ast.accept(EnsureEveryNodeOnceInAST.new)
+    end
+
+    def assert_not_desugared(source, reason)
+      ast = YARP.parse(source).value
+      assert_equal_nodes(ast, ast.accept(DesugarVisitor.new))
     end
   end
 end
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb
index 0e1931ec..ed7b42a0 100644
--- a/test/yarp/errors_test.rb
+++ b/test/yarp/errors_test.rb
@@ -513,16 +513,16 @@ module YARP
       expected = BeginNode(
         Location(),
         StatementsNode([
-          LocalVariableWriteNode(:_1, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_2, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_3, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_4, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_5, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_6, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_7, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_8, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_9, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location()),
-          LocalVariableWriteNode(:_10, 0, SymbolNode(Location(), Location(), nil, "a"), Location(), Location())
+          LocalVariableWriteNode(:_1, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_2, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_3, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_4, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_5, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_6, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_7, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_8, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_9, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location()),
+          LocalVariableWriteNode(:_10, 0, Location(), SymbolNode(Location(), Location(), nil, "a"), Location())
         ]),
         nil,
         nil,
@@ -996,8 +996,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/blocks.txt b/test/yarp/snapshots/blocks.txt
index 8f836208..4a2c3f75 100644
--- a/test/yarp/snapshots/blocks.txt
+++ b/test/yarp/snapshots/blocks.txt
@@ -453,8 +453,8 @@ ProgramNode(0...402)(
      LocalVariableWriteNode(292...300)(
        :fork,
        0,
-       IntegerNode(299...300)(),
        (292...296),
+       IntegerNode(299...300)(),
        (297...298)
      ),
      CallNode(301...316)(
diff --git a/test/yarp/snapshots/classes.txt b/test/yarp/snapshots/classes.txt
index 33b3d042..1d8813f4 100644
--- a/test/yarp/snapshots/classes.txt
+++ b/test/yarp/snapshots/classes.txt
@@ -11,8 +11,8 @@ ProgramNode(0...370)(
          [LocalVariableWriteNode(8...13)(
             :a,
             0,
-            IntegerNode(12...13)(),
             (8...9),
+            IntegerNode(12...13)(),
             (10...11)
           )]
        ),
@@ -63,8 +63,8 @@ ProgramNode(0...370)(
          [LocalVariableWriteNode(89...94)(
             :a,
             0,
-            IntegerNode(93...94)(),
             (89...90),
+            IntegerNode(93...94)(),
             (91...92)
           )]
        ),
diff --git a/test/yarp/snapshots/dos_endings.txt b/test/yarp/snapshots/dos_endings.txt
index 240ae043..7048028b 100644
--- a/test/yarp/snapshots/dos_endings.txt
+++ b/test/yarp/snapshots/dos_endings.txt
@@ -35,13 +35,14 @@ ProgramNode(0...108)(
      LocalVariableWriteNode(75...84)(
        :x,
        0,
-       StringNode(79...84)((79...82), (82...82), (82...84), ""),
        (75...76),
+       StringNode(79...84)((79...82), (82...82), (82...84), ""),
        (77...78)
      ),
      LocalVariableWriteNode(88...108)(
        :a,
        0,
+       (88...89),
        CallNode(92...108)(
          nil,
          nil,
@@ -74,7 +75,6 @@ ProgramNode(0...108)(
          0,
          "foo"
        ),
-       (88...89),
        (90...91)
      )]
   )
diff --git a/test/yarp/snapshots/methods.txt b/test/yarp/snapshots/methods.txt
index b5ec66aa..79d11f10 100644
--- a/test/yarp/snapshots/methods.txt
+++ b/test/yarp/snapshots/methods.txt
@@ -298,8 +298,8 @@ ProgramNode(0...1194)(
      LocalVariableWriteNode(275...280)(
        :a,
        0,
-       IntegerNode(279...280)(),
        (275...276),
+       IntegerNode(279...280)(),
        (277...278)
      ),
      DefNode(282...291)(
@@ -589,8 +589,8 @@ ProgramNode(0...1194)(
          [LocalVariableWriteNode(537...542)(
             :b,
             0,
-            IntegerNode(541...542)(),
             (537...538),
+            IntegerNode(541...542)(),
             (539...540)
           )]
        ),
@@ -839,6 +839,7 @@ ProgramNode(0...1194)(
          LocalVariableWriteNode(769...774)(
            :c,
            0,
+           (769...770),
            CallNode(773...774)(
              nil,
              nil,
@@ -850,7 +851,6 @@ ProgramNode(0...1194)(
              2,
              "b"
            ),
-           (769...770),
            (771...772)
          ),
          (768...769),
@@ -927,6 +927,7 @@ ProgramNode(0...1194)(
          LocalVariableWriteNode(833...838)(
            :a,
            0,
+           (833...834),
            CallNode(837...838)(
              nil,
              nil,
@@ -938,7 +939,6 @@ ProgramNode(0...1194)(
              2,
              "b"
            ),
-           (833...834),
            (835...836)
          ),
          (832...833),
diff --git a/test/yarp/snapshots/modules.txt b/test/yarp/snapshots/modules.txt
index a3cf30b9..aa8c1a74 100644
--- a/test/yarp/snapshots/modules.txt
+++ b/test/yarp/snapshots/modules.txt
@@ -9,8 +9,8 @@ ProgramNode(0...140)(
          [LocalVariableWriteNode(9...14)(
             :a,
             0,
-            IntegerNode(13...14)(),
             (9...10),
+            IntegerNode(13...14)(),
             (11...12)
           )]
        ),
@@ -62,8 +62,8 @@ ProgramNode(0...140)(
            [LocalVariableWriteNode(67...72)(
               :x,
               0,
-              IntegerNode(71...72)(),
               (67...68),
+              IntegerNode(71...72)(),
               (69...70)
             )]
          ),
diff --git a/test/yarp/snapshots/rescue.txt b/test/yarp/snapshots/rescue.txt
index b8944afd..c52a261f 100644
--- a/test/yarp/snapshots/rescue.txt
+++ b/test/yarp/snapshots/rescue.txt
@@ -192,6 +192,7 @@ ProgramNode(0...316)(
        LocalVariableWriteNode(217...235)(
          :a,
          0,
+         (217...218),
          RescueModifierNode(221...235)(
            CallNode(221...224)(
              nil,
@@ -207,7 +208,6 @@ ProgramNode(0...316)(
            (225...231),
            NilNode(232...235)()
          ),
-         (217...218),
          (219...220)
        ),
        StatementsNode(238...241)(
diff --git a/test/yarp/snapshots/seattlerb/bug202.txt b/test/yarp/snapshots/seattlerb/bug202.txt
index 7bb548f7..cbed9a67 100644
--- a/test/yarp/snapshots/seattlerb/bug202.txt
+++ b/test/yarp/snapshots/seattlerb/bug202.txt
@@ -1,12 +1,12 @@
 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,
-       IntegerNode(21...22)(),
        (12...18),
+       IntegerNode(21...22)(),
        (19...20)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/dasgn_icky2.txt b/test/yarp/snapshots/seattlerb/dasgn_icky2.txt
index 2aba42cc..8fbbf8ec 100644
--- a/test/yarp/snapshots/seattlerb/dasgn_icky2.txt
+++ b/test/yarp/snapshots/seattlerb/dasgn_icky2.txt
@@ -15,8 +15,8 @@ ProgramNode(0...76)(
            [LocalVariableWriteNode(7...14)(
               :v,
               0,
-              NilNode(11...14)(),
               (7...8),
+              NilNode(11...14)(),
               (9...10)
             ),
             BeginNode(17...72)(
diff --git a/test/yarp/snapshots/seattlerb/difficult1_line_numbers2.txt b/test/yarp/snapshots/seattlerb/difficult1_line_numbers2.txt
index 86433437..d19d6d81 100644
--- a/test/yarp/snapshots/seattlerb/difficult1_line_numbers2.txt
+++ b/test/yarp/snapshots/seattlerb/difficult1_line_numbers2.txt
@@ -21,8 +21,8 @@ ProgramNode(0...48)(
           LocalVariableWriteNode(24...29)(
             :b,
             0,
-            IntegerNode(28...29)(),
             (24...25),
+            IntegerNode(28...29)(),
             (26...27)
           ),
           CallNode(32...35)(
@@ -39,8 +39,8 @@ ProgramNode(0...48)(
           LocalVariableWriteNode(38...42)(
             :c,
             0,
-            IntegerNode(41...42)(),
             (38...39),
+            IntegerNode(41...42)(),
             (40...41)
           )]
        ),
diff --git a/test/yarp/snapshots/seattlerb/difficult3_4.txt b/test/yarp/snapshots/seattlerb/difficult3_4.txt
index afca77c5..40ebfca6 100644
--- a/test/yarp/snapshots/seattlerb/difficult3_4.txt
+++ b/test/yarp/snapshots/seattlerb/difficult3_4.txt
@@ -4,6 +4,7 @@ ProgramNode(0...17)(
     [LocalVariableWriteNode(0...17)(
        :a,
        0,
+       (0...1),
        IfNode(2...17)(
          nil,
          CallNode(2...3)(nil, nil, (2...3), nil, nil, nil, nil, 2, "b"),
@@ -15,7 +16,6 @@ ProgramNode(0...17)(
          ),
          nil
        ),
-       (0...1),
        (1...2)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc__backslash_dos_format.txt b/test/yarp/snapshots/seattlerb/heredoc__backslash_dos_format.txt
index d8a5d935..befdff81 100644
--- a/test/yarp/snapshots/seattlerb/heredoc__backslash_dos_format.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc__backslash_dos_format.txt
@@ -4,12 +4,12 @@ ProgramNode(0...12)(
     [LocalVariableWriteNode(0...12)(
        :str,
        0,
+       (0...3),
        InterpolatedStringNode(6...12)(
          (6...12),
          [StringNode(14...30)(nil, (14...30), nil, "beforeafter\r\n")],
          (30...35)
        ),
-       (0...3),
        (4...5)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_bad_hex_escape.txt b/test/yarp/snapshots/seattlerb/heredoc_bad_hex_escape.txt
index 4bc1846e..842da16d 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_bad_hex_escape.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_bad_hex_escape.txt
@@ -4,12 +4,12 @@ ProgramNode(0...9)(
     [LocalVariableWriteNode(0...9)(
        :s,
        0,
+       (0...1),
        InterpolatedStringNode(4...9)(
          (4...9),
          [StringNode(10...17)(nil, (10...17), nil, "a\xE9b\n")],
          (17...21)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_bad_oct_escape.txt b/test/yarp/snapshots/seattlerb/heredoc_bad_oct_escape.txt
index ebfb3b4d..14c02bdf 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_bad_oct_escape.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_bad_oct_escape.txt
@@ -4,12 +4,12 @@ ProgramNode(0...10)(
     [LocalVariableWriteNode(0...10)(
        :s,
        0,
+       (0...1),
        InterpolatedStringNode(4...10)(
          (4...10),
          [StringNode(11...23)(nil, (11...23), nil, "a\xA7b\n" + "cöd\n")],
          (23...27)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_lineno.txt b/test/yarp/snapshots/seattlerb/heredoc_lineno.txt
index 27708e25..9bbc817c 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_lineno.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_lineno.txt
@@ -4,6 +4,7 @@ ProgramNode(0...41)(
     [LocalVariableWriteNode(0...11)(
        :c,
        0,
+       (0...1),
        InterpolatedStringNode(4...11)(
          (4...11),
          [StringNode(12...30)(
@@ -14,14 +15,13 @@ ProgramNode(0...41)(
           )],
          (30...34)
        ),
-       (0...1),
        (2...3)
      ),
      LocalVariableWriteNode(35...41)(
        :d,
        0,
-       IntegerNode(39...41)(),
        (35...36),
+       IntegerNode(39...41)(),
        (37...38)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly.txt
index a1013d9e..6491c86c 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly.txt
@@ -4,12 +4,12 @@ ProgramNode(0...12)(
     [LocalVariableWriteNode(0...12)(
        :a,
        0,
+       (0...1),
        InterpolatedStringNode(4...12)(
          (4...12),
          [StringNode(13...25)(nil, (13...25), nil, "x\n" + "y\n" + "z\n")],
          (25...31)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt
index e78764e9..f2c3c1b1 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt
@@ -4,6 +4,7 @@ ProgramNode(0...20)(
     [LocalVariableWriteNode(0...20)(
        :a,
        0,
+       (0...1),
        CallNode(4...20)(
          nil,
          nil,
@@ -49,7 +50,6 @@ ProgramNode(0...20)(
          0,
          "foo"
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt
index 3bb7807c..4b59c352 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt
@@ -4,12 +4,12 @@ ProgramNode(0...10)(
     [LocalVariableWriteNode(0...10)(
        :a,
        0,
+       (0...1),
        InterpolatedStringNode(4...10)(
          (4...10),
          [StringNode(11...20)(nil, (11...20), nil, "x\n" + "\n" + "z\n")],
          (20...24)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly_interp.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly_interp.txt
index f895e997..e03304a7 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly_interp.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly_interp.txt
@@ -4,6 +4,7 @@ ProgramNode(0...10)(
     [LocalVariableWriteNode(0...10)(
        :a,
        0,
+       (0...1),
        InterpolatedStringNode(4...10)(
          (4...10),
          [StringNode(11...22)(nil, (11...22), nil, "    w\n" + "x"),
@@ -15,7 +16,6 @@ ProgramNode(0...10)(
           StringNode(27...36)(nil, (27...36), nil, " y\n" + "  z\n")],
          (36...42)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs.txt
index 13d1844e..1592d131 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs.txt
@@ -4,6 +4,7 @@ ProgramNode(0...12)(
     [LocalVariableWriteNode(0...12)(
        :a,
        0,
+       (0...1),
        InterpolatedStringNode(4...12)(
          (4...12),
          [StringNode(13...43)(
@@ -14,7 +15,6 @@ ProgramNode(0...12)(
           )],
          (43...49)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt
index da631943..63ff5887 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt
@@ -4,6 +4,7 @@ ProgramNode(0...12)(
     [LocalVariableWriteNode(0...12)(
        :a,
        0,
+       (0...1),
        InterpolatedStringNode(4...12)(
          (4...12),
          [StringNode(13...37)(
@@ -14,7 +15,6 @@ ProgramNode(0...12)(
           )],
          (37...43)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt b/test/yarp/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt
index 680ffbe0..866c5fac 100644
--- a/test/yarp/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt
+++ b/test/yarp/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt
@@ -4,12 +4,12 @@ ProgramNode(0...10)(
     [LocalVariableWriteNode(0...10)(
        :a,
        0,
+       (0...1),
        InterpolatedStringNode(4...10)(
          (4...10),
          [StringNode(11...21)(nil, (11...21), nil, "x\n" + "\n" + "z\n")],
          (21...25)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_arg_rescue_arg.txt b/test/yarp/snapshots/seattlerb/lasgn_arg_rescue_arg.txt
index 03ec05d3..ad36a5ed 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_arg_rescue_arg.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_arg_rescue_arg.txt
@@ -4,12 +4,12 @@ ProgramNode(0...14)(
     [LocalVariableWriteNode(0...14)(
        :a,
        0,
+       (0...1),
        RescueModifierNode(4...14)(
          IntegerNode(4...5)(),
          (6...12),
          IntegerNode(13...14)()
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_call_bracket_rescue_arg.txt b/test/yarp/snapshots/seattlerb/lasgn_call_bracket_rescue_arg.txt
index c28b8c21..86469f1c 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_call_bracket_rescue_arg.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_call_bracket_rescue_arg.txt
@@ -4,6 +4,7 @@ ProgramNode(0...17)(
     [LocalVariableWriteNode(0...17)(
        :a,
        0,
+       (0...1),
        RescueModifierNode(4...17)(
          CallNode(4...8)(
            nil,
@@ -19,7 +20,6 @@ ProgramNode(0...17)(
          (9...15),
          IntegerNode(16...17)()
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_call_nobracket_rescue_arg.txt b/test/yarp/snapshots/seattlerb/lasgn_call_nobracket_rescue_arg.txt
index bfb7c9b6..72e54e01 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_call_nobracket_rescue_arg.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_call_nobracket_rescue_arg.txt
@@ -4,6 +4,7 @@ ProgramNode(0...16)(
     [LocalVariableWriteNode(0...16)(
        :a,
        0,
+       (0...1),
        CallNode(4...16)(
          nil,
          nil,
@@ -21,7 +22,6 @@ ProgramNode(0...16)(
          0,
          "b"
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_command.txt b/test/yarp/snapshots/seattlerb/lasgn_command.txt
index 696be787..b1912a7c 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_command.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_command.txt
@@ -4,6 +4,7 @@ ProgramNode(0...9)(
     [LocalVariableWriteNode(0...9)(
        :a,
        0,
+       (0...1),
        CallNode(4...9)(
          CallNode(4...5)(nil, nil, (4...5), nil, nil, nil, nil, 2, "b"),
          (5...6),
@@ -15,7 +16,6 @@ ProgramNode(0...9)(
          0,
          "c"
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_env.txt b/test/yarp/snapshots/seattlerb/lasgn_env.txt
index 33f2f470..cfd276b1 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_env.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_env.txt
@@ -4,8 +4,8 @@ ProgramNode(0...6)(
     [LocalVariableWriteNode(0...6)(
        :a,
        0,
-       IntegerNode(4...6)(),
        (0...1),
+       IntegerNode(4...6)(),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_lasgn_command_call.txt b/test/yarp/snapshots/seattlerb/lasgn_lasgn_command_call.txt
index 4c272c16..49f22eeb 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_lasgn_command_call.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_lasgn_command_call.txt
@@ -4,9 +4,11 @@ ProgramNode(0...11)(
     [LocalVariableWriteNode(0...11)(
        :a,
        0,
+       (0...1),
        LocalVariableWriteNode(4...11)(
          :b,
          0,
+         (4...5),
          CallNode(8...11)(
            nil,
            nil,
@@ -18,10 +20,8 @@ ProgramNode(0...11)(
            0,
            "c"
          ),
-         (4...5),
          (6...7)
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/lasgn_middle_splat.txt b/test/yarp/snapshots/seattlerb/lasgn_middle_splat.txt
index 623f6dc1..acb6c844 100644
--- a/test/yarp/snapshots/seattlerb/lasgn_middle_splat.txt
+++ b/test/yarp/snapshots/seattlerb/lasgn_middle_splat.txt
@@ -4,6 +4,7 @@ ProgramNode(0...12)(
     [LocalVariableWriteNode(0...12)(
        :a,
        0,
+       (0...1),
        ArrayNode(4...12)(
          [CallNode(4...5)(nil, nil, (4...5), nil, nil, nil, nil, 2, "b"),
           SplatNode(7...9)(
@@ -14,7 +15,6 @@ ProgramNode(0...12)(
          nil,
          nil
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/magic_encoding_comment.txt b/test/yarp/snapshots/seattlerb/magic_encoding_comment.txt
index 08c8d9ea..b8b1ec34 100644
--- a/test/yarp/snapshots/seattlerb/magic_encoding_comment.txt
+++ b/test/yarp/snapshots/seattlerb/magic_encoding_comment.txt
@@ -16,8 +16,8 @@ ProgramNode(18...90)(
               [LocalVariableWriteNode(67...81)(
                  :così,
                  0,
-                 SymbolNode(75...81)((75...76), (76...81), nil, "però"),
                  (67...72),
+                 SymbolNode(75...81)((75...76), (76...81), nil, "però"),
                  (73...74)
                )]
             ),
diff --git a/test/yarp/snapshots/seattlerb/parse_line_block.txt b/test/yarp/snapshots/seattlerb/parse_line_block.txt
index 51282de9..7ca169a8 100644
--- a/test/yarp/snapshots/seattlerb/parse_line_block.txt
+++ b/test/yarp/snapshots/seattlerb/parse_line_block.txt
@@ -4,8 +4,8 @@ ProgramNode(0...10)(
     [LocalVariableWriteNode(0...6)(
        :a,
        0,
-       IntegerNode(4...6)(),
        (0...1),
+       IntegerNode(4...6)(),
        (2...3)
      ),
      CallNode(7...10)(
diff --git a/test/yarp/snapshots/seattlerb/parse_line_heredoc.txt b/test/yarp/snapshots/seattlerb/parse_line_heredoc.txt
index 8e41b164..955d94e9 100644
--- a/test/yarp/snapshots/seattlerb/parse_line_heredoc.txt
+++ b/test/yarp/snapshots/seattlerb/parse_line_heredoc.txt
@@ -4,6 +4,7 @@ ProgramNode(6...88)(
     [LocalVariableWriteNode(6...31)(
        :string,
        0,
+       (6...12),
        CallNode(15...31)(
          InterpolatedStringNode(15...25)(
            (15...25),
@@ -24,7 +25,6 @@ ProgramNode(6...88)(
          0,
          "strip"
        ),
-       (6...12),
        (13...14)
      ),
      CallNode(77...88)(
diff --git a/test/yarp/snapshots/seattlerb/parse_line_heredoc_regexp_chars.txt b/test/yarp/snapshots/seattlerb/parse_line_heredoc_regexp_chars.txt
index b3ed88d9..3d52fcbf 100644
--- a/test/yarp/snapshots/seattlerb/parse_line_heredoc_regexp_chars.txt
+++ b/test/yarp/snapshots/seattlerb/parse_line_heredoc_regexp_chars.txt
@@ -4,6 +4,7 @@ ProgramNode(6...74)(
     [LocalVariableWriteNode(6...22)(
        :string,
        0,
+       (6...12),
        InterpolatedStringNode(15...22)(
          (15...22),
          [StringNode(23...48)(
@@ -14,7 +15,6 @@ ProgramNode(6...74)(
           )],
          (48...57)
        ),
-       (6...12),
        (13...14)
      ),
      CallNode(63...74)(
diff --git a/test/yarp/snapshots/seattlerb/pct_nl.txt b/test/yarp/snapshots/seattlerb/pct_nl.txt
index 8435c33e..4cdba9d6 100644
--- a/test/yarp/snapshots/seattlerb/pct_nl.txt
+++ b/test/yarp/snapshots/seattlerb/pct_nl.txt
@@ -4,8 +4,8 @@ ProgramNode(0...7)(
     [LocalVariableWriteNode(0...7)(
        :x,
        0,
-       StringNode(4...7)((4...6), (6...6), (6...7), ""),
        (0...1),
+       StringNode(4...7)((4...6), (6...6), (6...7), ""),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/seattlerb/safe_call_rhs_newline.txt b/test/yarp/snapshots/seattlerb/safe_call_rhs_newline.txt
index 4000ecf5..7785c792 100644
--- a/test/yarp/snapshots/seattlerb/safe_call_rhs_newline.txt
+++ b/test/yarp/snapshots/seattlerb/safe_call_rhs_newline.txt
@@ -4,6 +4,7 @@ ProgramNode(0...8)(
     [LocalVariableWriteNode(0...8)(
        :c,
        0,
+       (0...1),
        CallNode(4...8)(
          CallNode(4...5)(nil, nil, (4...5), nil, nil, nil, nil, 2, "a"),
          (5...7),
@@ -15,7 +16,6 @@ ProgramNode(0...8)(
          1,
          "b"
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/ternary_operator.txt b/test/yarp/snapshots/ternary_operator.txt
index 6055e243..9751d53a 100644
--- a/test/yarp/snapshots/ternary_operator.txt
+++ b/test/yarp/snapshots/ternary_operator.txt
@@ -147,8 +147,8 @@ ProgramNode(0...131)(
          [LocalVariableWriteNode(124...129)(
             :_a,
             0,
-            IntegerNode(128...129)(),
             (124...126),
+            IntegerNode(128...129)(),
             (127...128)
           )]
        ),
diff --git a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt
index 78ab4d3d..7680b90f 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)()],
@@ -323,6 +323,7 @@ ProgramNode(0...704)(
      LocalVariableWriteNode(351...367)(
        :a,
        0,
+       (351...352),
        ParenthesesNode(355...367)(
          StatementsNode(356...366)(
            [MultiWriteNode(356...366)(
@@ -337,19 +338,19 @@ ProgramNode(0...704)(
          (355...356),
          (366...367)
        ),
-       (351...352),
        (353...354)
      ),
      LocalVariableWriteNode(368...373)(
        :a,
        0,
-       IntegerNode(372...373)(),
        (368...369),
+       IntegerNode(372...373)(),
        (370...371)
      ),
      LocalVariableWriteNode(374...385)(
        :foo,
        0,
+       (374...377),
        CallNode(380...385)(
          nil,
          nil,
@@ -361,7 +362,6 @@ ProgramNode(0...704)(
          0,
          "foo"
        ),
-       (374...377),
        (378...379)
      ),
      CallNode(386...395)(
@@ -538,8 +538,8 @@ ProgramNode(0...704)(
      LocalVariableWriteNode(507...514)(
        :x,
        0,
-       StringNode(511...514)((511...513), (513...513), (513...514), ""),
        (507...508),
+       StringNode(511...514)((511...513), (513...513), (513...514), ""),
        (509...510)
      ),
      CallNode(515...522)(
@@ -615,6 +615,7 @@ ProgramNode(0...704)(
      LocalVariableWriteNode(562...576)(
        :x,
        0,
+       (562...563),
        InterpolatedStringNode(566...576)(
          (566...576),
          [StringNode(577...579)(nil, (577...579), nil, "  "),
@@ -622,7 +623,6 @@ ProgramNode(0...704)(
           StringNode(582...583)(nil, (582...583), nil, "\n")],
          (583...591)
        ),
-       (562...563),
        (564...565)
      ),
      CallNode(591...605)(
diff --git a/test/yarp/snapshots/unparser/corpus/literal/dstr.txt b/test/yarp/snapshots/unparser/corpus/literal/dstr.txt
index 396ebcd3..facf0171 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/dstr.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/dstr.txt
@@ -57,7 +57,7 @@ ProgramNode(0...299)(
        [StringNode(146...147)(nil, (146...147), nil, "a"),
         EmbeddedVariableNode(147...150)(
           (147...148),
-          NumberedReferenceReadNode(148...150)(1)
+          NumberedReferenceReadNode(148...150)()
         )],
        (150...151)
      ),
diff --git a/test/yarp/snapshots/unparser/corpus/literal/if.txt b/test/yarp/snapshots/unparser/corpus/literal/if.txt
index 1bfbe7e2..77fb5c8c 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/if.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/if.txt
@@ -61,6 +61,7 @@ ProgramNode(0...246)(
               [LocalVariableWriteNode(113...122)(
                  :foo,
                  0,
+                 (113...116),
                  CallNode(119...122)(
                    nil,
                    nil,
@@ -72,7 +73,6 @@ ProgramNode(0...246)(
                    2,
                    "bar"
                  ),
-                 (113...116),
                  (117...118)
                )]
             ),
@@ -95,6 +95,7 @@ ProgramNode(0...246)(
               [LocalVariableWriteNode(146...155)(
                  :foo,
                  0,
+                 (146...149),
                  CallNode(152...155)(
                    nil,
                    nil,
@@ -106,7 +107,6 @@ ProgramNode(0...246)(
                    2,
                    "bar"
                  ),
-                 (146...149),
                  (150...151)
                )]
             ),
@@ -134,6 +134,7 @@ ProgramNode(0...246)(
          [LocalVariableWriteNode(184...193)(
             :foo,
             0,
+            (184...187),
             CallNode(190...193)(
               nil,
               nil,
@@ -145,7 +146,6 @@ ProgramNode(0...246)(
               2,
               "bar"
             ),
-            (184...187),
             (188...189)
           )]
        ),
@@ -190,8 +190,8 @@ ProgramNode(0...246)(
          [LocalVariableWriteNode(225...236)(
             :pair,
             0,
-            SymbolNode(232...236)((232...233), (233...236), nil, "foo"),
             (225...229),
+            SymbolNode(232...236)((232...233), (233...236), nil, "foo"),
             (230...231)
           ),
           LocalVariableReadNode(239...242)(:foo, 0)]
diff --git a/test/yarp/snapshots/unparser/corpus/literal/kwbegin.txt b/test/yarp/snapshots/unparser/corpus/literal/kwbegin.txt
index 7e9670da..1f28ad87 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/kwbegin.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/kwbegin.txt
@@ -259,6 +259,7 @@ ProgramNode(0...530)(
             LocalVariableWriteNode(307...316)(
               :foo,
               0,
+              (307...310),
               CallNode(313...316)(
                 nil,
                 nil,
@@ -270,7 +271,6 @@ ProgramNode(0...530)(
                 2,
                 "bar"
               ),
-              (307...310),
               (311...312)
             )
           )]
diff --git a/test/yarp/snapshots/unparser/corpus/literal/rescue.txt b/test/yarp/snapshots/unparser/corpus/literal/rescue.txt
index ed653b5d..8898a6e1 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/rescue.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/rescue.txt
@@ -29,6 +29,7 @@ ProgramNode(0...64)(
      LocalVariableWriteNode(37...64)(
        :x,
        0,
+       (37...38),
        ParenthesesNode(41...64)(
          StatementsNode(42...63)(
            [RescueModifierNode(42...63)(
@@ -65,7 +66,6 @@ ProgramNode(0...64)(
          (41...42),
          (63...64)
        ),
-       (37...38),
        (39...40)
      )]
   )
diff --git a/test/yarp/snapshots/unparser/corpus/literal/send.txt b/test/yarp/snapshots/unparser/corpus/literal/send.txt
index 1d3cd313..7ec3a338 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/send.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/send.txt
@@ -48,8 +48,8 @@ ProgramNode(0...999)(
          [LocalVariableWriteNode(48...57)(
             :local,
             0,
-            IntegerNode(56...57)(),
             (48...53),
+            IntegerNode(56...57)(),
             (54...55)
           ),
           CallNode(60...69)(
diff --git a/test/yarp/snapshots/unparser/corpus/literal/variables.txt b/test/yarp/snapshots/unparser/corpus/literal/variables.txt
index fe98a8cd..dfb85ec0 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/variables.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/variables.txt
@@ -5,7 +5,7 @@ ProgramNode(0...66)(
      InstanceVariableReadNode(2...4)(:@a),
      ClassVariableReadNode(5...8)(:@@a),
      GlobalVariableReadNode(9...11)(),
-     NumberedReferenceReadNode(12...14)(1),
+     NumberedReferenceReadNode(12...14)(),
      BackReferenceReadNode(15...17)(),
      ConstantReadNode(18...23)(),
      ConstantPathNode(24...37)(
diff --git a/test/yarp/snapshots/unparser/corpus/literal/while.txt b/test/yarp/snapshots/unparser/corpus/literal/while.txt
index 003c03d6..7fcd66a0 100644
--- a/test/yarp/snapshots/unparser/corpus/literal/while.txt
+++ b/test/yarp/snapshots/unparser/corpus/literal/while.txt
@@ -48,8 +48,8 @@ ProgramNode(0...620)(
                      [LocalVariableWriteNode(43...52)(
                         :foo,
                         0,
-                        LocalVariableReadNode(49...52)(:bar, 0),
                         (43...46),
+                        LocalVariableReadNode(49...52)(:bar, 0),
                         (47...48)
                       )]
                    ),
@@ -101,6 +101,7 @@ ProgramNode(0...620)(
               [LocalVariableWriteNode(80...89)(
                  :foo,
                  0,
+                 (80...83),
                  CallNode(86...89)(
                    nil,
                    nil,
@@ -112,7 +113,6 @@ ProgramNode(0...620)(
                    2,
                    "bar"
                  ),
-                 (80...83),
                  (84...85)
                )]
             ),
@@ -140,6 +140,7 @@ ProgramNode(0...620)(
               [LocalVariableWriteNode(123...132)(
                  :foo,
                  0,
+                 (123...126),
                  CallNode(129...132)(
                    nil,
                    nil,
@@ -151,7 +152,6 @@ ProgramNode(0...620)(
                    2,
                    "bar"
                  ),
-                 (123...126),
                  (127...128)
                )]
             ),
@@ -174,6 +174,7 @@ ProgramNode(0...620)(
               [LocalVariableWriteNode(159...168)(
                  :foo,
                  0,
+                 (159...162),
                  CallNode(165...168)(
                    nil,
                    nil,
@@ -185,7 +186,6 @@ ProgramNode(0...620)(
                    2,
                    "bar"
                  ),
-                 (159...162),
                  (163...164)
                )]
             ),
@@ -218,6 +218,7 @@ ProgramNode(0...620)(
               [LocalVariableWriteNode(209...218)(
                  :foo,
                  0,
+                 (209...212),
                  CallNode(215...218)(
                    nil,
                    nil,
@@ -229,7 +230,6 @@ ProgramNode(0...620)(
                    2,
                    "bar"
                  ),
-                 (209...212),
                  (213...214)
                )]
             ),
@@ -286,6 +286,7 @@ ProgramNode(0...620)(
                      [LocalVariableWriteNode(274...283)(
                         :foo,
                         0,
+                        (274...277),
                         CallNode(280...283)(
                           nil,
                           nil,
@@ -297,7 +298,6 @@ ProgramNode(0...620)(
                           2,
                           "bar"
                         ),
-                        (274...277),
                         (278...279)
                       )]
                    ),
@@ -351,6 +351,7 @@ ProgramNode(0...620)(
                      [LocalVariableWriteNode(345...354)(
                         :foo,
                         0,
+                        (345...348),
                         CallNode(351...354)(
                           nil,
                           nil,
@@ -362,7 +363,6 @@ ProgramNode(0...620)(
                           2,
                           "bar"
                         ),
-                        (345...348),
                         (349...350)
                       )]
                    ),
@@ -382,6 +382,7 @@ ProgramNode(0...620)(
      LocalVariableWriteNode(371...402)(
        :x,
        0,
+       (371...372),
        ParenthesesNode(375...402)(
          StatementsNode(376...401)(
            [WhileNode(376...401)(
@@ -426,7 +427,6 @@ ProgramNode(0...620)(
          (375...376),
          (401...402)
        ),
-       (371...372),
        (373...374)
      ),
      WhileNode(403...428)(
diff --git a/test/yarp/snapshots/unparser/corpus/semantic/while.txt b/test/yarp/snapshots/unparser/corpus/semantic/while.txt
index c381369c..d6d41984 100644
--- a/test/yarp/snapshots/unparser/corpus/semantic/while.txt
+++ b/test/yarp/snapshots/unparser/corpus/semantic/while.txt
@@ -47,6 +47,7 @@ ProgramNode(0...188)(
          [LocalVariableWriteNode(36...45)(
             :foo,
             0,
+            (36...39),
             CallNode(42...45)(
               nil,
               nil,
@@ -58,7 +59,6 @@ ProgramNode(0...188)(
               2,
               "bar"
             ),
-            (36...39),
             (40...41)
           )]
        ),
@@ -93,8 +93,8 @@ ProgramNode(0...188)(
        LocalVariableWriteNode(83...88)(
          :a,
          0,
-         CallNode(87...88)(nil, nil, (87...88), nil, nil, nil, nil, 2, "b"),
          (83...84),
+         CallNode(87...88)(nil, nil, (87...88), nil, nil, nil, nil, 2, "b"),
          (85...86)
        ),
        StatementsNode(91...92)([LocalVariableReadNode(91...92)(:a, 0)]),
@@ -145,6 +145,7 @@ ProgramNode(0...188)(
          [LocalVariableWriteNode(143...152)(
             :foo,
             0,
+            (143...146),
             CallNode(149...152)(
               nil,
               nil,
@@ -156,7 +157,6 @@ ProgramNode(0...188)(
               2,
               "exp"
             ),
-            (143...146),
             (147...148)
           ),
           WhileNode(155...184)(
@@ -167,6 +167,7 @@ ProgramNode(0...188)(
               [LocalVariableWriteNode(169...178)(
                  :foo,
                  0,
+                 (169...172),
                  CallNode(175...178)(
                    nil,
                    nil,
@@ -178,7 +179,6 @@ ProgramNode(0...188)(
                    2,
                    "bar"
                  ),
-                 (169...172),
                  (173...174)
                )]
             ),
diff --git a/test/yarp/snapshots/variables.txt b/test/yarp/snapshots/variables.txt
index 419942d1..edd27690 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),
@@ -43,8 +43,8 @@ ProgramNode(0...293)(
      LocalVariableWriteNode(85...92)(
        :abc,
        0,
-       IntegerNode(91...92)(),
        (85...88),
+       IntegerNode(91...92)(),
        (89...90)
      ),
      MultiWriteNode(94...108)(
@@ -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),
@@ -85,30 +85,30 @@ ProgramNode(0...293)(
      LocalVariableWriteNode(152...159)(
        :foo,
        0,
-       IntegerNode(158...159)(),
        (152...155),
+       IntegerNode(158...159)(),
        (156...157)
      ),
      LocalVariableWriteNode(161...171)(
        :foo,
        0,
+       (161...164),
        ArrayNode(167...171)(
          [IntegerNode(167...168)(), IntegerNode(170...171)()],
          nil,
          nil
        ),
-       (161...164),
        (165...166)
      ),
      LocalVariableWriteNode(173...183)(
        :foo,
        0,
+       (173...176),
        ArrayNode(179...183)(
          [IntegerNode(179...180)(), IntegerNode(182...183)()],
          nil,
          nil
        ),
-       (173...176),
        (177...178)
      ),
      MultiWriteNode(185...198)(
@@ -177,6 +177,7 @@ ProgramNode(0...293)(
      LocalVariableWriteNode(260...270)(
        :foo,
        0,
+       (260...263),
        ArrayNode(266...270)(
          [SplatNode(266...270)(
             (266...267),
@@ -185,7 +186,6 @@ ProgramNode(0...293)(
          nil,
          nil
        ),
-       (260...263),
        (264...265)
      ),
      ConstantWriteNode(272...282)(
diff --git a/test/yarp/snapshots/while.txt b/test/yarp/snapshots/while.txt
index 667dd303..4aa5fe85 100644
--- a/test/yarp/snapshots/while.txt
+++ b/test/yarp/snapshots/while.txt
@@ -123,6 +123,7 @@ ProgramNode(0...314)(
            [LocalVariableWriteNode(179...193)(
               :a,
               0,
+              (179...180),
               CallNode(183...193)(
                 nil,
                 nil,
@@ -134,7 +135,6 @@ ProgramNode(0...314)(
                 0,
                 "tap"
               ),
-              (179...180),
               (181...182)
             )]
          ),
@@ -182,6 +182,7 @@ ProgramNode(0...314)(
            [LocalVariableWriteNode(283...297)(
               :a,
               0,
+              (283...284),
               CallNode(287...297)(
                 nil,
                 nil,
@@ -193,7 +194,6 @@ ProgramNode(0...314)(
                 0,
                 "tap"
               ),
-              (283...284),
               (285...286)
             )]
          ),
diff --git a/test/yarp/snapshots/whitequark/asgn_cmd.txt b/test/yarp/snapshots/whitequark/asgn_cmd.txt
index 218c28dc..ef24cc04 100644
--- a/test/yarp/snapshots/whitequark/asgn_cmd.txt
+++ b/test/yarp/snapshots/whitequark/asgn_cmd.txt
@@ -4,9 +4,11 @@ ProgramNode(0...30)(
     [LocalVariableWriteNode(0...17)(
        :foo,
        0,
+       (0...3),
        LocalVariableWriteNode(6...17)(
          :bar,
          0,
+         (6...9),
          CallNode(12...17)(
            nil,
            nil,
@@ -18,15 +20,14 @@ ProgramNode(0...30)(
            0,
            "m"
          ),
-         (6...9),
          (10...11)
        ),
-       (0...3),
        (4...5)
      ),
      LocalVariableWriteNode(19...30)(
        :foo,
        0,
+       (19...22),
        CallNode(25...30)(
          nil,
          nil,
@@ -38,7 +39,6 @@ ProgramNode(0...30)(
          0,
          "m"
        ),
-       (19...22),
        (23...24)
      )]
   )
diff --git a/test/yarp/snapshots/whitequark/asgn_mrhs.txt b/test/yarp/snapshots/whitequark/asgn_mrhs.txt
index fddbc439..aaf2bedb 100644
--- a/test/yarp/snapshots/whitequark/asgn_mrhs.txt
+++ b/test/yarp/snapshots/whitequark/asgn_mrhs.txt
@@ -4,6 +4,7 @@ ProgramNode(0...41)(
     [LocalVariableWriteNode(0...10)(
        :foo,
        0,
+       (0...3),
        ArrayNode(6...10)(
          [SplatNode(6...10)(
             (6...7),
@@ -12,24 +13,24 @@ ProgramNode(0...41)(
          nil,
          nil
        ),
-       (0...3),
        (4...5)
      ),
      LocalVariableWriteNode(12...24)(
        :foo,
        0,
+       (12...15),
        ArrayNode(18...24)(
          [CallNode(18...21)(nil, nil, (18...21), nil, nil, nil, nil, 2, "bar"),
           IntegerNode(23...24)()],
          nil,
          nil
        ),
-       (12...15),
        (16...17)
      ),
      LocalVariableWriteNode(26...41)(
        :foo,
        0,
+       (26...29),
        ArrayNode(32...41)(
          [CallNode(32...35)(nil, nil, (32...35), nil, nil, nil, nil, 2, "baz"),
           SplatNode(37...41)(
@@ -49,7 +50,6 @@ ProgramNode(0...41)(
          nil,
          nil
        ),
-       (26...29),
        (30...31)
      )]
   )
diff --git a/test/yarp/snapshots/whitequark/class_definition_in_while_cond.txt b/test/yarp/snapshots/whitequark/class_definition_in_while_cond.txt
index a3108d70..1e954972 100644
--- a/test/yarp/snapshots/whitequark/class_definition_in_while_cond.txt
+++ b/test/yarp/snapshots/whitequark/class_definition_in_while_cond.txt
@@ -13,6 +13,7 @@ ProgramNode(0...197)(
            [LocalVariableWriteNode(21...35)(
               :a,
               0,
+              (21...22),
               CallNode(25...35)(
                 nil,
                 nil,
@@ -24,7 +25,6 @@ ProgramNode(0...197)(
                 0,
                 "tap"
               ),
-              (21...22),
               (23...24)
             )]
          ),
@@ -72,6 +72,7 @@ ProgramNode(0...197)(
            [LocalVariableWriteNode(120...134)(
               :a,
               0,
+              (120...121),
               CallNode(124...134)(
                 nil,
                 nil,
@@ -83,7 +84,6 @@ ProgramNode(0...197)(
                 0,
                 "tap"
               ),
-              (120...121),
               (122...123)
             )]
          ),
diff --git a/test/yarp/snapshots/whitequark/gvasgn.txt b/test/yarp/snapshots/whitequark/gvasgn.txt
index d6a53275..c4030831 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/test/yarp/snapshots/whitequark/lvasgn.txt b/test/yarp/snapshots/whitequark/lvasgn.txt
index 403c7f80..bb762001 100644
--- a/test/yarp/snapshots/whitequark/lvasgn.txt
+++ b/test/yarp/snapshots/whitequark/lvasgn.txt
@@ -4,8 +4,8 @@ ProgramNode(0...13)(
     [LocalVariableWriteNode(0...8)(
        :var,
        0,
-       IntegerNode(6...8)(),
        (0...3),
+       IntegerNode(6...8)(),
        (4...5)
      ),
      LocalVariableReadNode(10...13)(:var, 0)]
diff --git a/test/yarp/snapshots/whitequark/nth_ref.txt b/test/yarp/snapshots/whitequark/nth_ref.txt
index ca131a20..3bfe4c9a 100644
--- a/test/yarp/snapshots/whitequark/nth_ref.txt
+++ b/test/yarp/snapshots/whitequark/nth_ref.txt
@@ -1,4 +1,4 @@
 ProgramNode(0...3)(
   [],
-  StatementsNode(0...3)([NumberedReferenceReadNode(0...3)(10)])
+  StatementsNode(0...3)([NumberedReferenceReadNode(0...3)()])
 )
diff --git a/test/yarp/snapshots/whitequark/parser_bug_507.txt b/test/yarp/snapshots/whitequark/parser_bug_507.txt
index 4d6d91a7..f305b7da 100644
--- a/test/yarp/snapshots/whitequark/parser_bug_507.txt
+++ b/test/yarp/snapshots/whitequark/parser_bug_507.txt
@@ -4,6 +4,7 @@ ProgramNode(0...19)(
     [LocalVariableWriteNode(0...19)(
        :m,
        0,
+       (0...1),
        LambdaNode(4...19)(
          [:args],
          (4...6),
@@ -25,7 +26,6 @@ ProgramNode(0...19)(
          ),
          nil
        ),
-       (0...1),
        (2...3)
      )]
   )
diff --git a/test/yarp/snapshots/whitequark/rescue_mod_asgn.txt b/test/yarp/snapshots/whitequark/rescue_mod_asgn.txt
index c0c1b20c..b0ca3f6c 100644
--- a/test/yarp/snapshots/whitequark/rescue_mod_asgn.txt
+++ b/test/yarp/snapshots/whitequark/rescue_mod_asgn.txt
@@ -4,12 +4,12 @@ ProgramNode(0...21)(
     [LocalVariableWriteNode(0...21)(
        :foo,
        0,
+       (0...3),
        RescueModifierNode(6...21)(
          CallNode(6...10)(nil, nil, (6...10), nil, nil, nil, nil, 2, "meth"),
          (11...17),
          CallNode(18...21)(nil, nil, (18...21), nil, nil, nil, nil, 2, "bar")
        ),
-       (0...3),
        (4...5)
      )]
   )
diff --git a/test/yarp/snapshots/whitequark/ruby_bug_12073.txt b/test/yarp/snapshots/whitequark/ruby_bug_12073.txt
index 7614f1b1..8a3aee68 100644
--- a/test/yarp/snapshots/whitequark/ruby_bug_12073.txt
+++ b/test/yarp/snapshots/whitequark/ruby_bug_12073.txt
@@ -4,8 +4,8 @@ ProgramNode(0...49)(
     [LocalVariableWriteNode(0...5)(
        :a,
        0,
-       IntegerNode(4...5)(),
        (0...1),
+       IntegerNode(4...5)(),
        (2...3)
      ),
      CallNode(7...13)(
diff --git a/test/yarp/snapshots/whitequark/ruby_bug_12402.txt b/test/yarp/snapshots/whitequark/ruby_bug_12402.txt
index f2980c1d..7bcef829 100644
--- a/test/yarp/snapshots/whitequark/ruby_bug_12402.txt
+++ b/test/yarp/snapshots/whitequark/ruby_bug_12402.txt
@@ -72,6 +72,7 @@ ProgramNode(0...437)(
      LocalVariableWriteNode(59...85)(
        :foo,
        0,
+       (59...62),
        CallNode(65...85)(
          nil,
          nil,
@@ -99,12 +100,12 @@ ProgramNode(0...437)(
          0,
          "raise"
        ),
-       (59...62),
        (63...64)
      ),
      LocalVariableWriteNode(87...114)(
        :foo,
        0,
+       (87...90),
        RescueModifierNode(93...114)(
          CallNode(93...103)(
            nil,
@@ -132,7 +133,6 @@ ProgramNode(0...437)(
          (104...110),
          NilNode(111...114)()
        ),
-       (87...90),
        (91...92)
      ),
      CallOperatorWriteNode(116...145)(
diff --git a/test/yarp/snapshots/whitequark/ruby_bug_12669.txt b/test/yarp/snapshots/whitequark/ruby_bug_12669.txt
index f5ec48ce..689a3d9a 100644
--- a/test/yarp/snapshots/whitequark/ruby_bug_12669.txt
+++ b/test/yarp/snapshots/whitequark/ruby_bug_12669.txt
@@ -34,6 +34,7 @@ ProgramNode(0...74)(
        LocalVariableWriteNode(25...37)(
          :b,
          0,
+         (25...26),
          CallNode(29...37)(
            nil,
            nil,
@@ -47,7 +48,6 @@ ProgramNode(0...74)(
            0,
            "raise"
          ),
-         (25...26),
          (27...28)
        ),
        :a,
@@ -57,6 +57,7 @@ ProgramNode(0...74)(
      LocalVariableWriteNode(39...56)(
        :a,
        0,
+       (39...40),
        LocalVariableOperatorWriteNode(43...56)(
          (43...44),
          (45...47),
@@ -77,15 +78,16 @@ ProgramNode(0...74)(
          :+,
          0
        ),
-       (39...40),
        (41...42)
      ),
      LocalVariableWriteNode(58...74)(
        :a,
        0,
+       (58...59),
        LocalVariableWriteNode(62...74)(
          :b,
          0,
+         (62...63),
          CallNode(66...74)(
            nil,
            nil,
@@ -99,10 +101,8 @@ ProgramNode(0...74)(
            0,
            "raise"
          ),
-         (62...63),
          (64...65)
        ),
-       (58...59),
        (60...61)
      )]
   )
diff --git a/test/yarp/snapshots/whitequark/ruby_bug_9669.txt b/test/yarp/snapshots/whitequark/ruby_bug_9669.txt
index 3cdaf914..6302c3d3 100644
--- a/test/yarp/snapshots/whitequark/ruby_bug_9669.txt
+++ b/test/yarp/snapshots/whitequark/ruby_bug_9669.txt
@@ -25,6 +25,7 @@ ProgramNode(0...33)(
      LocalVariableWriteNode(21...33)(
        :o,
        0,
+       (21...22),
        HashNode(25...33)(
          (25...26),
          [AssocNode(27...31)(
@@ -34,7 +35,6 @@ ProgramNode(0...33)(
           )],
          (32...33)
        ),
-       (21...22),
        (23...24)
      )]
   )
diff --git a/test/yarp/snapshots/whitequark/ternary_ambiguous_symbol.txt b/test/yarp/snapshots/whitequark/ternary_ambiguous_symbol.txt
index 245f8a07..3f77bfd3 100644
--- a/test/yarp/snapshots/whitequark/ternary_ambiguous_symbol.txt
+++ b/test/yarp/snapshots/whitequark/ternary_ambiguous_symbol.txt
@@ -4,8 +4,8 @@ ProgramNode(0...13)(
     [LocalVariableWriteNode(0...3)(
        :t,
        0,
-       IntegerNode(2...3)(),
        (0...1),
+       IntegerNode(2...3)(),
        (1...2)
      ),
      IfNode(4...13)(