27
27
import org .truffleruby .interop .TranslateInteropRubyExceptionNode ;
28
28
import org .truffleruby .language .control .RaiseException ;
29
29
import org .truffleruby .language .dispatch .NewDispatchHeadNode ;
30
- import org .truffleruby .language .dispatch .DispatchNode ;
31
30
import org .truffleruby .language .library .RubyLibrary ;
32
31
import org .truffleruby .language .objects .LogicalClassNode ;
33
32
import org .truffleruby .language .objects .WriteObjectFieldNode ;
@@ -198,7 +197,7 @@ public boolean hasArrayElements(
198
197
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) NewDispatchHeadNode dispatchNode ,
199
198
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
200
199
Object value = dispatchNode .call (this , "polyglot_has_array_elements?" );
201
- return value != DispatchNode .MISSING && booleanCastNode .executeToBoolean (value );
200
+ return value != NewDispatchHeadNode .MISSING && booleanCastNode .executeToBoolean (value );
202
201
}
203
202
204
203
@ ExportMessage
@@ -214,7 +213,7 @@ public long getArraySize(
214
213
} catch (RaiseException e ) {
215
214
throw translateRubyException .execute (e );
216
215
}
217
- if (value == DispatchNode .MISSING ) {
216
+ if (value == NewDispatchHeadNode .MISSING ) {
218
217
errorProfile .enter ();
219
218
throw UnsupportedMessageException .create ();
220
219
}
@@ -230,7 +229,7 @@ public Object readArrayElement(long index,
230
229
throws InvalidArrayIndexException , UnsupportedMessageException {
231
230
try {
232
231
Object value = dispatchNode .call (this , "polyglot_read_array_element" , index );
233
- if (value == DispatchNode .MISSING ) {
232
+ if (value == NewDispatchHeadNode .MISSING ) {
234
233
errorProfile .enter ();
235
234
throw UnsupportedMessageException .create ();
236
235
}
@@ -249,7 +248,7 @@ public void writeArrayElement(long index, Object value,
249
248
throws UnsupportedMessageException , InvalidArrayIndexException , UnsupportedTypeException {
250
249
try {
251
250
Object result = dispatchNode .call (this , "polyglot_write_array_element" , index , value );
252
- if (result == DispatchNode .MISSING ) {
251
+ if (result == NewDispatchHeadNode .MISSING ) {
253
252
errorProfile .enter ();
254
253
throw UnsupportedMessageException .create ();
255
254
}
@@ -267,7 +266,7 @@ public void removeArrayElement(long index,
267
266
throws UnsupportedMessageException , InvalidArrayIndexException {
268
267
try {
269
268
Object result = dispatchNode .call (this , "polyglot_remove_array_element" , index );
270
- if (result == DispatchNode .MISSING ) {
269
+ if (result == NewDispatchHeadNode .MISSING ) {
271
270
errorProfile .enter ();
272
271
throw UnsupportedMessageException .create ();
273
272
}
@@ -281,31 +280,31 @@ public boolean isArrayElementReadable(long index,
281
280
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) NewDispatchHeadNode dispatchNode ,
282
281
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
283
282
Object value = dispatchNode .call (this , "polyglot_array_element_readable?" , index );
284
- return value != DispatchNode .MISSING && booleanCastNode .executeToBoolean (value );
283
+ return value != NewDispatchHeadNode .MISSING && booleanCastNode .executeToBoolean (value );
285
284
}
286
285
287
286
@ ExportMessage
288
287
public boolean isArrayElementModifiable (long index ,
289
288
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) NewDispatchHeadNode dispatchNode ,
290
289
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
291
290
Object value = dispatchNode .call (this , "polyglot_array_element_modifiable?" , index );
292
- return value != DispatchNode .MISSING && booleanCastNode .executeToBoolean (value );
291
+ return value != NewDispatchHeadNode .MISSING && booleanCastNode .executeToBoolean (value );
293
292
}
294
293
295
294
@ ExportMessage
296
295
public boolean isArrayElementInsertable (long index ,
297
296
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) NewDispatchHeadNode dispatchNode ,
298
297
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
299
298
Object value = dispatchNode .call (this , "polyglot_array_element_insertable?" , index );
300
- return value != DispatchNode .MISSING && booleanCastNode .executeToBoolean (value );
299
+ return value != NewDispatchHeadNode .MISSING && booleanCastNode .executeToBoolean (value );
301
300
}
302
301
303
302
@ ExportMessage
304
303
public boolean isArrayElementRemovable (long index ,
305
304
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) NewDispatchHeadNode dispatchNode ,
306
305
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
307
306
Object value = dispatchNode .call (this , "polyglot_array_element_removable?" , index );
308
- return value != DispatchNode .MISSING && booleanCastNode .executeToBoolean (value );
307
+ return value != NewDispatchHeadNode .MISSING && booleanCastNode .executeToBoolean (value );
309
308
}
310
309
// endregion
311
310
@@ -316,7 +315,7 @@ public boolean isPointer(
316
315
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
317
316
318
317
Object value = dispatchNode .call (this , "polyglot_pointer?" );
319
- return value != DispatchNode .MISSING && booleanCastNode .executeToBoolean (value );
318
+ return value != NewDispatchHeadNode .MISSING && booleanCastNode .executeToBoolean (value );
320
319
}
321
320
322
321
@ ExportMessage
@@ -332,7 +331,7 @@ public long asPointer(
332
331
} catch (RaiseException e ) {
333
332
throw translateRubyException .execute (e );
334
333
}
335
- if (value == DispatchNode .MISSING ) {
334
+ if (value == NewDispatchHeadNode .MISSING ) {
336
335
errorProfile .enter ();
337
336
throw UnsupportedMessageException .create ();
338
337
}
@@ -355,7 +354,7 @@ public boolean hasMembers(
355
354
@ Exclusive @ Cached (parameters = "PRIVATE_RETURN_MISSING" ) NewDispatchHeadNode dispatchNode ,
356
355
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
357
356
Object dynamic = dispatchNode .call (this , "polyglot_has_members?" );
358
- return dynamic == DispatchNode .MISSING || booleanCastNode .executeToBoolean (dynamic );
357
+ return dynamic == NewDispatchHeadNode .MISSING || booleanCastNode .executeToBoolean (dynamic );
359
358
}
360
359
361
360
@ ExportMessage
@@ -394,7 +393,7 @@ public Object readMember(String name,
394
393
throw translateRubyException .execute (e , name );
395
394
}
396
395
397
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
396
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
398
397
Object iVar = objectLibrary .getOrDefault (this , name , null );
399
398
if (ivarFoundProfile .profile (iVar != null )) {
400
399
return iVar ;
@@ -427,7 +426,7 @@ public void writeMember(String name, Object value,
427
426
throw translateRubyException .execute (e , name );
428
427
}
429
428
430
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
429
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
431
430
if (rubyLibrary .isFrozen (this )) {
432
431
errorProfile .enter ();
433
432
throw UnsupportedMessageException .create ();
@@ -460,7 +459,7 @@ public void removeMember(String name,
460
459
throw translateRubyException .execute (e , name );
461
460
}
462
461
463
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
462
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
464
463
if (!interopLibrary .isMemberRemovable (this , name )) {
465
464
errorProfile .enter ();
466
465
throw UnknownIdentifierException .create (name );
@@ -495,9 +494,9 @@ public Object invokeMember(String name, Object[] arguments,
495
494
throw translateRubyException .execute (e , name , arguments );
496
495
}
497
496
498
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
497
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
499
498
Object result = dispatchMember .call (this , name , convertedArguments );
500
- if (result == DispatchNode .MISSING ) {
499
+ if (result == NewDispatchHeadNode .MISSING ) {
501
500
errorProfile .enter ();
502
501
throw UnknownIdentifierException .create (name );
503
502
}
@@ -517,7 +516,7 @@ public boolean isMemberReadable(String name,
517
516
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ) {
518
517
Object rubyName = nameToRubyNode .executeConvert (name );
519
518
Object dynamic = dispatchNode .call (this , "polyglot_member_readable?" , rubyName );
520
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
519
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
521
520
if (ivarFoundProfile .profile (objectLibrary .containsKey (this , name ))) {
522
521
return true ;
523
522
} else {
@@ -572,7 +571,7 @@ private boolean isMemberModifiableRemovable(Object dynamic,
572
571
DynamicObjectLibrary objectLibrary ,
573
572
BooleanCastNode booleanCastNode ,
574
573
ConditionProfile dynamicProfile ) {
575
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
574
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
576
575
if (rubyLibrary .isFrozen (this )) {
577
576
return false ;
578
577
} else {
@@ -593,7 +592,7 @@ public boolean isMemberInsertable(String name,
593
592
@ Cached @ Shared ("nameToRubyNode" ) ForeignToRubyNode nameToRubyNode ) {
594
593
Object rubyName = nameToRubyNode .executeConvert (name );
595
594
Object dynamic = dispatchNode .call (this , "polyglot_member_insertable?" , rubyName );
596
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
595
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
597
596
if (rubyLibrary .isFrozen (this ) || !isIVar (name )) {
598
597
return false ;
599
598
} else {
@@ -615,7 +614,7 @@ public boolean isMemberInvocable(String name,
615
614
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ) {
616
615
Object rubyName = nameToRubyNode .executeConvert (name );
617
616
Object dynamic = dispatchNode .call (this , "polyglot_member_invocable?" , rubyName );
618
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
617
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
619
618
Object iVar = objectLibrary .getOrDefault (this , name , null );
620
619
if (ivarFoundProfile .profile (iVar != null )) {
621
620
return false ;
@@ -639,7 +638,7 @@ public boolean isMemberInternal(String name,
639
638
@ Shared ("ivarFoundProfile" ) @ Cached ConditionProfile ivarFoundProfile ) {
640
639
Object rubyName = nameToRubyNode .executeConvert (name );
641
640
Object dynamic = dispatchNode .call (this , "polyglot_member_internal?" , rubyName );
642
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
641
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
643
642
Object result = objectLibrary .getOrDefault (this , name , null );
644
643
if (ivarFoundProfile .profile (result != null )) {
645
644
return true ;
@@ -661,7 +660,7 @@ public boolean hasMemberReadSideEffects(String name,
661
660
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
662
661
Object rubyName = nameToRubyNode .executeConvert (name );
663
662
Object dynamic = dispatchNode .call (this , "polyglot_has_member_read_side_effects?" , rubyName );
664
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
663
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
665
664
return false ;
666
665
} else {
667
666
return booleanCastNode .executeToBoolean (dynamic );
@@ -676,7 +675,7 @@ public boolean hasMemberWriteSideEffects(String name,
676
675
@ Exclusive @ Cached BooleanCastNode booleanCastNode ) {
677
676
Object rubyName = nameToRubyNode .executeConvert (name );
678
677
Object dynamic = dispatchNode .call (this , "polyglot_has_member_write_side_effects?" , rubyName );
679
- if (dynamicProfile .profile (dynamic == DispatchNode .MISSING )) {
678
+ if (dynamicProfile .profile (dynamic == NewDispatchHeadNode .MISSING )) {
680
679
return false ;
681
680
} else {
682
681
return booleanCastNode .executeToBoolean (dynamic );
@@ -700,7 +699,7 @@ public Object instantiate(Object[] arguments,
700
699
Object instance = dispatchNode .call (this , "new" , foreignToRubyArgumentsNode .executeConvert (arguments ));
701
700
702
701
// TODO (pitr-ch 28-Jan-2020): we should translate argument-error caused by bad arity to ArityException
703
- if (instance == DispatchNode .MISSING ) {
702
+ if (instance == NewDispatchHeadNode .MISSING ) {
704
703
errorProfile .enter ();
705
704
throw UnsupportedMessageException .create ();
706
705
}
0 commit comments