|
12 | 12 | import com.oracle.truffle.api.dsl.GenerateCached;
|
13 | 13 | import com.oracle.truffle.api.dsl.GenerateInline;
|
14 | 14 | import com.oracle.truffle.api.nodes.Node;
|
15 |
| -import org.truffleruby.RubyContext; |
16 | 15 | import org.truffleruby.core.CoreLibrary;
|
17 | 16 | import org.truffleruby.core.encoding.RubyEncoding;
|
18 | 17 | import org.truffleruby.core.klass.RubyClass;
|
|
37 | 36 | public abstract class ImmutableClassNode extends RubyBaseNode {
|
38 | 37 |
|
39 | 38 | public final RubyClass execute(Node node, Object value) {
|
40 |
| - return execute(node, value, RubyContext.get(node).getCoreLibrary()); |
| 39 | + return execute(node, value, getContext(node).getCoreLibrary()); |
41 | 40 | }
|
42 | 41 |
|
43 | 42 | protected abstract RubyClass execute(Node node, Object value, CoreLibrary coreLibrary);
|
44 | 43 |
|
45 | 44 | @Specialization
|
46 |
| - protected RubyClass metaClassInt(int value, CoreLibrary coreLibrary) { |
| 45 | + protected static RubyClass metaClassInt(int value, CoreLibrary coreLibrary) { |
47 | 46 | return coreLibrary.integerClass;
|
48 | 47 | }
|
49 | 48 |
|
50 | 49 | @Specialization
|
51 |
| - protected RubyClass metaClassImmutableString(ImmutableRubyString value, CoreLibrary coreLibrary) { |
| 50 | + protected static RubyClass metaClassImmutableString(ImmutableRubyString value, CoreLibrary coreLibrary) { |
52 | 51 | return coreLibrary.stringClass;
|
53 | 52 | }
|
54 | 53 |
|
55 | 54 | @Specialization
|
56 |
| - protected RubyClass metaClassSymbol(RubySymbol value, CoreLibrary coreLibrary) { |
| 55 | + protected static RubyClass metaClassSymbol(RubySymbol value, CoreLibrary coreLibrary) { |
57 | 56 | return coreLibrary.symbolClass;
|
58 | 57 | }
|
59 | 58 |
|
60 | 59 | @Specialization
|
61 |
| - protected RubyClass metaClassNil(Nil value, CoreLibrary coreLibrary) { |
| 60 | + protected static RubyClass metaClassNil(Nil value, CoreLibrary coreLibrary) { |
62 | 61 | return coreLibrary.nilClass;
|
63 | 62 | }
|
64 | 63 |
|
65 | 64 | @Specialization(guards = "value")
|
66 |
| - protected RubyClass metaClassTrue(boolean value, CoreLibrary coreLibrary) { |
| 65 | + protected static RubyClass metaClassTrue(boolean value, CoreLibrary coreLibrary) { |
67 | 66 | return coreLibrary.trueClass;
|
68 | 67 | }
|
69 | 68 |
|
70 | 69 | @Specialization(guards = "!value")
|
71 |
| - protected RubyClass metaClassFalse(boolean value, CoreLibrary coreLibrary) { |
| 70 | + protected static RubyClass metaClassFalse(boolean value, CoreLibrary coreLibrary) { |
72 | 71 | return coreLibrary.falseClass;
|
73 | 72 | }
|
74 | 73 |
|
75 | 74 | @Specialization
|
76 |
| - protected RubyClass metaClassLong(long value, CoreLibrary coreLibrary) { |
| 75 | + protected static RubyClass metaClassLong(long value, CoreLibrary coreLibrary) { |
77 | 76 | return coreLibrary.integerClass;
|
78 | 77 | }
|
79 | 78 |
|
80 | 79 | @Specialization
|
81 |
| - protected RubyClass metaClassEncoding(RubyEncoding value, CoreLibrary coreLibrary) { |
| 80 | + protected static RubyClass metaClassEncoding(RubyEncoding value, CoreLibrary coreLibrary) { |
82 | 81 | return coreLibrary.encodingClass;
|
83 | 82 | }
|
84 | 83 |
|
85 | 84 | @Specialization
|
86 |
| - protected RubyClass metaClassRegexp(RubyRegexp value, CoreLibrary coreLibrary) { |
| 85 | + protected static RubyClass metaClassRegexp(RubyRegexp value, CoreLibrary coreLibrary) { |
87 | 86 | return coreLibrary.regexpClass;
|
88 | 87 | }
|
89 | 88 |
|
90 | 89 | @Specialization
|
91 |
| - protected RubyClass metaClassRange(RubyIntOrLongRange value, CoreLibrary coreLibrary) { |
| 90 | + protected static RubyClass metaClassRange(RubyIntOrLongRange value, CoreLibrary coreLibrary) { |
92 | 91 | return coreLibrary.rangeClass;
|
93 | 92 | }
|
94 | 93 |
|
95 | 94 | @Specialization
|
96 |
| - protected RubyClass metaClassDouble(double value, CoreLibrary coreLibrary) { |
| 95 | + protected static RubyClass metaClassDouble(double value, CoreLibrary coreLibrary) { |
97 | 96 | return coreLibrary.floatClass;
|
98 | 97 | }
|
99 | 98 |
|
100 | 99 | @Specialization
|
101 |
| - protected RubyClass metaClassBignum(RubyBignum value, CoreLibrary coreLibrary) { |
| 100 | + protected static RubyClass metaClassBignum(RubyBignum value, CoreLibrary coreLibrary) { |
102 | 101 | return coreLibrary.integerClass;
|
103 | 102 | }
|
104 | 103 |
|
|
0 commit comments