Skip to content

Commit

Permalink
[ruby/yarp] Flatten CallAndWriteNode, CallOrWriteNode, and CallOperat…
Browse files Browse the repository at this point in the history
…orWriteNode

ruby/prism@8f26ffa0b2
  • Loading branch information
kddnewton authored and matzbot committed Sep 5, 2023
1 parent 95e4bdc commit 767f984
Show file tree
Hide file tree
Showing 21 changed files with 766 additions and 772 deletions.
12 changes: 6 additions & 6 deletions test/yarp/location_test.rb
Expand Up @@ -172,19 +172,19 @@ def test_CallNode
assert_location(CallNode, "foo bar('baz')")
end

def test_CallOperatorAndWriteNode
assert_location(CallOperatorAndWriteNode, "foo.foo &&= bar")
assert_location(CallOperatorAndWriteNode, "foo[foo] &&= bar")
def test_CallAndWriteNode
assert_location(CallAndWriteNode, "foo.foo &&= bar")
assert_location(CallAndWriteNode, "foo[foo] &&= bar")
end

def test_CallOperatorWriteNode
assert_location(CallOperatorWriteNode, "foo.foo += bar")
assert_location(CallOperatorWriteNode, "foo[foo] += bar")
end

def test_CallOperatorOrWriteNode
assert_location(CallOperatorOrWriteNode, "foo.foo ||= bar")
assert_location(CallOperatorOrWriteNode, "foo[foo] ||= bar")
def test_CallOrWriteNode
assert_location(CallOrWriteNode, "foo.foo ||= bar")
assert_location(CallOrWriteNode, "foo[foo] ||= bar")
end

def test_CapturePatternNode
Expand Down
24 changes: 11 additions & 13 deletions test/yarp/snapshots/seattlerb/index_0_opasgn.txt
Expand Up @@ -2,20 +2,18 @@ ProgramNode(0...8)(
[],
StatementsNode(0...8)(
[CallOperatorWriteNode(0...8)(
CallNode(0...3)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
nil,
(1...3),
(1...2),
nil,
(2...3),
nil,
0,
"[]="
),
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
nil,
(1...3),
(1...2),
nil,
(2...3),
0,
"[]",
"[]=",
:+,
(4...6),
CallNode(7...8)(nil, nil, (7...8), nil, nil, nil, nil, 2, "b"),
:+
CallNode(7...8)(nil, nil, (7...8), nil, nil, nil, nil, 2, "b")
)]
)
)
26 changes: 12 additions & 14 deletions test/yarp/snapshots/seattlerb/op_asgn_dot_ident_command_call.txt
@@ -1,18 +1,17 @@
ProgramNode(0...11)(
[],
StatementsNode(0...11)(
[CallOperatorOrWriteNode(0...11)(
CallNode(0...3)(
ConstantReadNode(0...1)(),
(1...2),
(2...3),
nil,
nil,
nil,
nil,
0,
"B="
),
[CallOrWriteNode(0...11)(
ConstantReadNode(0...1)(),
(1...2),
(2...3),
nil,
nil,
nil,
0,
"B",
"B=",
(4...7),
CallNode(8...11)(
nil,
nil,
Expand All @@ -23,8 +22,7 @@ ProgramNode(0...11)(
nil,
0,
"c"
),
(4...7)
)
)]
)
)
26 changes: 12 additions & 14 deletions test/yarp/snapshots/seattlerb/op_asgn_index_command_call.txt
@@ -1,18 +1,17 @@
ProgramNode(0...16)(
[],
StatementsNode(0...16)(
[CallOperatorOrWriteNode(0...16)(
CallNode(0...5)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
nil,
(1...5),
(1...2),
ArgumentsNode(2...4)([SymbolNode(2...4)((2...3), (3...4), nil, "b")]),
(4...5),
nil,
0,
"[]="
),
[CallOrWriteNode(0...16)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
nil,
(1...5),
(1...2),
ArgumentsNode(2...4)([SymbolNode(2...4)((2...3), (3...4), nil, "b")]),
(4...5),
0,
"[]",
"[]=",
(6...9),
CallNode(10...16)(
nil,
nil,
Expand All @@ -25,8 +24,7 @@ ProgramNode(0...16)(
nil,
0,
"c"
),
(6...9)
)
)]
)
)
24 changes: 11 additions & 13 deletions test/yarp/snapshots/seattlerb/op_asgn_primary_colon_identifier1.txt
Expand Up @@ -2,20 +2,18 @@ ProgramNode(0...9)(
[],
StatementsNode(0...9)(
[CallOperatorWriteNode(0...9)(
CallNode(0...4)(
ConstantReadNode(0...1)(),
(1...3),
(3...4),
nil,
nil,
nil,
nil,
0,
"b="
),
ConstantReadNode(0...1)(),
(1...3),
(3...4),
nil,
nil,
nil,
0,
"b",
"b=",
:+,
(5...7),
IntegerNode(8...9)(),
:+
IntegerNode(8...9)()
)]
)
)
Expand Up @@ -2,17 +2,16 @@ ProgramNode(0...11)(
[],
StatementsNode(0...11)(
[CallOperatorWriteNode(0...11)(
CallNode(0...4)(
ConstantReadNode(0...1)(),
(1...3),
(3...4),
nil,
nil,
nil,
nil,
0,
"b="
),
ConstantReadNode(0...1)(),
(1...3),
(3...4),
nil,
nil,
nil,
0,
"b",
"b=",
:*,
(5...7),
CallNode(8...11)(
nil,
Expand All @@ -26,8 +25,7 @@ ProgramNode(0...11)(
nil,
0,
"c"
),
:*
)
)]
)
)
@@ -1,18 +1,17 @@
ProgramNode(0...11)(
[],
StatementsNode(0...11)(
[CallOperatorOrWriteNode(0...11)(
CallNode(0...3)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
(1...2),
(2...3),
nil,
nil,
nil,
nil,
0,
"b="
),
[CallOrWriteNode(0...11)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
(1...2),
(2...3),
nil,
nil,
nil,
0,
"b",
"b=",
(4...7),
CallNode(8...11)(
nil,
nil,
Expand All @@ -23,8 +22,7 @@ ProgramNode(0...11)(
nil,
0,
"c"
),
(4...7)
)
)]
)
)
24 changes: 11 additions & 13 deletions test/yarp/snapshots/seattlerb/safe_op_asgn.txt
Expand Up @@ -2,17 +2,16 @@ ProgramNode(0...11)(
[],
StatementsNode(0...11)(
[CallOperatorWriteNode(0...11)(
CallNode(0...4)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
(1...3),
(3...4),
nil,
nil,
nil,
nil,
1,
"b="
),
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
(1...3),
(3...4),
nil,
nil,
nil,
1,
"b",
"b=",
:+,
(5...7),
CallNode(8...11)(
nil,
Expand All @@ -24,8 +23,7 @@ ProgramNode(0...11)(
nil,
0,
"x"
),
:+
)
)]
)
)
26 changes: 12 additions & 14 deletions test/yarp/snapshots/seattlerb/safe_op_asgn2.txt
@@ -1,20 +1,18 @@
ProgramNode(0...10)(
[],
StatementsNode(0...10)(
[CallOperatorOrWriteNode(0...10)(
CallNode(0...4)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
(1...3),
(3...4),
nil,
nil,
nil,
nil,
1,
"b="
),
CallNode(9...10)(nil, nil, (9...10), nil, nil, nil, nil, 2, "x"),
(5...8)
[CallOrWriteNode(0...10)(
CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"),
(1...3),
(3...4),
nil,
nil,
nil,
1,
"b",
"b=",
(5...8),
CallNode(9...10)(nil, nil, (9...10), nil, nil, nil, nil, 2, "x")
)]
)
)

0 comments on commit 767f984

Please sign in to comment.