static ValuePropertiesCollection getProperties(Object value, Debugger debugger, LanguageInfo language, DebugScope scope) { ValuePropertiesCollection properties = null; if (value instanceof TruffleObject) { TruffleObject object = (TruffleObject) value; Map<Object, Object> map = ObjectStructures.asMap(debugger.getMessageNodes(), object); if (map != null) { properties = new ValuePropertiesCollection(debugger, language, object, map, map.entrySet(), scope); } } return properties; }
static ValuePropertiesCollection getProperties(Object value, DebuggerSession session, LanguageInfo language, DebugScope scope) { ValuePropertiesCollection properties = null; if (value instanceof TruffleObject) { TruffleObject object = (TruffleObject) value; Map<Object, Object> map = ObjectStructures.asMap(session.getDebugger().getMessageNodes(), object); if (map != null) { properties = new ValuePropertiesCollection(session, language, object, map, map.entrySet(), scope); } } return properties; }
@Override public FrameInstance visitFrame(FrameInstance frameInstance) { Node node; if (depth == 0) { node = throwNode; } else { node = frameInstance.getCallNode(); } if (node != null) { Node catchNode = getCatchNode(debugger.getMessageNodes(), node, exception); if (catchNode != null) { catchLocationPtr[0] = new CatchLocation(catchNode.getSourceSection(), frameInstance, depth); return frameInstance; } } depth++; return null; } });
/** * Returns <code>true</code> if this value represents an array, <code>false</code> otherwise. * * @throws DebugException when guest language code throws an exception * @since 0.19 */ public final boolean isArray() throws DebugException { if (!isReadable()) { return false; } Object value = get(); if (value instanceof TruffleObject) { TruffleObject to = (TruffleObject) value; return ObjectStructures.isArray(getDebugger().getMessageNodes(), to); } else { return false; } }
/** * Returns <code>true</code> if this value represents an array, <code>false</code> otherwise. * * @since 0.19 */ public final boolean isArray() { if (!isReadable()) { return false; } Object value = get(); if (value instanceof TruffleObject) { TruffleObject to = (TruffleObject) value; return ObjectStructures.isArray(getDebugger().getMessageNodes(), to); } else { return false; } }
/** * Get arguments of this scope. If this scope is a {@link #isFunctionScope() function} scope, * function arguments are returned. * <p> * This method is not thread-safe and will throw an {@link IllegalStateException} if called on * another thread than it was created with. * * @return an iterable of arguments, or <code>null</code> when this scope does not have a * concept of arguments. * @since 0.26 */ public Iterable<DebugValue> getArguments() { verifyValidState(); Object argumentsObj = scope.getArguments(); Iterable<DebugValue> arguments = null; if (argumentsObj != null && argumentsObj instanceof TruffleObject) { TruffleObject argsTO = (TruffleObject) argumentsObj; arguments = DebugValue.getProperties(argumentsObj, debugger, getLanguage(), this); if (arguments == null && ObjectStructures.isArray(debugger.getMessageNodes(), argsTO)) { List<Object> array = ObjectStructures.asList(debugger.getMessageNodes(), argsTO); arguments = new ValueInteropList(debugger, getLanguage(), array); } } return arguments; }
/** * Returns <code>true</code> if this value can be executed (represents a guest language * function), else <code>false</code>. * * @since 1.0 */ public final boolean canExecute() throws DebugException { Object value = get(); if (value instanceof TruffleObject) { TruffleObject to = (TruffleObject) value; try { return ObjectStructures.canExecute(getDebugger().getMessageNodes(), to); } catch (ThreadDeath td) { throw td; } catch (Throwable ex) { throw new DebugException(getSession(), ex, resolveLanguage(), null, true, null); } } else { return false; } }
TruffleObject object = (TruffleObject) value; try { int keyInfo = ForeignAccess.sendKeyInfo(getDebugger().getMessageNodes().keyInfo, object, name); if (!KeyInfo.isExisting(keyInfo)) { return null; } else { Map.Entry<Object, Object> entry = new ObjectStructures.TruffleEntry(getDebugger().getMessageNodes(), object, name); return new DebugValue.PropertyValue(getSession(), resolveLanguage(), keyInfo, entry, null);
TruffleObject argsTO = (TruffleObject) argumentsObj; arguments = DebugValue.getProperties(argumentsObj, session, getLanguage(), this); if (arguments == null && ObjectStructures.isArray(session.getDebugger().getMessageNodes(), argsTO)) { List<Object> array = ObjectStructures.asList(session.getDebugger().getMessageNodes(), argsTO); arguments = new ValueInteropList(session, getLanguage(), array);
/** * Provides array elements when this value represents an array. To test if this value represents * an array, check {@link #isArray()}. * * @return a list of array elements, or <code>null</code> when the value does not represent an * array. * @throws DebugException when guest language code throws an exception * @since 0.19 */ public final List<DebugValue> getArray() throws DebugException { if (!isReadable()) { return null; } List<DebugValue> arrayList = null; Object value = get(); if (value instanceof TruffleObject) { TruffleObject to = (TruffleObject) value; List<Object> array = ObjectStructures.asList(getDebugger().getMessageNodes(), to); if (array != null) { arrayList = new ValueInteropList(getSession(), resolveLanguage(), array); } } return arrayList; }
/** * Provides array elements when this value represents an array. To test if this value represents * an array, check {@link #isArray()}. * * @return a list of array elements, or <code>null</code> when the value does not represent an * array. * @since 0.19 */ public final List<DebugValue> getArray() { if (!isReadable()) { return null; } List<DebugValue> arrayList = null; Object value = get(); if (value instanceof TruffleObject) { TruffleObject to = (TruffleObject) value; List<Object> array = ObjectStructures.asList(getDebugger().getMessageNodes(), to); if (array != null) { arrayList = new ValueInteropList(getDebugger(), resolveLanguage(), array); } } return arrayList; }