File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed
src/vm/jvm/runtime/org/perl6/nqp/truffle Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change
1
+ package org .perl6 .nqp .truffle ;
2
+
3
+ import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
4
+ public class Debug {
5
+ @ TruffleBoundary
6
+ public static RuntimeException wrongThing (String msg , Object value ) {
7
+ return new RuntimeException (msg + ": " + value .getClass ().getCanonicalName ());
8
+ }
9
+ }
Original file line number Diff line number Diff line change 6
6
import org .perl6 .nqp .dsl .Deserializer ;
7
7
import org .perl6 .nqp .truffle .runtime .NQPHash ;
8
8
import org .perl6 .nqp .truffle .runtime .NQPList ;
9
+ import org .perl6 .nqp .truffle .Debug ;
9
10
10
11
@ NodeInfo (shortName = "elems" )
11
12
public final class NQPElemsNode extends NQPIntNode {
@@ -24,7 +25,7 @@ public long executeInt(VirtualFrame frame) {
24
25
} else if (arg instanceof NQPHash ) {
25
26
return ((NQPHash )arg ).elems ();
26
27
} else {
27
- throw new RuntimeException ( arg . getClass (). getCanonicalName () + " does not implement elems" );
28
+ throw Debug . wrongThing ( " does not implement elems", arg );
28
29
}
29
30
}
30
31
}
Original file line number Diff line number Diff line change 54
54
import org .perl6 .nqp .truffle .runtime .NQPNull ;
55
55
56
56
import org .perl6 .nqp .dsl .Deserializer ;
57
+ import org .perl6 .nqp .truffle .Debug ;
57
58
58
59
@ NodeInfo (shortName = "smart numify" )
59
60
public final class NQPSmartNumifyNode extends NQPNumNode {
@@ -80,7 +81,7 @@ public double executeNum(VirtualFrame frame) {
80
81
} else if (value == null ) {
81
82
throw new RuntimeException ("can't smart numify raw null" );
82
83
} else {
83
- throw new RuntimeException ("can't smart numify: " + value . getClass (). getCanonicalName () );
84
+ throw Debug . wrongThing ("can't smart numify" , value );
84
85
}
85
86
}
86
87
}
Original file line number Diff line number Diff line change 52
52
53
53
import org .perl6 .nqp .dsl .Deserializer ;
54
54
import org .perl6 .nqp .truffle .runtime .Coercions ;
55
+ import org .perl6 .nqp .truffle .Debug ;
55
56
56
57
@ NodeInfo (shortName = "smart stringify" )
57
58
public final class NQPSmartStringifyNode extends NQPStrNode {
@@ -74,7 +75,7 @@ public String executeStr(VirtualFrame frame) {
74
75
} else if (value == NQPNull .SINGLETON ) {
75
76
return "" ;
76
77
} else {
77
- throw new RuntimeException ("can't smart stringify: " + value . getClass (). getCanonicalName () );
78
+ throw Debug . wrongThing ("can't smart stringify" , value );
78
79
}
79
80
}
80
81
}
You can’t perform that action at this time.
0 commit comments