Skip to content

Commit f5af73a

Browse files
committed
Translate nodes - multi-assignment
1 parent 0b25e79 commit f5af73a

18 files changed

+1177
-47
lines changed

spec/tags/truffle/parsing/parsing_tags.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,6 @@ fails:Parsing a Match (=~ operator) case is parsed correctly
138138
fails:Parsing a Match (=~ operator/with Regexp literal as a RHS) case is parsed correctly
139139
fails:Parsing a Match (=~ operator/with Regexp literal as a LHS (without named capture groups)) case is parsed correctly
140140
fails:Parsing a Match (=~ operator/with Regexp literal as a LHS without interpolation and with named capture groups) case is parsed correctly
141-
fails:Parsing a Multi-assignment (When assigning class variables) case is parsed correctly
142-
fails:Parsing a Multi-assignment (When assigning constants) case is parsed correctly
143-
fails:Parsing a Multi-assignment (When assigning global variables) case is parsed correctly
144-
fails:Parsing a Multi-assignment (When assigning instance variables) case is parsed correctly
145-
fails:Parsing a Multi-assignment (When assigning local variables) case is parsed correctly
146-
fails:Parsing a Multi-assignment (When there is an attribute on the LHS) case is parsed correctly
147-
fails:Parsing a Multi-assignment (When RHS is a list of multiple values) case is parsed correctly
148-
fails:Parsing a Multi-assignment (When nested multi assignment (a, (b, c), d = ...)) case is parsed correctly
149-
fails:Parsing a Multi-assignment (When RHS is a single value) case is parsed correctly
150-
fails:Parsing a Multi-assignment (When splat operator/in the beginning of the LHS (*array, a = ...)) case is parsed correctly
151-
fails:Parsing a Multi-assignment (When splat operator/in the end of the LHS (a, b, *array = ...)) case is parsed correctly
152-
fails:Parsing a Multi-assignment (When splat operator/in the middle of the LHS (a, *array, b = ...)) case is parsed correctly
153-
fails:Parsing a Multi-assignment (When splat operator/without other variables in the LHS (*a = ...)) case is parsed correctly
154-
fails:Parsing a Multi-assignment (When splat operator/without variable in the LHS (a, *, c = ...)) case is parsed correctly
155141
fails:Parsing a Parentheses operator (empty) case is parsed correctly
156142
fails:Parsing a Parentheses operator (with multiple expressions, e.g. (1; 2; 3)) case is parsed correctly
157143
fails:Parsing a Parentheses operator (with single expression) case is parsed correctly
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
subject: "Multi-assignment"
2+
description: "When nested multi assignment / attribute"
3+
notes: >
4+
yarp_specific: true # generate explicit NilLiteralNode (isImplicit = false)
5+
focused_on_node: "org.truffleruby.core.array.MultipleAssignmentNode"
6+
ruby: |
7+
(a.attribute, b), c = []
8+
ast: |
9+
MultipleAssignmentNode
10+
attributes:
11+
flags = 1
12+
children:
13+
preNodes = [
14+
MultipleAssignmentNode
15+
attributes:
16+
flags = 0
17+
children:
18+
preNodes = [
19+
RubyCallNode
20+
attributes:
21+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
22+
dispatchConfig = PROTECTED
23+
emptyKeywordsProfile = false
24+
flags = 0
25+
isAttrAssign = true
26+
isSafeNavigation = false
27+
isSplatted = false
28+
isVCall = false
29+
lastArgIsNotHashProfile = false
30+
methodName = "attribute="
31+
notEmptyKeywordsProfile = false
32+
notRuby2KeywordsHashProfile = false
33+
children:
34+
arguments = [
35+
NilLiteralNode
36+
attributes:
37+
flags = 0
38+
isImplicit = false
39+
]
40+
receiver =
41+
RubyCallNode
42+
attributes:
43+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
44+
dispatchConfig = PRIVATE
45+
emptyKeywordsProfile = false
46+
flags = 0
47+
isAttrAssign = false
48+
isSafeNavigation = false
49+
isSplatted = false
50+
isVCall = true
51+
lastArgIsNotHashProfile = false
52+
methodName = "a"
53+
notEmptyKeywordsProfile = false
54+
notRuby2KeywordsHashProfile = false
55+
children:
56+
receiver =
57+
SelfNode
58+
attributes:
59+
flags = 0
60+
WriteFrameSlotNodeGen
61+
attributes:
62+
frameSlot = 2
63+
]
64+
splatCastNode =
65+
SplatCastNodeGen
66+
attributes:
67+
conversionMethod = :to_ary
68+
copy = true
69+
flags = 0
70+
nilBehavior = ARRAY_WITH_NIL
71+
WriteFrameSlotNodeGen
72+
attributes:
73+
frameSlot = 3
74+
]
75+
rhsNode =
76+
ArrayLiteralNode$UninitialisedArrayLiteralNode
77+
attributes:
78+
flags = 0
79+
language = org.truffleruby.RubyLanguage@...
80+
splatCastNode =
81+
SplatCastNodeGen
82+
attributes:
83+
conversionMethod = :to_ary
84+
copy = true
85+
flags = 0
86+
nilBehavior = ARRAY_WITH_NIL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
subject: "Multi-assignment"
2+
description: "When nested multi assignment / nested element reference (a[0][:key], b = foo)"
3+
notes: >
4+
yarp_specific: true # generate explicit NilLiteralNode (isImplicit = false)
5+
focused_on_node: "org.truffleruby.core.array.MultipleAssignmentNode"
6+
ruby: |
7+
(a[0][:key], b), c = []
8+
ast: |
9+
MultipleAssignmentNode
10+
attributes:
11+
flags = 1
12+
children:
13+
preNodes = [
14+
MultipleAssignmentNode
15+
attributes:
16+
flags = 0
17+
children:
18+
preNodes = [
19+
InlinedIndexSetNodeGen
20+
attributes:
21+
assumptions = [Assumption(valid, name=set_trace_func is not used)]
22+
flags = 0
23+
parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@...
24+
children:
25+
operand1Node_ =
26+
ObjectLiteralNode
27+
attributes:
28+
flags = 0
29+
object = :key
30+
operand2Node_ =
31+
NilLiteralNode
32+
attributes:
33+
flags = 0
34+
isImplicit = false
35+
receiver_ =
36+
InlinedIndexGetNodeGen
37+
attributes:
38+
assumptions = [Assumption(valid, name=set_trace_func is not used)]
39+
flags = 0
40+
parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@...
41+
children:
42+
leftNode_ =
43+
RubyCallNode
44+
attributes:
45+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
46+
dispatchConfig = PRIVATE
47+
emptyKeywordsProfile = false
48+
flags = 0
49+
isAttrAssign = false
50+
isSafeNavigation = false
51+
isSplatted = false
52+
isVCall = true
53+
lastArgIsNotHashProfile = false
54+
methodName = "a"
55+
notEmptyKeywordsProfile = false
56+
notRuby2KeywordsHashProfile = false
57+
children:
58+
receiver =
59+
SelfNode
60+
attributes:
61+
flags = 0
62+
rightNode_ =
63+
IntegerFixnumLiteralNode
64+
attributes:
65+
flags = 0
66+
value = 0
67+
WriteFrameSlotNodeGen
68+
attributes:
69+
frameSlot = 2
70+
]
71+
splatCastNode =
72+
SplatCastNodeGen
73+
attributes:
74+
conversionMethod = :to_ary
75+
copy = true
76+
flags = 0
77+
nilBehavior = ARRAY_WITH_NIL
78+
WriteFrameSlotNodeGen
79+
attributes:
80+
frameSlot = 3
81+
]
82+
rhsNode =
83+
ArrayLiteralNode$UninitialisedArrayLiteralNode
84+
attributes:
85+
flags = 0
86+
language = org.truffleruby.RubyLanguage@...
87+
splatCastNode =
88+
SplatCastNodeGen
89+
attributes:
90+
conversionMethod = :to_ary
91+
copy = true
92+
flags = 0
93+
nilBehavior = ARRAY_WITH_NIL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
subject: "Multi-assignment"
2+
description: "When nested multi assignment / element reference (a[:key], b = foo)"
3+
notes: >
4+
yarp_specific: true # generate explicit NilLiteralNode (isImplicit = false)
5+
focused_on_node: "org.truffleruby.core.array.MultipleAssignmentNode"
6+
ruby: |
7+
(a[:key], b), c = []
8+
ast: |
9+
MultipleAssignmentNode
10+
attributes:
11+
flags = 1
12+
children:
13+
preNodes = [
14+
MultipleAssignmentNode
15+
attributes:
16+
flags = 0
17+
children:
18+
preNodes = [
19+
InlinedIndexSetNodeGen
20+
attributes:
21+
assumptions = [Assumption(valid, name=set_trace_func is not used)]
22+
flags = 0
23+
parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@...
24+
children:
25+
operand1Node_ =
26+
ObjectLiteralNode
27+
attributes:
28+
flags = 0
29+
object = :key
30+
operand2Node_ =
31+
NilLiteralNode
32+
attributes:
33+
flags = 0
34+
isImplicit = false
35+
receiver_ =
36+
RubyCallNode
37+
attributes:
38+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
39+
dispatchConfig = PRIVATE
40+
emptyKeywordsProfile = false
41+
flags = 0
42+
isAttrAssign = false
43+
isSafeNavigation = false
44+
isSplatted = false
45+
isVCall = true
46+
lastArgIsNotHashProfile = false
47+
methodName = "a"
48+
notEmptyKeywordsProfile = false
49+
notRuby2KeywordsHashProfile = false
50+
children:
51+
receiver =
52+
SelfNode
53+
attributes:
54+
flags = 0
55+
WriteFrameSlotNodeGen
56+
attributes:
57+
frameSlot = 2
58+
]
59+
splatCastNode =
60+
SplatCastNodeGen
61+
attributes:
62+
conversionMethod = :to_ary
63+
copy = true
64+
flags = 0
65+
nilBehavior = ARRAY_WITH_NIL
66+
WriteFrameSlotNodeGen
67+
attributes:
68+
frameSlot = 3
69+
]
70+
rhsNode =
71+
ArrayLiteralNode$UninitialisedArrayLiteralNode
72+
attributes:
73+
flags = 0
74+
language = org.truffleruby.RubyLanguage@...
75+
splatCastNode =
76+
SplatCastNodeGen
77+
attributes:
78+
conversionMethod = :to_ary
79+
copy = true
80+
flags = 0
81+
nilBehavior = ARRAY_WITH_NIL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
subject: "Multi-assignment"
2+
description: "When nested multi assignment / element reference and multiple explicit arguments (a[:foo, :bar], b = foo)"
3+
notes: >
4+
yarp_specific: true # generate explicit NilLiteralNode (isImplicit = false)
5+
focused_on_node: "org.truffleruby.core.array.MultipleAssignmentNode"
6+
ruby: |
7+
(a[:key, 0], b), c = []
8+
ast: |
9+
MultipleAssignmentNode
10+
attributes:
11+
flags = 1
12+
children:
13+
preNodes = [
14+
MultipleAssignmentNode
15+
attributes:
16+
flags = 0
17+
children:
18+
preNodes = [
19+
RubyCallNode
20+
attributes:
21+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
22+
dispatchConfig = PROTECTED
23+
emptyKeywordsProfile = false
24+
flags = 0
25+
isAttrAssign = true
26+
isSafeNavigation = false
27+
isSplatted = false
28+
isVCall = false
29+
lastArgIsNotHashProfile = false
30+
methodName = "[]="
31+
notEmptyKeywordsProfile = false
32+
notRuby2KeywordsHashProfile = false
33+
children:
34+
arguments = [
35+
ObjectLiteralNode
36+
attributes:
37+
flags = 0
38+
object = :key
39+
IntegerFixnumLiteralNode
40+
attributes:
41+
flags = 0
42+
value = 0
43+
NilLiteralNode
44+
attributes:
45+
flags = 0
46+
isImplicit = false
47+
]
48+
receiver =
49+
RubyCallNode
50+
attributes:
51+
descriptor = org.truffleruby.language.arguments.EmptyArgumentsDescriptor@...
52+
dispatchConfig = PRIVATE
53+
emptyKeywordsProfile = false
54+
flags = 0
55+
isAttrAssign = false
56+
isSafeNavigation = false
57+
isSplatted = false
58+
isVCall = true
59+
lastArgIsNotHashProfile = false
60+
methodName = "a"
61+
notEmptyKeywordsProfile = false
62+
notRuby2KeywordsHashProfile = false
63+
children:
64+
receiver =
65+
SelfNode
66+
attributes:
67+
flags = 0
68+
WriteFrameSlotNodeGen
69+
attributes:
70+
frameSlot = 2
71+
]
72+
splatCastNode =
73+
SplatCastNodeGen
74+
attributes:
75+
conversionMethod = :to_ary
76+
copy = true
77+
flags = 0
78+
nilBehavior = ARRAY_WITH_NIL
79+
WriteFrameSlotNodeGen
80+
attributes:
81+
frameSlot = 3
82+
]
83+
rhsNode =
84+
ArrayLiteralNode$UninitialisedArrayLiteralNode
85+
attributes:
86+
flags = 0
87+
language = org.truffleruby.RubyLanguage@...
88+
splatCastNode =
89+
SplatCastNodeGen
90+
attributes:
91+
conversionMethod = :to_ary
92+
copy = true
93+
flags = 0
94+
nilBehavior = ARRAY_WITH_NIL

0 commit comments

Comments
 (0)