Skip to content

Commit fcdc8ef

Browse files
committed
Convert specializations to static in ImmutableClassNode
1 parent 63418c6 commit fcdc8ef

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/main/java/org/truffleruby/language/objects/ImmutableClassNode.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.oracle.truffle.api.dsl.GenerateCached;
1313
import com.oracle.truffle.api.dsl.GenerateInline;
1414
import com.oracle.truffle.api.nodes.Node;
15-
import org.truffleruby.RubyContext;
1615
import org.truffleruby.core.CoreLibrary;
1716
import org.truffleruby.core.encoding.RubyEncoding;
1817
import org.truffleruby.core.klass.RubyClass;
@@ -37,68 +36,68 @@
3736
public abstract class ImmutableClassNode extends RubyBaseNode {
3837

3938
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());
4140
}
4241

4342
protected abstract RubyClass execute(Node node, Object value, CoreLibrary coreLibrary);
4443

4544
@Specialization
46-
protected RubyClass metaClassInt(int value, CoreLibrary coreLibrary) {
45+
protected static RubyClass metaClassInt(int value, CoreLibrary coreLibrary) {
4746
return coreLibrary.integerClass;
4847
}
4948

5049
@Specialization
51-
protected RubyClass metaClassImmutableString(ImmutableRubyString value, CoreLibrary coreLibrary) {
50+
protected static RubyClass metaClassImmutableString(ImmutableRubyString value, CoreLibrary coreLibrary) {
5251
return coreLibrary.stringClass;
5352
}
5453

5554
@Specialization
56-
protected RubyClass metaClassSymbol(RubySymbol value, CoreLibrary coreLibrary) {
55+
protected static RubyClass metaClassSymbol(RubySymbol value, CoreLibrary coreLibrary) {
5756
return coreLibrary.symbolClass;
5857
}
5958

6059
@Specialization
61-
protected RubyClass metaClassNil(Nil value, CoreLibrary coreLibrary) {
60+
protected static RubyClass metaClassNil(Nil value, CoreLibrary coreLibrary) {
6261
return coreLibrary.nilClass;
6362
}
6463

6564
@Specialization(guards = "value")
66-
protected RubyClass metaClassTrue(boolean value, CoreLibrary coreLibrary) {
65+
protected static RubyClass metaClassTrue(boolean value, CoreLibrary coreLibrary) {
6766
return coreLibrary.trueClass;
6867
}
6968

7069
@Specialization(guards = "!value")
71-
protected RubyClass metaClassFalse(boolean value, CoreLibrary coreLibrary) {
70+
protected static RubyClass metaClassFalse(boolean value, CoreLibrary coreLibrary) {
7271
return coreLibrary.falseClass;
7372
}
7473

7574
@Specialization
76-
protected RubyClass metaClassLong(long value, CoreLibrary coreLibrary) {
75+
protected static RubyClass metaClassLong(long value, CoreLibrary coreLibrary) {
7776
return coreLibrary.integerClass;
7877
}
7978

8079
@Specialization
81-
protected RubyClass metaClassEncoding(RubyEncoding value, CoreLibrary coreLibrary) {
80+
protected static RubyClass metaClassEncoding(RubyEncoding value, CoreLibrary coreLibrary) {
8281
return coreLibrary.encodingClass;
8382
}
8483

8584
@Specialization
86-
protected RubyClass metaClassRegexp(RubyRegexp value, CoreLibrary coreLibrary) {
85+
protected static RubyClass metaClassRegexp(RubyRegexp value, CoreLibrary coreLibrary) {
8786
return coreLibrary.regexpClass;
8887
}
8988

9089
@Specialization
91-
protected RubyClass metaClassRange(RubyIntOrLongRange value, CoreLibrary coreLibrary) {
90+
protected static RubyClass metaClassRange(RubyIntOrLongRange value, CoreLibrary coreLibrary) {
9291
return coreLibrary.rangeClass;
9392
}
9493

9594
@Specialization
96-
protected RubyClass metaClassDouble(double value, CoreLibrary coreLibrary) {
95+
protected static RubyClass metaClassDouble(double value, CoreLibrary coreLibrary) {
9796
return coreLibrary.floatClass;
9897
}
9998

10099
@Specialization
101-
protected RubyClass metaClassBignum(RubyBignum value, CoreLibrary coreLibrary) {
100+
protected static RubyClass metaClassBignum(RubyBignum value, CoreLibrary coreLibrary) {
102101
return coreLibrary.integerClass;
103102
}
104103

0 commit comments

Comments
 (0)