diff options
42 files changed, 638 insertions, 783 deletions
diff --git a/test/yarp/location_test.rb b/test/yarp/location_test.rb index 386177122d..6b219a0b36 100644 --- a/test/yarp/location_test.rb +++ b/test/yarp/location_test.rb @@ -223,7 +223,7 @@ module YARP def test_ClassVariableTargetNode assert_location(ClassVariableTargetNode, "@@foo, @@bar = baz", 0...5) do |node| - node.target.targets.first + node.targets.first end end @@ -251,7 +251,7 @@ module YARP def test_ConstantPathTargetNode assert_location(ConstantPathTargetNode, "::Foo, ::Bar = baz", 0...5) do |node| - node.target.targets.first + node.targets.first end end @@ -280,7 +280,7 @@ module YARP def test_ConstantTargetNode assert_location(ConstantTargetNode, "Foo, Bar = baz", 0...3) do |node| - node.target.targets.first + node.targets.first end end @@ -378,7 +378,7 @@ module YARP def test_GlobalVariableTargetNode assert_location(GlobalVariableTargetNode, "$foo, $bar = baz", 0...4) do |node| - node.target.targets.first + node.targets.first end end @@ -430,7 +430,7 @@ module YARP def test_InstanceVariableTargetNode assert_location(InstanceVariableTargetNode, "@foo, @bar = baz", 0...4) do |node| - node.target.targets.first + node.targets.first end end @@ -517,7 +517,7 @@ module YARP def test_LocalVariableTargetNode assert_location(LocalVariableTargetNode, "foo, bar = baz", 0...3) do |node| - node.target.targets.first + node.targets.first end end @@ -539,7 +539,7 @@ module YARP def test_MultiTargetNode assert_location(MultiTargetNode, "for foo, bar in baz do end", 4...12, &:index) - assert_location(MultiTargetNode, "foo, bar = baz", 0...8, &:target) + assert_location(MultiTargetNode, "foo, (bar, baz) = qux", 5...15) { |node| node.targets.last } end def test_MultiWriteNode @@ -695,7 +695,7 @@ module YARP end def test_SplatNode - assert_location(SplatNode, "*foo = bar", 0...4) { |node| node.target.targets.first } + assert_location(SplatNode, "*foo = bar", 0...4) { |node| node.targets.first } end def test_StatementsNode diff --git a/test/yarp/snapshots/arrays.txt b/test/yarp/snapshots/arrays.txt index b8f87295b4..a29cbeecb5 100644 --- a/test/yarp/snapshots/arrays.txt +++ b/test/yarp/snapshots/arrays.txt @@ -317,52 +317,50 @@ ProgramNode(0...511)( "[]=" ), MultiWriteNode(191...212)( - MultiTargetNode(191...205)( - [CallNode(191...197)( - CallNode(191...194)( - nil, - nil, - (191...194), - nil, - nil, - nil, - nil, - 2, - "foo" - ), + [CallNode(191...197)( + CallNode(191...194)( nil, - (194...197), - (194...195), - ArgumentsNode(195...196)([IntegerNode(195...196)()]), - (196...197), nil, - 0, - "[]=" + (191...194), + nil, + nil, + nil, + nil, + 2, + "foo" ), - CallNode(199...205)( - CallNode(199...202)( - nil, - nil, - (199...202), - nil, - nil, - nil, - nil, - 2, - "bar" - ), + nil, + (194...197), + (194...195), + ArgumentsNode(195...196)([IntegerNode(195...196)()]), + (196...197), + nil, + 0, + "[]=" + ), + CallNode(199...205)( + CallNode(199...202)( nil, - (202...205), - (202...203), - ArgumentsNode(203...204)([IntegerNode(203...204)()]), - (204...205), nil, - 0, - "[]=" - )], - nil, - nil - ), + (199...202), + nil, + nil, + nil, + nil, + 2, + "bar" + ), + nil, + (202...205), + (202...203), + ArgumentsNode(203...204)([IntegerNode(203...204)()]), + (204...205), + nil, + 0, + "[]=" + )], + nil, + nil, (206...207), ArrayNode(208...212)( [IntegerNode(208...209)(), IntegerNode(211...212)()], diff --git a/test/yarp/snapshots/method_calls.txt b/test/yarp/snapshots/method_calls.txt index 7ab43d0a84..37f03ef25f 100644 --- a/test/yarp/snapshots/method_calls.txt +++ b/test/yarp/snapshots/method_calls.txt @@ -348,52 +348,50 @@ ProgramNode(0...1237)( "b" ), MultiWriteNode(181...204)( - MultiTargetNode(181...197)( - [CallNode(181...188)( - CallNode(181...184)( - nil, - nil, - (181...184), - nil, - nil, - nil, - nil, - 2, - "foo" - ), - (184...185), - (185...188), + [CallNode(181...188)( + CallNode(181...184)( nil, nil, + (181...184), nil, nil, - 0, - "foo=" + nil, + nil, + 2, + "foo" ), - CallNode(190...197)( - CallNode(190...193)( - nil, - nil, - (190...193), - nil, - nil, - nil, - nil, - 2, - "bar" - ), - (193...194), - (194...197), + (184...185), + (185...188), + nil, + nil, + nil, + nil, + 0, + "foo=" + ), + CallNode(190...197)( + CallNode(190...193)( nil, nil, + (190...193), nil, nil, - 0, - "bar=" - )], - nil, - nil - ), + nil, + nil, + 2, + "bar" + ), + (193...194), + (194...197), + nil, + nil, + nil, + nil, + 0, + "bar=" + )], + nil, + nil, (198...199), ArrayNode(200...204)( [IntegerNode(200...201)(), IntegerNode(203...204)()], diff --git a/test/yarp/snapshots/seattlerb/masgn_anon_splat_arg.txt b/test/yarp/snapshots/seattlerb/masgn_anon_splat_arg.txt index e52928eb91..2fb68f7b6d 100644 --- a/test/yarp/snapshots/seattlerb/masgn_anon_splat_arg.txt +++ b/test/yarp/snapshots/seattlerb/masgn_anon_splat_arg.txt @@ -2,12 +2,10 @@ ProgramNode(0...8)( [:a], StatementsNode(0...8)( [MultiWriteNode(0...8)( - MultiTargetNode(0...4)( - [MultiTargetNode(0...1)([SplatNode(0...1)((0...1), nil)], nil, nil), - LocalVariableTargetNode(3...4)(:a, 0)], - nil, - nil - ), + [MultiTargetNode(0...1)([SplatNode(0...1)((0...1), nil)], nil, nil), + LocalVariableTargetNode(3...4)(:a, 0)], + nil, + nil, (5...6), CallNode(7...8)(nil, nil, (7...8), nil, nil, nil, nil, 2, "b") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_arg_colon_arg.txt b/test/yarp/snapshots/seattlerb/masgn_arg_colon_arg.txt index a13a84f116..fd2eeb213a 100644 --- a/test/yarp/snapshots/seattlerb/masgn_arg_colon_arg.txt +++ b/test/yarp/snapshots/seattlerb/masgn_arg_colon_arg.txt @@ -2,22 +2,20 @@ ProgramNode(0...11)( [:a], StatementsNode(0...11)( [MultiWriteNode(0...11)( - MultiTargetNode(0...7)( - [LocalVariableTargetNode(0...1)(:a, 0), - CallNode(3...7)( - CallNode(3...4)(nil, nil, (3...4), nil, nil, nil, nil, 2, "b"), - (4...6), - (6...7), - nil, - nil, - nil, - nil, - 0, - "c=" - )], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + CallNode(3...7)( + CallNode(3...4)(nil, nil, (3...4), nil, nil, nil, nil, 2, "b"), + (4...6), + (6...7), + nil, + nil, + nil, + nil, + 0, + "c=" + )], + nil, + nil, (8...9), CallNode(10...11)(nil, nil, (10...11), nil, nil, nil, nil, 2, "d") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_arg_ident.txt b/test/yarp/snapshots/seattlerb/masgn_arg_ident.txt index 53d5be38d6..a8b17ce707 100644 --- a/test/yarp/snapshots/seattlerb/masgn_arg_ident.txt +++ b/test/yarp/snapshots/seattlerb/masgn_arg_ident.txt @@ -2,22 +2,20 @@ ProgramNode(0...10)( [:a], StatementsNode(0...10)( [MultiWriteNode(0...10)( - MultiTargetNode(0...6)( - [LocalVariableTargetNode(0...1)(:a, 0), - CallNode(3...6)( - CallNode(3...4)(nil, nil, (3...4), nil, nil, nil, nil, 2, "b"), - (4...5), - (5...6), - nil, - nil, - nil, - nil, - 0, - "C=" - )], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + CallNode(3...6)( + CallNode(3...4)(nil, nil, (3...4), nil, nil, nil, nil, 2, "b"), + (4...5), + (5...6), + nil, + nil, + nil, + nil, + 0, + "C=" + )], + nil, + nil, (7...8), CallNode(9...10)(nil, nil, (9...10), nil, nil, nil, nil, 2, "d") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_arg_splat_arg.txt b/test/yarp/snapshots/seattlerb/masgn_arg_splat_arg.txt index 52fd5f6317..e922b3b5e8 100644 --- a/test/yarp/snapshots/seattlerb/masgn_arg_splat_arg.txt +++ b/test/yarp/snapshots/seattlerb/masgn_arg_splat_arg.txt @@ -2,13 +2,11 @@ ProgramNode(0...12)( [:a, :b, :c], StatementsNode(0...12)( [MultiWriteNode(0...12)( - MultiTargetNode(0...8)( - [LocalVariableTargetNode(0...1)(:a, 0), - SplatNode(3...5)((3...4), LocalVariableTargetNode(4...5)(:b, 0)), - LocalVariableTargetNode(7...8)(:c, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + SplatNode(3...5)((3...4), LocalVariableTargetNode(4...5)(:b, 0)), + LocalVariableTargetNode(7...8)(:c, 0)], + nil, + nil, (9...10), CallNode(11...12)(nil, nil, (11...12), nil, nil, nil, nil, 2, "d") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_colon2.txt b/test/yarp/snapshots/seattlerb/masgn_colon2.txt index d2eca1dc32..d9a2744466 100644 --- a/test/yarp/snapshots/seattlerb/masgn_colon2.txt +++ b/test/yarp/snapshots/seattlerb/masgn_colon2.txt @@ -2,16 +2,14 @@ ProgramNode(0...14)( [:a], StatementsNode(0...14)( [MultiWriteNode(0...14)( - MultiTargetNode(0...7)( - [LocalVariableTargetNode(0...1)(:a, 0), - ConstantPathTargetNode(3...7)( - CallNode(3...4)(nil, nil, (3...4), nil, nil, nil, nil, 2, "b"), - ConstantReadNode(6...7)(:C), - (4...6) - )], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + ConstantPathTargetNode(3...7)( + CallNode(3...4)(nil, nil, (3...4), nil, nil, nil, nil, 2, "b"), + ConstantReadNode(6...7)(:C), + (4...6) + )], + nil, + nil, (8...9), ArrayNode(10...14)( [IntegerNode(10...11)(), IntegerNode(13...14)()], diff --git a/test/yarp/snapshots/seattlerb/masgn_colon3.txt b/test/yarp/snapshots/seattlerb/masgn_colon3.txt index 7446135fdc..355f40f1cf 100644 --- a/test/yarp/snapshots/seattlerb/masgn_colon3.txt +++ b/test/yarp/snapshots/seattlerb/masgn_colon3.txt @@ -2,20 +2,18 @@ ProgramNode(0...15)( [], StatementsNode(0...15)( [MultiWriteNode(0...15)( - MultiTargetNode(0...8)( - [ConstantPathTargetNode(0...3)( - nil, - ConstantReadNode(2...3)(:A), - (0...2) - ), - ConstantPathTargetNode(5...8)( - nil, - ConstantReadNode(7...8)(:B), - (5...7) - )], - nil, - nil - ), + [ConstantPathTargetNode(0...3)( + nil, + ConstantReadNode(2...3)(:A), + (0...2) + ), + ConstantPathTargetNode(5...8)( + nil, + ConstantReadNode(7...8)(:B), + (5...7) + )], + nil, + nil, (9...10), ArrayNode(11...15)( [IntegerNode(11...12)(), IntegerNode(14...15)()], diff --git a/test/yarp/snapshots/seattlerb/masgn_command_call.txt b/test/yarp/snapshots/seattlerb/masgn_command_call.txt index 39cf7446d4..4563136c2f 100644 --- a/test/yarp/snapshots/seattlerb/masgn_command_call.txt +++ b/test/yarp/snapshots/seattlerb/masgn_command_call.txt @@ -2,12 +2,9 @@ ProgramNode(0...10)( [:a], StatementsNode(0...10)( [MultiWriteNode(0...10)( - MultiTargetNode(0...2)( - [LocalVariableTargetNode(0...1)(:a, 0), - SplatNode(1...2)((1...2), nil)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), SplatNode(1...2)((1...2), nil)], + nil, + nil, (3...4), CallNode(5...10)( CallNode(5...6)(nil, nil, (5...6), nil, nil, nil, nil, 2, "b"), diff --git a/test/yarp/snapshots/seattlerb/masgn_double_paren.txt b/test/yarp/snapshots/seattlerb/masgn_double_paren.txt index eaadbbc2c7..107be851e3 100644 --- a/test/yarp/snapshots/seattlerb/masgn_double_paren.txt +++ b/test/yarp/snapshots/seattlerb/masgn_double_paren.txt @@ -2,16 +2,14 @@ ProgramNode(1...9)( [:a, :b], StatementsNode(1...9)( [MultiWriteNode(1...9)( - MultiTargetNode(1...6)( - [MultiTargetNode(1...6)( - [LocalVariableTargetNode(2...3)(:a, 0), - LocalVariableTargetNode(4...5)(:b, 0)], - (1...2), - (5...6) - )], - nil, - nil - ), + [MultiTargetNode(1...6)( + [LocalVariableTargetNode(2...3)(:a, 0), + LocalVariableTargetNode(4...5)(:b, 0)], + (1...2), + (5...6) + )], + nil, + nil, (7...8), CallNode(8...9)(nil, nil, (8...9), nil, nil, nil, nil, 2, "c") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_lhs_splat.txt b/test/yarp/snapshots/seattlerb/masgn_lhs_splat.txt index 04418018dd..4730ed9618 100644 --- a/test/yarp/snapshots/seattlerb/masgn_lhs_splat.txt +++ b/test/yarp/snapshots/seattlerb/masgn_lhs_splat.txt @@ -2,11 +2,9 @@ ProgramNode(0...12)( [:a], StatementsNode(0...12)( [MultiWriteNode(0...12)( - MultiTargetNode(0...2)( - [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:a, 0))], - nil, - nil - ), + [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:a, 0))], + nil, + nil, (3...4), ArrayNode(5...12)( [IntegerNode(5...6)(), IntegerNode(8...9)(), IntegerNode(11...12)()], diff --git a/test/yarp/snapshots/seattlerb/masgn_paren.txt b/test/yarp/snapshots/seattlerb/masgn_paren.txt index e8e0d72a88..32b4fc2989 100644 --- a/test/yarp/snapshots/seattlerb/masgn_paren.txt +++ b/test/yarp/snapshots/seattlerb/masgn_paren.txt @@ -2,12 +2,10 @@ ProgramNode(0...12)( [:a, :b], StatementsNode(0...12)( [MultiWriteNode(0...12)( - MultiTargetNode(0...6)( - [LocalVariableTargetNode(1...2)(:a, 0), - LocalVariableTargetNode(4...5)(:b, 0)], - (0...1), - (5...6) - ), + [LocalVariableTargetNode(1...2)(:a, 0), + LocalVariableTargetNode(4...5)(:b, 0)], + (0...1), + (5...6), (7...8), CallNode(9...12)( CallNode(9...10)(nil, nil, (9...10), nil, nil, nil, nil, 2, "c"), diff --git a/test/yarp/snapshots/seattlerb/masgn_splat_arg.txt b/test/yarp/snapshots/seattlerb/masgn_splat_arg.txt index a93904b9e0..e2729a861d 100644 --- a/test/yarp/snapshots/seattlerb/masgn_splat_arg.txt +++ b/test/yarp/snapshots/seattlerb/masgn_splat_arg.txt @@ -2,16 +2,14 @@ ProgramNode(0...9)( [:a, :b], StatementsNode(0...9)( [MultiWriteNode(0...9)( - MultiTargetNode(0...5)( - [MultiTargetNode(0...2)( - [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:a, 0))], - nil, - nil - ), - LocalVariableTargetNode(4...5)(:b, 0)], - nil, - nil - ), + [MultiTargetNode(0...2)( + [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:a, 0))], + nil, + nil + ), + LocalVariableTargetNode(4...5)(:b, 0)], + nil, + nil, (6...7), CallNode(8...9)(nil, nil, (8...9), nil, nil, nil, nil, 2, "c") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_splat_arg_arg.txt b/test/yarp/snapshots/seattlerb/masgn_splat_arg_arg.txt index 5f95091cf7..bd6a512614 100644 --- a/test/yarp/snapshots/seattlerb/masgn_splat_arg_arg.txt +++ b/test/yarp/snapshots/seattlerb/masgn_splat_arg_arg.txt @@ -2,17 +2,15 @@ ProgramNode(0...12)( [:a, :b, :c], StatementsNode(0...12)( [MultiWriteNode(0...12)( - MultiTargetNode(0...8)( - [MultiTargetNode(0...2)( - [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:a, 0))], - nil, - nil - ), - LocalVariableTargetNode(4...5)(:b, 0), - LocalVariableTargetNode(7...8)(:c, 0)], - nil, - nil - ), + [MultiTargetNode(0...2)( + [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:a, 0))], + nil, + nil + ), + LocalVariableTargetNode(4...5)(:b, 0), + LocalVariableTargetNode(7...8)(:c, 0)], + nil, + nil, (9...10), CallNode(11...12)(nil, nil, (11...12), nil, nil, nil, nil, 2, "d") )] diff --git a/test/yarp/snapshots/seattlerb/masgn_star.txt b/test/yarp/snapshots/seattlerb/masgn_star.txt index 23c162c839..015e5edcc9 100644 --- a/test/yarp/snapshots/seattlerb/masgn_star.txt +++ b/test/yarp/snapshots/seattlerb/masgn_star.txt @@ -2,7 +2,9 @@ ProgramNode(0...5)( [], StatementsNode(0...5)( [MultiWriteNode(0...5)( - MultiTargetNode(0...1)([SplatNode(0...1)((0...1), nil)], nil, nil), + [SplatNode(0...1)((0...1), nil)], + nil, + nil, (2...3), IntegerNode(4...5)() )] diff --git a/test/yarp/snapshots/seattlerb/masgn_var_star_var.txt b/test/yarp/snapshots/seattlerb/masgn_var_star_var.txt index 59bb88d1ed..f6d0136d99 100644 --- a/test/yarp/snapshots/seattlerb/masgn_var_star_var.txt +++ b/test/yarp/snapshots/seattlerb/masgn_var_star_var.txt @@ -2,13 +2,11 @@ ProgramNode(0...11)( [:a, :b], StatementsNode(0...11)( [MultiWriteNode(0...11)( - MultiTargetNode(0...7)( - [LocalVariableTargetNode(0...1)(:a, 0), - SplatNode(3...4)((3...4), nil), - LocalVariableTargetNode(6...7)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + SplatNode(3...4)((3...4), nil), + LocalVariableTargetNode(6...7)(:b, 0)], + nil, + nil, (8...9), CallNode(10...11)(nil, nil, (10...11), nil, nil, nil, nil, 2, "c") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_back_anonsplat.txt b/test/yarp/snapshots/seattlerb/mlhs_back_anonsplat.txt index 1243734429..59e954706b 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_back_anonsplat.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_back_anonsplat.txt @@ -2,14 +2,12 @@ ProgramNode(0...14)( [:a, :b, :c], StatementsNode(0...14)( [MultiWriteNode(0...14)( - MultiTargetNode(0...10)( - [LocalVariableTargetNode(0...1)(:a, 0), - LocalVariableTargetNode(3...4)(:b, 0), - LocalVariableTargetNode(6...7)(:c, 0), - SplatNode(9...10)((9...10), nil)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + LocalVariableTargetNode(3...4)(:b, 0), + LocalVariableTargetNode(6...7)(:c, 0), + SplatNode(9...10)((9...10), nil)], + nil, + nil, (11...12), CallNode(13...14)(nil, nil, (13...14), nil, nil, nil, nil, 2, "f") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_back_splat.txt b/test/yarp/snapshots/seattlerb/mlhs_back_splat.txt index 05ff01d1bc..8014663bd3 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_back_splat.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_back_splat.txt @@ -2,17 +2,12 @@ ProgramNode(0...15)( [:a, :b, :c, :s], StatementsNode(0...15)( [MultiWriteNode(0...15)( - MultiTargetNode(0...11)( - [LocalVariableTargetNode(0...1)(:a, 0), - LocalVariableTargetNode(3...4)(:b, 0), - LocalVariableTargetNode(6...7)(:c, 0), - SplatNode(9...11)( - (9...10), - LocalVariableTargetNode(10...11)(:s, 0) - )], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + LocalVariableTargetNode(3...4)(:b, 0), + LocalVariableTargetNode(6...7)(:c, 0), + SplatNode(9...11)((9...10), LocalVariableTargetNode(10...11)(:s, 0))], + nil, + nil, (12...13), CallNode(14...15)(nil, nil, (14...15), nil, nil, nil, nil, 2, "f") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_front_anonsplat.txt b/test/yarp/snapshots/seattlerb/mlhs_front_anonsplat.txt index 0655ff46bd..74a63d328b 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_front_anonsplat.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_front_anonsplat.txt @@ -2,14 +2,12 @@ ProgramNode(0...14)( [:x, :y, :z], StatementsNode(0...14)( [MultiWriteNode(0...14)( - MultiTargetNode(0...10)( - [MultiTargetNode(0...1)([SplatNode(0...1)((0...1), nil)], nil, nil), - LocalVariableTargetNode(3...4)(:x, 0), - LocalVariableTargetNode(6...7)(:y, 0), - LocalVariableTargetNode(9...10)(:z, 0)], - nil, - nil - ), + [MultiTargetNode(0...1)([SplatNode(0...1)((0...1), nil)], nil, nil), + LocalVariableTargetNode(3...4)(:x, 0), + LocalVariableTargetNode(6...7)(:y, 0), + LocalVariableTargetNode(9...10)(:z, 0)], + nil, + nil, (11...12), CallNode(13...14)(nil, nil, (13...14), nil, nil, nil, nil, 2, "f") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_front_splat.txt b/test/yarp/snapshots/seattlerb/mlhs_front_splat.txt index 4e8082cbaf..f3110882cc 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_front_splat.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_front_splat.txt @@ -2,18 +2,16 @@ ProgramNode(0...15)( [:s, :x, :y, :z], StatementsNode(0...15)( [MultiWriteNode(0...15)( - MultiTargetNode(0...11)( - [MultiTargetNode(0...2)( - [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:s, 0))], - nil, - nil - ), - LocalVariableTargetNode(4...5)(:x, 0), - LocalVariableTargetNode(7...8)(:y, 0), - LocalVariableTargetNode(10...11)(:z, 0)], - nil, - nil - ), + [MultiTargetNode(0...2)( + [SplatNode(0...2)((0...1), LocalVariableTargetNode(1...2)(:s, 0))], + nil, + nil + ), + LocalVariableTargetNode(4...5)(:x, 0), + LocalVariableTargetNode(7...8)(:y, 0), + LocalVariableTargetNode(10...11)(:z, 0)], + nil, + nil, (12...13), CallNode(14...15)(nil, nil, (14...15), nil, nil, nil, nil, 2, "f") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_mid_anonsplat.txt b/test/yarp/snapshots/seattlerb/mlhs_mid_anonsplat.txt index 1e4f4bb53b..c0e3acc145 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_mid_anonsplat.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_mid_anonsplat.txt @@ -2,17 +2,15 @@ ProgramNode(0...23)( [:a, :b, :c, :x, :y, :z], StatementsNode(0...23)( [MultiWriteNode(0...23)( - MultiTargetNode(0...19)( - [LocalVariableTargetNode(0...1)(:a, 0), - LocalVariableTargetNode(3...4)(:b, 0), - LocalVariableTargetNode(6...7)(:c, 0), - SplatNode(9...10)((9...10), nil), - LocalVariableTargetNode(12...13)(:x, 0), - LocalVariableTargetNode(15...16)(:y, 0), - LocalVariableTargetNode(18...19)(:z, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + LocalVariableTargetNode(3...4)(:b, 0), + LocalVariableTargetNode(6...7)(:c, 0), + SplatNode(9...10)((9...10), nil), + LocalVariableTargetNode(12...13)(:x, 0), + LocalVariableTargetNode(15...16)(:y, 0), + LocalVariableTargetNode(18...19)(:z, 0)], + nil, + nil, (20...21), CallNode(22...23)(nil, nil, (22...23), nil, nil, nil, nil, 2, "f") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_mid_splat.txt b/test/yarp/snapshots/seattlerb/mlhs_mid_splat.txt index 8fd7b6f3aa..46d81adf64 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_mid_splat.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_mid_splat.txt @@ -2,17 +2,15 @@ ProgramNode(0...24)( [:a, :b, :c, :s, :x, :y, :z], StatementsNode(0...24)( [MultiWriteNode(0...24)( - MultiTargetNode(0...20)( - [LocalVariableTargetNode(0...1)(:a, 0), - LocalVariableTargetNode(3...4)(:b, 0), - LocalVariableTargetNode(6...7)(:c, 0), - SplatNode(9...11)((9...10), LocalVariableTargetNode(10...11)(:s, 0)), - LocalVariableTargetNode(13...14)(:x, 0), - LocalVariableTargetNode(16...17)(:y, 0), - LocalVariableTargetNode(19...20)(:z, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + LocalVariableTargetNode(3...4)(:b, 0), + LocalVariableTargetNode(6...7)(:c, 0), + SplatNode(9...11)((9...10), LocalVariableTargetNode(10...11)(:s, 0)), + LocalVariableTargetNode(13...14)(:x, 0), + LocalVariableTargetNode(16...17)(:y, 0), + LocalVariableTargetNode(19...20)(:z, 0)], + nil, + nil, (21...22), CallNode(23...24)(nil, nil, (23...24), nil, nil, nil, nil, 2, "f") )] diff --git a/test/yarp/snapshots/seattlerb/mlhs_rescue.txt b/test/yarp/snapshots/seattlerb/mlhs_rescue.txt index 8d39772c8d..427c56dfea 100644 --- a/test/yarp/snapshots/seattlerb/mlhs_rescue.txt +++ b/test/yarp/snapshots/seattlerb/mlhs_rescue.txt @@ -2,12 +2,10 @@ ProgramNode(0...18)( [:a, :b], StatementsNode(0...18)( [MultiWriteNode(0...18)( - MultiTargetNode(0...4)( - [LocalVariableTargetNode(0...1)(:a, 0), - LocalVariableTargetNode(3...4)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + LocalVariableTargetNode(3...4)(:b, 0)], + nil, + nil, (5...6), RescueModifierNode(7...18)( CallNode(7...8)(nil, nil, (7...8), nil, nil, nil, nil, 2, "f"), diff --git a/test/yarp/snapshots/seattlerb/parse_line_to_ary.txt b/test/yarp/snapshots/seattlerb/parse_line_to_ary.txt index 39afa6816b..e8736976c7 100644 --- a/test/yarp/snapshots/seattlerb/parse_line_to_ary.txt +++ b/test/yarp/snapshots/seattlerb/parse_line_to_ary.txt @@ -2,12 +2,10 @@ ProgramNode(0...10)( [:a, :b], StatementsNode(0...10)( [MultiWriteNode(0...8)( - MultiTargetNode(0...4)( - [LocalVariableTargetNode(0...1)(:a, 0), - LocalVariableTargetNode(3...4)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...1)(:a, 0), + LocalVariableTargetNode(3...4)(:b, 0)], + nil, + nil, (5...6), CallNode(7...8)(nil, nil, (7...8), nil, nil, nil, nil, 2, "c") ), diff --git a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt index 658cb37c5c..3f82c3a8e4 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt @@ -8,12 +8,10 @@ ProgramNode(0...704)( (3...4) ), MultiWriteNode(7...24)( - MultiTargetNode(7...15)( - [GlobalVariableTargetNode(8...10)(:$a), - GlobalVariableTargetNode(12...14)(:$b)], - (7...8), - (14...15) - ), + [GlobalVariableTargetNode(8...10)(:$a), + GlobalVariableTargetNode(12...14)(:$b)], + (7...8), + (14...15), (16...17), ArrayNode(18...24)( [IntegerNode(19...20)(), IntegerNode(22...23)()], @@ -22,41 +20,35 @@ ProgramNode(0...704)( ) ), MultiWriteNode(25...38)( - MultiTargetNode(25...34)( - [MultiTargetNode(26...30)( - [LocalVariableTargetNode(27...28)(:a, 0), - SplatNode(28...29)((28...29), nil)], - (26...27), - (29...30) - ), - LocalVariableTargetNode(32...33)(:b, 0)], - (25...26), - (33...34) - ), + [MultiTargetNode(26...30)( + [LocalVariableTargetNode(27...28)(:a, 0), + SplatNode(28...29)((28...29), nil)], + (26...27), + (29...30) + ), + LocalVariableTargetNode(32...33)(:b, 0)], + (25...26), + (33...34), (35...36), IntegerNode(37...38)() ), MultiWriteNode(39...48)( - MultiTargetNode(39...43)( - [SplatNode(40...42)( - (40...41), - LocalVariableTargetNode(41...42)(:a, 0) - )], - (39...40), - (42...43) - ), + [SplatNode(40...42)( + (40...41), + LocalVariableTargetNode(41...42)(:a, 0) + )], + (39...40), + (42...43), (44...45), ArrayNode(46...48)([], (46...47), (47...48)) ), MultiWriteNode(49...64)( - MultiTargetNode(49...55)( - [SplatNode(50...54)( - (50...51), - LocalVariableTargetNode(51...54)(:foo, 0) - )], - (49...50), - (54...55) - ), + [SplatNode(50...54)( + (50...51), + LocalVariableTargetNode(51...54)(:foo, 0) + )], + (49...50), + (54...55), (56...57), ArrayNode(58...64)( [IntegerNode(59...60)(), IntegerNode(62...63)()], @@ -65,12 +57,10 @@ ProgramNode(0...704)( ) ), MultiWriteNode(65...84)( - MultiTargetNode(65...75)( - [ClassVariableTargetNode(66...69)(:@@a), - ClassVariableTargetNode(71...74)(:@@b)], - (65...66), - (74...75) - ), + [ClassVariableTargetNode(66...69)(:@@a), + ClassVariableTargetNode(71...74)(:@@b)], + (65...66), + (74...75), (76...77), ArrayNode(78...84)( [IntegerNode(79...80)(), IntegerNode(82...83)()], @@ -79,12 +69,10 @@ ProgramNode(0...704)( ) ), MultiWriteNode(85...102)( - MultiTargetNode(85...93)( - [InstanceVariableTargetNode(86...88)(:@a), - InstanceVariableTargetNode(90...92)(:@b)], - (85...86), - (92...93) - ), + [InstanceVariableTargetNode(86...88)(:@a), + InstanceVariableTargetNode(90...92)(:@b)], + (85...86), + (92...93), (94...95), ArrayNode(96...102)( [IntegerNode(97...98)(), IntegerNode(100...101)()], @@ -93,17 +81,15 @@ ProgramNode(0...704)( ) ), MultiWriteNode(103...128)( - MultiTargetNode(103...114)( - [LocalVariableTargetNode(104...105)(:a, 0), - MultiTargetNode(107...113)( - [LocalVariableTargetNode(108...109)(:b, 0), - LocalVariableTargetNode(111...112)(:c, 0)], - (107...108), - (112...113) - )], - (103...104), - (113...114) - ), + [LocalVariableTargetNode(104...105)(:a, 0), + MultiTargetNode(107...113)( + [LocalVariableTargetNode(108...109)(:b, 0), + LocalVariableTargetNode(111...112)(:c, 0)], + (107...108), + (112...113) + )], + (103...104), + (113...114), (115...116), ArrayNode(117...128)( [IntegerNode(118...119)(), @@ -117,12 +103,10 @@ ProgramNode(0...704)( ) ), MultiWriteNode(129...144)( - MultiTargetNode(129...135)( - [LocalVariableTargetNode(130...131)(:a, 0), - SplatNode(133...134)((133...134), nil)], - (129...130), - (134...135) - ), + [LocalVariableTargetNode(130...131)(:a, 0), + SplatNode(133...134)((133...134), nil)], + (129...130), + (134...135), (136...137), ArrayNode(138...144)( [IntegerNode(139...140)(), IntegerNode(142...143)()], @@ -131,15 +115,13 @@ ProgramNode(0...704)( ) ), MultiWriteNode(145...163)( - MultiTargetNode(145...154)( - [LocalVariableTargetNode(146...147)(:a, 0), - SplatNode(149...153)( - (149...150), - LocalVariableTargetNode(150...153)(:foo, 0) - )], - (145...146), - (153...154) - ), + [LocalVariableTargetNode(146...147)(:a, 0), + SplatNode(149...153)( + (149...150), + LocalVariableTargetNode(150...153)(:foo, 0) + )], + (145...146), + (153...154), (155...156), ArrayNode(157...163)( [IntegerNode(158...159)(), IntegerNode(161...162)()], @@ -148,12 +130,10 @@ ProgramNode(0...704)( ) ), MultiWriteNode(164...179)( - MultiTargetNode(164...170)( - [LocalVariableTargetNode(165...166)(:a, 0), - LocalVariableTargetNode(168...169)(:b, 0)], - (164...165), - (169...170) - ), + [LocalVariableTargetNode(165...166)(:a, 0), + LocalVariableTargetNode(168...169)(:b, 0)], + (164...165), + (169...170), (171...172), ArrayNode(173...179)( [IntegerNode(174...175)(), IntegerNode(177...178)()], @@ -162,52 +142,46 @@ ProgramNode(0...704)( ) ), MultiWriteNode(180...192)( - MultiTargetNode(180...186)( - [LocalVariableTargetNode(181...182)(:a, 0), - LocalVariableTargetNode(184...185)(:b, 0)], - (180...181), - (185...186) - ), + [LocalVariableTargetNode(181...182)(:a, 0), + LocalVariableTargetNode(184...185)(:b, 0)], + (180...181), + (185...186), (187...188), LocalVariableReadNode(189...192)(:foo, 0) ), MultiWriteNode(193...203)( - MultiTargetNode(193...197)( - [LocalVariableTargetNode(194...195)(:a, 0), - SplatNode(195...196)((195...196), nil)], - (193...194), - (196...197) - ), + [LocalVariableTargetNode(194...195)(:a, 0), + SplatNode(195...196)((195...196), nil)], + (193...194), + (196...197), (198...199), LocalVariableReadNode(200...203)(:foo, 0) ), MultiWriteNode(204...227)( - MultiTargetNode(204...218)( - [CallNode(205...210)( - LocalVariableReadNode(205...206)(:a, 0), - (206...207), - (207...210), - nil, - nil, - nil, - nil, - 0, - "foo=" - ), - CallNode(212...217)( - LocalVariableReadNode(212...213)(:a, 0), - (213...214), - (214...217), - nil, - nil, - nil, - nil, - 0, - "bar=" - )], - (204...205), - (217...218) - ), + [CallNode(205...210)( + LocalVariableReadNode(205...206)(:a, 0), + (206...207), + (207...210), + nil, + nil, + nil, + nil, + 0, + "foo=" + ), + CallNode(212...217)( + LocalVariableReadNode(212...213)(:a, 0), + (213...214), + (214...217), + nil, + nil, + nil, + nil, + 0, + "bar=" + )], + (204...205), + (217...218), (219...220), ArrayNode(221...227)( [IntegerNode(222...223)(), IntegerNode(225...226)()], @@ -216,37 +190,35 @@ ProgramNode(0...704)( ) ), MultiWriteNode(228...252)( - MultiTargetNode(228...243)( - [CallNode(229...236)( - LocalVariableReadNode(229...230)(:a, 0), - nil, - (230...236), - (230...231), - ArgumentsNode(231...235)( - [SplatNode(231...235)( - (231...232), - LocalVariableReadNode(232...235)(:foo, 0) - )] - ), - (235...236), - nil, - 0, - "[]=" + [CallNode(229...236)( + LocalVariableReadNode(229...230)(:a, 0), + nil, + (230...236), + (230...231), + ArgumentsNode(231...235)( + [SplatNode(231...235)( + (231...232), + LocalVariableReadNode(232...235)(:foo, 0) + )] ), - CallNode(238...242)( - LocalVariableReadNode(238...239)(:a, 0), - nil, - (239...242), - (239...240), - ArgumentsNode(240...241)([IntegerNode(240...241)()]), - (241...242), - nil, - 0, - "[]=" - )], - (228...229), - (242...243) - ), + (235...236), + nil, + 0, + "[]=" + ), + CallNode(238...242)( + LocalVariableReadNode(238...239)(:a, 0), + nil, + (239...242), + (239...240), + ArgumentsNode(240...241)([IntegerNode(240...241)()]), + (241...242), + nil, + 0, + "[]=" + )], + (228...229), + (242...243), (244...245), ArrayNode(246...252)( [IntegerNode(247...248)(), IntegerNode(250...251)()], @@ -255,32 +227,30 @@ ProgramNode(0...704)( ) ), MultiWriteNode(253...274)( - MultiTargetNode(253...265)( - [CallNode(254...258)( - LocalVariableReadNode(254...255)(:a, 0), - nil, - (255...258), - (255...256), - ArgumentsNode(256...257)([IntegerNode(256...257)()]), - (257...258), - nil, - 0, - "[]=" - ), - CallNode(260...264)( - LocalVariableReadNode(260...261)(:a, 0), - nil, - (261...264), - (261...262), - ArgumentsNode(262...263)([IntegerNode(262...263)()]), - (263...264), - nil, - 0, - "[]=" - )], - (253...254), - (264...265) - ), + [CallNode(254...258)( + LocalVariableReadNode(254...255)(:a, 0), + nil, + (255...258), + (255...256), + ArgumentsNode(256...257)([IntegerNode(256...257)()]), + (257...258), + nil, + 0, + "[]=" + ), + CallNode(260...264)( + LocalVariableReadNode(260...261)(:a, 0), + nil, + (261...264), + (261...262), + ArgumentsNode(262...263)([IntegerNode(262...263)()]), + (263...264), + nil, + 0, + "[]=" + )], + (253...254), + (264...265), (266...267), ArrayNode(268...274)( [IntegerNode(269...270)(), IntegerNode(272...273)()], @@ -289,24 +259,22 @@ ProgramNode(0...704)( ) ), MultiWriteNode(275...287)( - MultiTargetNode(275...283)( - [SplatNode(276...282)( - (276...277), - CallNode(277...282)( - LocalVariableReadNode(277...278)(:c, 0), - (278...279), - (279...282), - nil, - nil, - nil, - nil, - 0, - "foo=" - ) - )], - (275...276), - (282...283) - ), + [SplatNode(276...282)( + (276...277), + CallNode(277...282)( + LocalVariableReadNode(277...278)(:c, 0), + (278...279), + (279...282), + nil, + nil, + nil, + nil, + 0, + "foo=" + ) + )], + (275...276), + (282...283), (284...285), IntegerNode(286...287)() ), @@ -361,12 +329,10 @@ ProgramNode(0...704)( ParenthesesNode(355...367)( StatementsNode(356...366)( [MultiWriteNode(356...366)( - MultiTargetNode(356...362)( - [LocalVariableTargetNode(357...358)(:b, 0), - LocalVariableTargetNode(360...361)(:c, 0)], - (356...357), - (361...362) - ), + [LocalVariableTargetNode(357...358)(:b, 0), + LocalVariableTargetNode(360...361)(:c, 0)], + (356...357), + (361...362), (363...364), IntegerNode(365...366)() )] diff --git a/test/yarp/snapshots/unparser/corpus/literal/defined.txt b/test/yarp/snapshots/unparser/corpus/literal/defined.txt index 84167e14d4..58816ee742 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/defined.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/defined.txt @@ -18,12 +18,10 @@ ProgramNode(0...56)( ParenthesesNode(38...55)( StatementsNode(39...54)( [MultiWriteNode(39...54)( - MultiTargetNode(39...45)( - [LocalVariableTargetNode(40...41)(:a, 0), - LocalVariableTargetNode(43...44)(:b, 0)], - (39...40), - (44...45) - ), + [LocalVariableTargetNode(40...41)(:a, 0), + LocalVariableTargetNode(43...44)(:b, 0)], + (39...40), + (44...45), (46...47), ArrayNode(48...54)( [IntegerNode(49...50)(), IntegerNode(52...53)()], diff --git a/test/yarp/snapshots/unparser/corpus/literal/send.txt b/test/yarp/snapshots/unparser/corpus/literal/send.txt index 0cc45c949b..858101f5a3 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/send.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/send.txt @@ -12,12 +12,10 @@ ProgramNode(0...999)( ParenthesesNode(19...31)( StatementsNode(20...30)( [MultiWriteNode(20...30)( - MultiTargetNode(20...26)( - [LocalVariableTargetNode(21...22)(:a, 0), - LocalVariableTargetNode(24...25)(:_, 0)], - (20...21), - (25...26) - ), + [LocalVariableTargetNode(21...22)(:a, 0), + LocalVariableTargetNode(24...25)(:_, 0)], + (20...21), + (25...26), (27...28), CallNode(29...30)( nil, diff --git a/test/yarp/snapshots/variables.txt b/test/yarp/snapshots/variables.txt index 74691a2ae6..29f5e44817 100644 --- a/test/yarp/snapshots/variables.txt +++ b/test/yarp/snapshots/variables.txt @@ -9,12 +9,10 @@ ProgramNode(0...293)( (13...14) ), MultiWriteNode(18...34)( - MultiTargetNode(18...30)( - [ClassVariableTargetNode(18...23)(:@@foo), - ClassVariableTargetNode(25...30)(:@@bar)], - nil, - nil - ), + [ClassVariableTargetNode(18...23)(:@@foo), + ClassVariableTargetNode(25...30)(:@@bar)], + nil, + nil, (31...32), IntegerNode(33...34)() ), @@ -51,12 +49,10 @@ ProgramNode(0...293)( (89...90) ), MultiWriteNode(94...108)( - MultiTargetNode(94...104)( - [GlobalVariableTargetNode(94...98)(:$foo), - GlobalVariableTargetNode(100...104)(:$bar)], - nil, - nil - ), + [GlobalVariableTargetNode(94...98)(:$foo), + GlobalVariableTargetNode(100...104)(:$bar)], + nil, + nil, (105...106), IntegerNode(107...108)() ), @@ -71,12 +67,10 @@ ProgramNode(0...293)( (115...116) ), MultiWriteNode(123...137)( - MultiTargetNode(123...133)( - [InstanceVariableTargetNode(123...127)(:@foo), - InstanceVariableTargetNode(129...133)(:@bar)], - nil, - nil - ), + [InstanceVariableTargetNode(123...127)(:@foo), + InstanceVariableTargetNode(129...133)(:@bar)], + nil, + nil, (134...135), IntegerNode(136...137)() ), @@ -120,12 +114,10 @@ ProgramNode(0...293)( (177...178) ), MultiWriteNode(185...198)( - MultiTargetNode(185...191)( - [LocalVariableTargetNode(185...188)(:foo, 0), - SplatNode(190...191)((190...191), nil)], - nil, - nil - ), + [LocalVariableTargetNode(185...188)(:foo, 0), + SplatNode(190...191)((190...191), nil)], + nil, + nil, (192...193), ArrayNode(194...198)( [IntegerNode(194...195)(), IntegerNode(197...198)()], @@ -134,12 +126,10 @@ ProgramNode(0...293)( ) ), MultiWriteNode(200...211)( - MultiTargetNode(200...204)( - [LocalVariableTargetNode(200...203)(:foo, 0), - SplatNode(203...204)((203...204), nil)], - nil, - nil - ), + [LocalVariableTargetNode(200...203)(:foo, 0), + SplatNode(203...204)((203...204), nil)], + nil, + nil, (205...206), ArrayNode(207...211)( [IntegerNode(207...208)(), IntegerNode(210...211)()], @@ -148,15 +138,13 @@ ProgramNode(0...293)( ) ), MultiWriteNode(213...229)( - MultiTargetNode(213...222)( - [LocalVariableTargetNode(213...216)(:foo, 0), - SplatNode(218...222)( - (218...219), - LocalVariableTargetNode(219...222)(:bar, 0) - )], - nil, - nil - ), + [LocalVariableTargetNode(213...216)(:foo, 0), + SplatNode(218...222)( + (218...219), + LocalVariableTargetNode(219...222)(:bar, 0) + )], + nil, + nil, (223...224), ArrayNode(225...229)( [IntegerNode(225...226)(), IntegerNode(228...229)()], @@ -165,17 +153,15 @@ ProgramNode(0...293)( ) ), MultiWriteNode(231...258)( - MultiTargetNode(231...246)( - [LocalVariableTargetNode(231...234)(:foo, 0), - MultiTargetNode(236...246)( - [LocalVariableTargetNode(237...240)(:bar, 0), - LocalVariableTargetNode(242...245)(:baz, 0)], - (236...237), - (245...246) - )], - nil, - nil - ), + [LocalVariableTargetNode(231...234)(:foo, 0), + MultiTargetNode(236...246)( + [LocalVariableTargetNode(237...240)(:bar, 0), + LocalVariableTargetNode(242...245)(:baz, 0)], + (236...237), + (245...246) + )], + nil, + nil, (247...248), ArrayNode(249...258)( [IntegerNode(249...250)(), diff --git a/test/yarp/snapshots/whitequark/and_or_masgn.txt b/test/yarp/snapshots/whitequark/and_or_masgn.txt index 9ba221facd..e34c3e19ee 100644 --- a/test/yarp/snapshots/whitequark/and_or_masgn.txt +++ b/test/yarp/snapshots/whitequark/and_or_masgn.txt @@ -6,12 +6,10 @@ ProgramNode(0...40)( ParenthesesNode(7...19)( StatementsNode(8...18)( [MultiWriteNode(8...18)( - MultiTargetNode(8...12)( - [LocalVariableTargetNode(8...9)(:a, 0), - LocalVariableTargetNode(11...12)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(8...9)(:a, 0), + LocalVariableTargetNode(11...12)(:b, 0)], + nil, + nil, (13...14), CallNode(15...18)( nil, @@ -36,12 +34,10 @@ ProgramNode(0...40)( ParenthesesNode(28...40)( StatementsNode(29...39)( [MultiWriteNode(29...39)( - MultiTargetNode(29...33)( - [LocalVariableTargetNode(29...30)(:a, 0), - LocalVariableTargetNode(32...33)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(29...30)(:a, 0), + LocalVariableTargetNode(32...33)(:b, 0)], + nil, + nil, (34...35), CallNode(36...39)( nil, diff --git a/test/yarp/snapshots/whitequark/cond_begin_masgn.txt b/test/yarp/snapshots/whitequark/cond_begin_masgn.txt index a84f7b5154..9a5e51bd10 100644 --- a/test/yarp/snapshots/whitequark/cond_begin_masgn.txt +++ b/test/yarp/snapshots/whitequark/cond_begin_masgn.txt @@ -7,12 +7,10 @@ ProgramNode(0...25)( StatementsNode(4...19)( [CallNode(4...7)(nil, nil, (4...7), nil, nil, nil, nil, 2, "bar"), MultiWriteNode(9...19)( - MultiTargetNode(9...13)( - [LocalVariableTargetNode(9...10)(:a, 0), - LocalVariableTargetNode(12...13)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(9...10)(:a, 0), + LocalVariableTargetNode(12...13)(:b, 0)], + nil, + nil, (14...15), CallNode(16...19)( nil, diff --git a/test/yarp/snapshots/whitequark/if_masgn__24.txt b/test/yarp/snapshots/whitequark/if_masgn__24.txt index b1ecd82868..1bdfd7bff6 100644 --- a/test/yarp/snapshots/whitequark/if_masgn__24.txt +++ b/test/yarp/snapshots/whitequark/if_masgn__24.txt @@ -6,12 +6,10 @@ ProgramNode(0...20)( ParenthesesNode(3...15)( StatementsNode(4...14)( [MultiWriteNode(4...14)( - MultiTargetNode(4...8)( - [LocalVariableTargetNode(4...5)(:a, 0), - LocalVariableTargetNode(7...8)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(4...5)(:a, 0), + LocalVariableTargetNode(7...8)(:b, 0)], + nil, + nil, (9...10), CallNode(11...14)( nil, diff --git a/test/yarp/snapshots/whitequark/masgn.txt b/test/yarp/snapshots/whitequark/masgn.txt index aee61e4791..419d68ee7b 100644 --- a/test/yarp/snapshots/whitequark/masgn.txt +++ b/test/yarp/snapshots/whitequark/masgn.txt @@ -2,12 +2,10 @@ ProgramNode(0...56)( [:foo, :bar, :baz], StatementsNode(0...56)( [MultiWriteNode(0...17)( - MultiTargetNode(0...10)( - [LocalVariableTargetNode(1...4)(:foo, 0), - LocalVariableTargetNode(6...9)(:bar, 0)], - (0...1), - (9...10) - ), + [LocalVariableTargetNode(1...4)(:foo, 0), + LocalVariableTargetNode(6...9)(:bar, 0)], + (0...1), + (9...10), (11...12), ArrayNode(13...17)( [IntegerNode(13...14)(), IntegerNode(16...17)()], @@ -16,12 +14,10 @@ ProgramNode(0...56)( ) ), MultiWriteNode(19...34)( - MultiTargetNode(19...27)( - [LocalVariableTargetNode(19...22)(:foo, 0), - LocalVariableTargetNode(24...27)(:bar, 0)], - nil, - nil - ), + [LocalVariableTargetNode(19...22)(:foo, 0), + LocalVariableTargetNode(24...27)(:bar, 0)], + nil, + nil, (28...29), ArrayNode(30...34)( [IntegerNode(30...31)(), IntegerNode(33...34)()], @@ -30,13 +26,11 @@ ProgramNode(0...56)( ) ), MultiWriteNode(36...56)( - MultiTargetNode(36...49)( - [LocalVariableTargetNode(36...39)(:foo, 0), - LocalVariableTargetNode(41...44)(:bar, 0), - LocalVariableTargetNode(46...49)(:baz, 0)], - nil, - nil - ), + [LocalVariableTargetNode(36...39)(:foo, 0), + LocalVariableTargetNode(41...44)(:bar, 0), + LocalVariableTargetNode(46...49)(:baz, 0)], + nil, + nil, (50...51), ArrayNode(52...56)( [IntegerNode(52...53)(), IntegerNode(55...56)()], diff --git a/test/yarp/snapshots/whitequark/masgn_attr.txt b/test/yarp/snapshots/whitequark/masgn_attr.txt index 0c8af75356..5ad893c96d 100644 --- a/test/yarp/snapshots/whitequark/masgn_attr.txt +++ b/test/yarp/snapshots/whitequark/masgn_attr.txt @@ -2,74 +2,68 @@ ProgramNode(0...63)( [:foo], StatementsNode(0...63)( [MultiWriteNode(0...17)( - MultiTargetNode(0...11)( - [CallNode(0...6)( - SelfNode(0...4)(), - (4...5), - (5...6), - nil, - nil, - nil, - nil, - 0, - "A=" - ), - LocalVariableTargetNode(8...11)(:foo, 0)], - nil, - nil - ), + [CallNode(0...6)( + SelfNode(0...4)(), + (4...5), + (5...6), + nil, + nil, + nil, + nil, + 0, + "A=" + ), + LocalVariableTargetNode(8...11)(:foo, 0)], + nil, + nil, (12...13), LocalVariableReadNode(14...17)(:foo, 0) ), MultiWriteNode(19...43)( - MultiTargetNode(19...37)( - [CallNode(19...25)( - SelfNode(19...23)(), - (23...24), - (24...25), - nil, - nil, - nil, - nil, - 0, - "a=" + [CallNode(19...25)( + SelfNode(19...23)(), + (23...24), + (24...25), + nil, + nil, + nil, + nil, + 0, + "a=" + ), + CallNode(27...37)( + SelfNode(27...31)(), + nil, + (31...37), + (31...32), + ArgumentsNode(32...36)( + [IntegerNode(32...33)(), IntegerNode(35...36)()] ), - CallNode(27...37)( - SelfNode(27...31)(), - nil, - (31...37), - (31...32), - ArgumentsNode(32...36)( - [IntegerNode(32...33)(), IntegerNode(35...36)()] - ), - (36...37), - nil, - 0, - "[]=" - )], - nil, - nil - ), + (36...37), + nil, + 0, + "[]=" + )], + nil, + nil, (38...39), LocalVariableReadNode(40...43)(:foo, 0) ), MultiWriteNode(45...63)( - MultiTargetNode(45...57)( - [CallNode(45...52)( - SelfNode(45...49)(), - (49...51), - (51...52), - nil, - nil, - nil, - nil, - 0, - "a=" - ), - LocalVariableTargetNode(54...57)(:foo, 0)], - nil, - nil - ), + [CallNode(45...52)( + SelfNode(45...49)(), + (49...51), + (51...52), + nil, + nil, + nil, + nil, + 0, + "a=" + ), + LocalVariableTargetNode(54...57)(:foo, 0)], + nil, + nil, (58...59), LocalVariableReadNode(60...63)(:foo, 0) )] diff --git a/test/yarp/snapshots/whitequark/masgn_cmd.txt b/test/yarp/snapshots/whitequark/masgn_cmd.txt index ab403e2f12..5b9b9b03ce 100644 --- a/test/yarp/snapshots/whitequark/masgn_cmd.txt +++ b/test/yarp/snapshots/whitequark/masgn_cmd.txt @@ -2,12 +2,10 @@ ProgramNode(0...16)( [:foo, :bar], StatementsNode(0...16)( [MultiWriteNode(0...16)( - MultiTargetNode(0...8)( - [LocalVariableTargetNode(0...3)(:foo, 0), - LocalVariableTargetNode(5...8)(:bar, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...3)(:foo, 0), + LocalVariableTargetNode(5...8)(:bar, 0)], + nil, + nil, (9...10), CallNode(11...16)( nil, diff --git a/test/yarp/snapshots/whitequark/masgn_const.txt b/test/yarp/snapshots/whitequark/masgn_const.txt index 8ed2ec62a0..8515552618 100644 --- a/test/yarp/snapshots/whitequark/masgn_const.txt +++ b/test/yarp/snapshots/whitequark/masgn_const.txt @@ -2,30 +2,26 @@ ProgramNode(0...34)( [:foo], StatementsNode(0...34)( [MultiWriteNode(0...14)( - MultiTargetNode(0...8)( - [ConstantPathTargetNode(0...3)( - nil, - ConstantReadNode(2...3)(:A), - (0...2) - ), - LocalVariableTargetNode(5...8)(:foo, 0)], - nil, - nil - ), + [ConstantPathTargetNode(0...3)( + nil, + ConstantReadNode(2...3)(:A), + (0...2) + ), + LocalVariableTargetNode(5...8)(:foo, 0)], + nil, + nil, (9...10), LocalVariableReadNode(11...14)(:foo, 0) ), MultiWriteNode(16...34)( - MultiTargetNode(16...28)( - [ConstantPathTargetNode(16...23)( - SelfNode(16...20)(), - ConstantReadNode(22...23)(:A), - (20...22) - ), - LocalVariableTargetNode(25...28)(:foo, 0)], - nil, - nil - ), + [ConstantPathTargetNode(16...23)( + SelfNode(16...20)(), + ConstantReadNode(22...23)(:A), + (20...22) + ), + LocalVariableTargetNode(25...28)(:foo, 0)], + nil, + nil, (29...30), LocalVariableReadNode(31...34)(:foo, 0) )] diff --git a/test/yarp/snapshots/whitequark/masgn_nested.txt b/test/yarp/snapshots/whitequark/masgn_nested.txt index 3dd9fd696a..00f4eb1ef4 100644 --- a/test/yarp/snapshots/whitequark/masgn_nested.txt +++ b/test/yarp/snapshots/whitequark/masgn_nested.txt @@ -2,31 +2,27 @@ ProgramNode(1...30)( [:b, :a, :c], StatementsNode(1...30)( [MultiWriteNode(1...13)( - MultiTargetNode(1...6)( - [MultiTargetNode(1...6)( - [LocalVariableTargetNode(2...3)(:b, 0), - SplatNode(3...4)((3...4), nil)], - (1...2), - (5...6) - )], - nil, - nil - ), + [MultiTargetNode(1...6)( + [LocalVariableTargetNode(2...3)(:b, 0), + SplatNode(3...4)((3...4), nil)], + (1...2), + (5...6) + )], + nil, + nil, (8...9), CallNode(10...13)(nil, nil, (10...13), nil, nil, nil, nil, 2, "foo") ), MultiWriteNode(15...30)( - MultiTargetNode(15...24)( - [LocalVariableTargetNode(15...16)(:a, 0), - MultiTargetNode(18...24)( - [LocalVariableTargetNode(19...20)(:b, 0), - LocalVariableTargetNode(22...23)(:c, 0)], - (18...19), - (23...24) - )], - nil, - nil - ), + [LocalVariableTargetNode(15...16)(:a, 0), + MultiTargetNode(18...24)( + [LocalVariableTargetNode(19...20)(:b, 0), + LocalVariableTargetNode(22...23)(:c, 0)], + (18...19), + (23...24) + )], + nil, + nil, (25...26), CallNode(27...30)(nil, nil, (27...30), nil, nil, nil, nil, 2, "foo") )] diff --git a/test/yarp/snapshots/whitequark/masgn_splat.txt b/test/yarp/snapshots/whitequark/masgn_splat.txt index f7a2050506..c6cbe9ee70 100644 --- a/test/yarp/snapshots/whitequark/masgn_splat.txt +++ b/test/yarp/snapshots/whitequark/masgn_splat.txt @@ -2,61 +2,51 @@ ProgramNode(0...139)( [:c, :d, :b, :a], StatementsNode(0...139)( [MultiWriteNode(0...7)( - MultiTargetNode(0...1)([SplatNode(0...1)((0...1), nil)], nil, nil), + [SplatNode(0...1)((0...1), nil)], + nil, + nil, (2...3), CallNode(4...7)(nil, nil, (4...7), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(9...22)( - MultiTargetNode(9...16)( - [MultiTargetNode(9...10)( - [SplatNode(9...10)((9...10), nil)], - nil, - nil - ), - LocalVariableTargetNode(12...13)(:c, 0), - LocalVariableTargetNode(15...16)(:d, 0)], - nil, - nil - ), + [MultiTargetNode(9...10)([SplatNode(9...10)((9...10), nil)], nil, nil), + LocalVariableTargetNode(12...13)(:c, 0), + LocalVariableTargetNode(15...16)(:d, 0)], + nil, + nil, (17...18), CallNode(19...22)(nil, nil, (19...22), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(24...32)( - MultiTargetNode(24...26)( - [SplatNode(24...26)( - (24...25), - LocalVariableTargetNode(25...26)(:b, 0) - )], - nil, - nil - ), + [SplatNode(24...26)( + (24...25), + LocalVariableTargetNode(25...26)(:b, 0) + )], + nil, + nil, (27...28), CallNode(29...32)(nil, nil, (29...32), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(34...45)( - MultiTargetNode(34...39)( - [MultiTargetNode(34...36)( - [SplatNode(34...36)( - (34...35), - LocalVariableTargetNode(35...36)(:b, 0) - )], - nil, - nil - ), - LocalVariableTargetNode(38...39)(:c, 0)], - nil, - nil - ), + [MultiTargetNode(34...36)( + [SplatNode(34...36)( + (34...35), + LocalVariableTargetNode(35...36)(:b, 0) + )], + nil, + nil + ), + LocalVariableTargetNode(38...39)(:c, 0)], + nil, + nil, (40...41), CallNode(42...45)(nil, nil, (42...45), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(47...65)( - MultiTargetNode(47...58)( - [InstanceVariableTargetNode(47...51)(:@foo), - ClassVariableTargetNode(53...58)(:@@bar)], - nil, - nil - ), + [InstanceVariableTargetNode(47...51)(:@foo), + ClassVariableTargetNode(53...58)(:@@bar)], + nil, + nil, (59...60), ArrayNode(61...65)( [SplatNode(61...65)( @@ -78,60 +68,50 @@ ProgramNode(0...139)( ) ), MultiWriteNode(67...77)( - MultiTargetNode(67...71)( - [LocalVariableTargetNode(67...68)(:a, 0), - SplatNode(70...71)((70...71), nil)], - nil, - nil - ), + [LocalVariableTargetNode(67...68)(:a, 0), + SplatNode(70...71)((70...71), nil)], + nil, + nil, (72...73), CallNode(74...77)(nil, nil, (74...77), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(79...92)( - MultiTargetNode(79...86)( - [LocalVariableTargetNode(79...80)(:a, 0), - SplatNode(82...83)((82...83), nil), - LocalVariableTargetNode(85...86)(:c, 0)], - nil, - nil - ), + [LocalVariableTargetNode(79...80)(:a, 0), + SplatNode(82...83)((82...83), nil), + LocalVariableTargetNode(85...86)(:c, 0)], + nil, + nil, (87...88), CallNode(89...92)(nil, nil, (89...92), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(94...105)( - MultiTargetNode(94...99)( - [LocalVariableTargetNode(94...95)(:a, 0), - SplatNode(97...99)( - (97...98), - LocalVariableTargetNode(98...99)(:b, 0) - )], - nil, - nil - ), + [LocalVariableTargetNode(94...95)(:a, 0), + SplatNode(97...99)( + (97...98), + LocalVariableTargetNode(98...99)(:b, 0) + )], + nil, + nil, (100...101), CallNode(102...105)(nil, nil, (102...105), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(107...121)( - MultiTargetNode(107...115)( - [LocalVariableTargetNode(107...108)(:a, 0), - SplatNode(110...112)( - (110...111), - LocalVariableTargetNode(111...112)(:b, 0) - ), - LocalVariableTargetNode(114...115)(:c, 0)], - nil, - nil - ), + [LocalVariableTargetNode(107...108)(:a, 0), + SplatNode(110...112)( + (110...111), + LocalVariableTargetNode(111...112)(:b, 0) + ), + LocalVariableTargetNode(114...115)(:c, 0)], + nil, + nil, (116...117), CallNode(118...121)(nil, nil, (118...121), nil, nil, nil, nil, 2, "bar") ), MultiWriteNode(123...139)( - MultiTargetNode(123...127)( - [LocalVariableTargetNode(123...124)(:a, 0), - LocalVariableTargetNode(126...127)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(123...124)(:a, 0), + LocalVariableTargetNode(126...127)(:b, 0)], + nil, + nil, (128...129), ArrayNode(130...139)( [SplatNode(130...134)( diff --git a/test/yarp/snapshots/whitequark/not_masgn__24.txt b/test/yarp/snapshots/whitequark/not_masgn__24.txt index 5233c25ba5..c208968263 100644 --- a/test/yarp/snapshots/whitequark/not_masgn__24.txt +++ b/test/yarp/snapshots/whitequark/not_masgn__24.txt @@ -5,12 +5,10 @@ ProgramNode(0...13)( ParenthesesNode(1...13)( StatementsNode(2...12)( [MultiWriteNode(2...12)( - MultiTargetNode(2...6)( - [LocalVariableTargetNode(2...3)(:a, 0), - LocalVariableTargetNode(5...6)(:b, 0)], - nil, - nil - ), + [LocalVariableTargetNode(2...3)(:a, 0), + LocalVariableTargetNode(5...6)(:b, 0)], + nil, + nil, (7...8), CallNode(9...12)( nil, diff --git a/test/yarp/snapshots/whitequark/rescue_mod_masgn.txt b/test/yarp/snapshots/whitequark/rescue_mod_masgn.txt index 990312e365..82b1220cd7 100644 --- a/test/yarp/snapshots/whitequark/rescue_mod_masgn.txt +++ b/test/yarp/snapshots/whitequark/rescue_mod_masgn.txt @@ -2,12 +2,10 @@ ProgramNode(0...29)( [:foo, :bar], StatementsNode(0...29)( [MultiWriteNode(0...29)( - MultiTargetNode(0...8)( - [LocalVariableTargetNode(0...3)(:foo, 0), - LocalVariableTargetNode(5...8)(:bar, 0)], - nil, - nil - ), + [LocalVariableTargetNode(0...3)(:foo, 0), + LocalVariableTargetNode(5...8)(:bar, 0)], + nil, + nil, (9...10), RescueModifierNode(11...29)( CallNode(11...15)(nil, nil, (11...15), nil, nil, nil, nil, 2, "meth"), diff --git a/yarp/config.yml b/yarp/config.yml index 3161006bf3..e63c2bb802 100644 --- a/yarp/config.yml +++ b/yarp/config.yml @@ -1766,9 +1766,12 @@ nodes: ^^^^^^^ - name: MultiWriteNode fields: - - name: target - type: node - kind: MultiTargetNode + - name: targets + type: node[] + - name: lparen_loc + type: location? + - name: rparen_loc + type: location? - name: operator_loc type: location - name: value diff --git a/yarp/yarp.c b/yarp/yarp.c index 7c1df2343d..820361e25a 100644 --- a/yarp/yarp.c +++ b/yarp/yarp.c @@ -3365,11 +3365,17 @@ yp_multi_write_node_create(yp_parser_t *parser, yp_multi_target_node_t *target, .end = value->location.end } }, - .target = target, + .targets = target->targets, + .lparen_loc = target->lparen_loc, + .rparen_loc = target->rparen_loc, .operator_loc = YP_LOCATION_TOKEN_VALUE(operator), .value = value }; + // Explicitly do not call yp_node_destroy here because we want to keep + // around all of the information within the MultiWriteNode node. + free(target); + return node; } |