Skip to content

Commit dc1cfcb

Browse files
committed
Switch to using a VariableNamesObject for property names.
1 parent dab5509 commit dc1cfcb

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

src/main/java/org/truffleruby/cext/ValueWrapper.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
import org.truffleruby.cext.ValueWrapperManager.AllocateHandleNode;
1414
import org.truffleruby.cext.ValueWrapperManager.HandleBlock;
1515
import org.truffleruby.core.MarkingServiceNodes.KeepAliveNode;
16+
import org.truffleruby.debug.VariableNamesObject;
1617
import org.truffleruby.interop.TranslateInteropExceptionNode;
1718

1819
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1920
import com.oracle.truffle.api.dsl.Cached;
2021
import com.oracle.truffle.api.dsl.Cached.Exclusive;
2122
import com.oracle.truffle.api.interop.InteropLibrary;
22-
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
2323
import com.oracle.truffle.api.interop.TruffleObject;
2424
import com.oracle.truffle.api.interop.UnknownIdentifierException;
2525
import com.oracle.truffle.api.interop.UnsupportedMessageException;
@@ -131,7 +131,7 @@ protected boolean hasMembers() {
131131

132132
@ExportMessage
133133
protected Object getMembers(boolean includeInternal) {
134-
return new ValueWrapperPropertyList();
134+
return new VariableNamesObject(new String[]{ "value" });
135135
}
136136

137137
@ExportMessage
@@ -149,34 +149,4 @@ protected static Object readMember(ValueWrapper wrapper, String member,
149149
throw UnknownIdentifierException.create(member);
150150
}
151151
}
152-
153-
@ExportLibrary(InteropLibrary.class)
154-
public static class ValueWrapperPropertyList implements TruffleObject {
155-
156-
@ExportMessage
157-
protected static boolean hasArrayElements(ValueWrapperPropertyList wrapper) {
158-
return true;
159-
}
160-
161-
@ExportMessage
162-
protected static long getArraySize(ValueWrapperPropertyList wrapper) {
163-
return 1;
164-
}
165-
166-
@ExportMessage
167-
protected static Object readArrayElement(ValueWrapperPropertyList list, long index,
168-
@Cached @Exclusive BranchProfile errorProfile) throws InvalidArrayIndexException {
169-
if (index == 0L) {
170-
return "value";
171-
} else {
172-
errorProfile.enter();
173-
throw InvalidArrayIndexException.create(index);
174-
}
175-
}
176-
177-
@ExportMessage
178-
protected static boolean isArrayElementReadable(ValueWrapperPropertyList wrapper, long index) {
179-
return index == 0L;
180-
}
181-
}
182152
}

0 commit comments

Comments
 (0)