Skip to content

Commit 667e30f

Browse files
committed
[Truffle] Truffle::Debug.storage_class for Hash
1 parent 3cdfc85 commit 667e30f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

truffle/src/main/java/org/jruby/truffle/nodes/core/TruffleDebugNodes.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.jruby.truffle.runtime.RubyContext;
1919
import org.jruby.truffle.runtime.backtrace.Backtrace;
2020
import org.jruby.truffle.runtime.core.RubyArray;
21+
import org.jruby.truffle.runtime.core.RubyHash;
2122
import org.jruby.truffle.runtime.core.RubyNilClass;
2223
import org.jruby.truffle.runtime.core.RubyString;
2324

@@ -119,7 +120,7 @@ public StorageClassNode(StorageClassNode prev) {
119120
}
120121

121122
@Specialization
122-
public RubyString javaClassOf(RubyArray array) {
123+
public RubyString storageClass(RubyArray array) {
123124
notDesignedForCompilation();
124125

125126
if (array.getStore() == null) {
@@ -129,6 +130,17 @@ public RubyString javaClassOf(RubyArray array) {
129130
}
130131
}
131132

133+
@Specialization
134+
public RubyString storageClass(RubyHash hash) {
135+
notDesignedForCompilation();
136+
137+
if (hash.getStore() == null) {
138+
return getContext().makeString("null");
139+
} else {
140+
return getContext().makeString(hash.getStore().getClass().getName());
141+
}
142+
}
143+
132144
}
133145

134146
@CoreMethod(names = "panic", onSingleton = true)

0 commit comments

Comments
 (0)