Skip to content

Commit 285cb98

Browse files
committed
Don't use ArrayAppendOneNodeGen in YARPTranslator
1 parent d350380 commit 285cb98

File tree

7 files changed

+248
-308
lines changed

7 files changed

+248
-308
lines changed

spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_argument.yaml

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ subject: "Break"
22
description: "with splat operator and following argument (break *a, b)"
33
notes: >
44
Arguments are represented with combination of:
5-
- ArrayAppendOneNodeGen
65
- ArrayConcatNode
76
- SplatCastNodeGen
87
- ArrayLiteralNode$UninitialisedArrayLiteralNode
98
nodes
9+
yarp_specific: true # Simplified AST and replaced ArrayAppendOneNodeGen by concatenating with array of one element
1010
focused_on_node: "org.truffleruby.language.control.BreakNode"
1111
ruby: |
1212
while true
@@ -20,45 +20,47 @@ ast: |
2020
ignoreMarker = true
2121
children:
2222
child =
23-
ArrayAppendOneNodeGen
23+
ArrayConcatNode
2424
attributes:
2525
flags = 0
2626
children:
27-
arrayNode_ =
28-
KernelNodesFactory$DupASTNodeFactory$DupASTNodeGen
27+
children = [
28+
SplatCastNodeGen
2929
attributes:
30+
conversionMethod = :to_a
31+
copy = true
3032
flags = 0
33+
nilBehavior = CONVERT
3134
children:
32-
selfNode_ =
33-
SplatCastNodeGen
35+
childNode_ =
36+
RubyCallNode
3437
attributes:
35-
conversionMethod = :to_a
36-
copy = true
38+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
39+
dispatchConfig = PRIVATE
40+
emptyKeywordsProfile = false
3741
flags = 0
38-
nilBehavior = CONVERT
42+
isAttrAssign = false
43+
isSafeNavigation = false
44+
isSplatted = false
45+
isVCall = true
46+
lastArgIsNotHashProfile = false
47+
methodName = "foo"
48+
notEmptyKeywordsProfile = false
49+
notRuby2KeywordsHashProfile = false
3950
children:
40-
childNode_ =
41-
RubyCallNode
51+
receiver =
52+
SelfNode
4253
attributes:
43-
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
44-
dispatchConfig = PRIVATE
45-
emptyKeywordsProfile = false
4654
flags = 0
47-
isAttrAssign = false
48-
isSafeNavigation = false
49-
isSplatted = false
50-
isVCall = true
51-
lastArgIsNotHashProfile = false
52-
methodName = "foo"
53-
notEmptyKeywordsProfile = false
54-
notRuby2KeywordsHashProfile = false
55-
children:
56-
receiver =
57-
SelfNode
58-
attributes:
59-
flags = 0
60-
valueNode_ =
61-
IntegerFixnumLiteralNode
55+
ArrayLiteralNode$UninitialisedArrayLiteralNode
6256
attributes:
6357
flags = 0
64-
value = 42
58+
language = org.truffleruby.RubyLanguage@...
59+
children:
60+
values = [
61+
IntegerFixnumLiteralNode
62+
attributes:
63+
flags = 0
64+
value = 42
65+
]
66+
]

spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_element.yaml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ subject: "case expression"
22
description: "with expression to match / and splat operator with following element (case exp when *a, b ... end)"
33
notes: >
44
Splat operator is handled with `Truffle::Internal.when_splat` method implemented in Ruby
5+
yarp_specific: true # Simplified AST and replaced ArrayAppendOneNodeGen by concatenating with array of one element
56
focused_on_node: "org.truffleruby.language.control.IfElseNode"
67
ruby: |
78
case 42
@@ -30,48 +31,50 @@ ast: |
3031
notRuby2KeywordsHashProfile = false
3132
children:
3233
arguments = [
33-
ArrayAppendOneNodeGen
34+
ArrayConcatNode
3435
attributes:
3536
flags = 0
3637
children:
37-
arrayNode_ =
38-
KernelNodesFactory$DupASTNodeFactory$DupASTNodeGen
38+
children = [
39+
SplatCastNodeGen
3940
attributes:
41+
conversionMethod = :to_a
42+
copy = true
4043
flags = 0
44+
nilBehavior = CONVERT
4145
children:
42-
selfNode_ =
43-
SplatCastNodeGen
46+
childNode_ =
47+
RubyCallNode
4448
attributes:
45-
conversionMethod = :to_a
46-
copy = true
49+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
50+
dispatchConfig = PRIVATE
51+
emptyKeywordsProfile = false
4752
flags = 0
48-
nilBehavior = CONVERT
53+
isAttrAssign = false
54+
isSafeNavigation = false
55+
isSplatted = false
56+
isVCall = true
57+
lastArgIsNotHashProfile = false
58+
methodName = "foo"
59+
notEmptyKeywordsProfile = false
60+
notRuby2KeywordsHashProfile = false
4961
children:
50-
childNode_ =
51-
RubyCallNode
62+
receiver =
63+
SelfNode
5264
attributes:
53-
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
54-
dispatchConfig = PRIVATE
55-
emptyKeywordsProfile = false
5665
flags = 0
57-
isAttrAssign = false
58-
isSafeNavigation = false
59-
isSplatted = false
60-
isVCall = true
61-
lastArgIsNotHashProfile = false
62-
methodName = "foo"
63-
notEmptyKeywordsProfile = false
64-
notRuby2KeywordsHashProfile = false
65-
children:
66-
receiver =
67-
SelfNode
68-
attributes:
69-
flags = 0
70-
valueNode_ =
71-
IntegerFixnumLiteralNode
66+
ArrayLiteralNode$UninitialisedArrayLiteralNode
7267
attributes:
7368
flags = 0
74-
value = 42
69+
language = org.truffleruby.RubyLanguage@...
70+
children:
71+
values = [
72+
IntegerFixnumLiteralNode
73+
attributes:
74+
flags = 0
75+
value = 42
76+
]
77+
]
7578
ReadLocalVariableNode
7679
attributes:
7780
flags = 0

spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_element.yaml

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ subject: "case expression"
22
description: "with expression to match / and splat operator with preceding and following element (case exp when a, *b, c ... end)"
33
notes: >
44
Splat operator is handled with `Truffle::Internal.when_splat` method implemented in Ruby
5+
yarp_specific: true # Simplified AST and replaced ArrayAppendOneNodeGen by concatenating with array of one element
56
focused_on_node: "org.truffleruby.language.control.IfElseNode"
67
ruby: |
78
case 42
@@ -30,65 +31,61 @@ ast: |
3031
notRuby2KeywordsHashProfile = false
3132
children:
3233
arguments = [
33-
ArrayAppendOneNodeGen
34+
ArrayConcatNode
3435
attributes:
3536
flags = 0
3637
children:
37-
arrayNode_ =
38-
KernelNodesFactory$DupASTNodeFactory$DupASTNodeGen
38+
children = [
39+
ArrayLiteralNode$UninitialisedArrayLiteralNode
3940
attributes:
4041
flags = 0
42+
language = org.truffleruby.RubyLanguage@...
4143
children:
42-
selfNode_ =
43-
ArrayConcatNode
44+
values = [
45+
IntegerFixnumLiteralNode
4446
attributes:
4547
flags = 0
48+
value = 42
49+
]
50+
SplatCastNodeGen
51+
attributes:
52+
conversionMethod = :to_a
53+
copy = true
54+
flags = 0
55+
nilBehavior = CONVERT
56+
children:
57+
childNode_ =
58+
RubyCallNode
59+
attributes:
60+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
61+
dispatchConfig = PRIVATE
62+
emptyKeywordsProfile = false
63+
flags = 0
64+
isAttrAssign = false
65+
isSafeNavigation = false
66+
isSplatted = false
67+
isVCall = true
68+
lastArgIsNotHashProfile = false
69+
methodName = "foo"
70+
notEmptyKeywordsProfile = false
71+
notRuby2KeywordsHashProfile = false
4672
children:
47-
children = [
48-
ArrayLiteralNode$UninitialisedArrayLiteralNode
73+
receiver =
74+
SelfNode
4975
attributes:
5076
flags = 0
51-
language = org.truffleruby.RubyLanguage@...
52-
children:
53-
values = [
54-
IntegerFixnumLiteralNode
55-
attributes:
56-
flags = 0
57-
value = 42
58-
]
59-
SplatCastNodeGen
60-
attributes:
61-
conversionMethod = :to_a
62-
copy = true
63-
flags = 0
64-
nilBehavior = CONVERT
65-
children:
66-
childNode_ =
67-
RubyCallNode
68-
attributes:
69-
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
70-
dispatchConfig = PRIVATE
71-
emptyKeywordsProfile = false
72-
flags = 0
73-
isAttrAssign = false
74-
isSafeNavigation = false
75-
isSplatted = false
76-
isVCall = true
77-
lastArgIsNotHashProfile = false
78-
methodName = "foo"
79-
notEmptyKeywordsProfile = false
80-
notRuby2KeywordsHashProfile = false
81-
children:
82-
receiver =
83-
SelfNode
84-
attributes:
85-
flags = 0
86-
]
87-
valueNode_ =
88-
IntegerFixnumLiteralNode
77+
ArrayLiteralNode$UninitialisedArrayLiteralNode
8978
attributes:
9079
flags = 0
91-
value = 100500
80+
language = org.truffleruby.RubyLanguage@...
81+
children:
82+
values = [
83+
IntegerFixnumLiteralNode
84+
attributes:
85+
flags = 0
86+
value = 100500
87+
]
88+
]
9289
ReadLocalVariableNode
9390
attributes:
9491
flags = 0

0 commit comments

Comments
 (0)