File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 25
25
import com .oracle .truffle .api .profiles .ConditionProfile ;
26
26
27
27
@ NodeChild (value = "array" , type = RubyNode .class )
28
- @ NodeChild (value = "value " , type = RubyNode .class )
28
+ @ NodeChild (value = "valueNode " , type = RubyNode .class )
29
29
@ ImportStatic (ArrayGuards .class )
30
30
public abstract class ArrayAppendOneNode extends RubyContextSourceNode {
31
31
@@ -37,6 +37,8 @@ public static ArrayAppendOneNode create() {
37
37
38
38
public abstract RubyArray executeAppendOne (RubyArray array , Object value );
39
39
40
+ public abstract RubyNode getValueNode ();
41
+
40
42
// Append of the correct type
41
43
42
44
@ Specialization (
Original file line number Diff line number Diff line change 11
11
12
12
import org .truffleruby .RubyContext ;
13
13
import org .truffleruby .RubyLanguage ;
14
+ import org .truffleruby .core .array .ArrayAppendOneNode ;
14
15
import org .truffleruby .core .array .ArrayToObjectArrayNode ;
15
16
import org .truffleruby .core .array .ArrayToObjectArrayNodeGen ;
16
17
import org .truffleruby .core .array .AssignableNode ;
@@ -100,8 +101,8 @@ public Object execute(VirtualFrame frame) {
100
101
101
102
@ Override
102
103
public void assign (VirtualFrame frame , Object value ) {
103
- assert getLastArgumentNode () instanceof NilLiteralNode &&
104
- ((NilLiteralNode ) getLastArgumentNode ()).isImplicit () : getLastArgumentNode ();
104
+ assert ( getLastArgumentNode () instanceof NilLiteralNode &&
105
+ ((NilLiteralNode ) getLastArgumentNode ()).isImplicit ()) : getLastArgumentNode ();
105
106
106
107
final Object receiverObject = receiver .execute (frame );
107
108
if (isSafeNavigation && nilProfile .profile (receiverObject == nil )) {
@@ -195,7 +196,11 @@ public boolean hasLiteralBlock() {
195
196
}
196
197
197
198
private RubyNode getLastArgumentNode () {
198
- return arguments [arguments .length - 1 ];
199
+ final RubyNode lastArg = arguments [arguments .length - 1 ];
200
+ if (isSplatted && lastArg instanceof ArrayAppendOneNode ) {
201
+ return ((ArrayAppendOneNode ) lastArg ).getValueNode ();
202
+ }
203
+ return lastArg ;
199
204
}
200
205
201
206
@ Override
You can’t perform that action at this time.
0 commit comments