@SuppressWarnings("unused") public ErrnoMirror access(ErrnoMirror receiver, String method, Object[] args) { if (!"bind".equals(method)) { throw UnknownIdentifierException.raise(method); } return receiver; } }
/** * Raises an {@link UnknownIdentifierException}, hidden as a {@link RuntimeException}, which * allows throwing it without an explicit throws declaration. The {@link ForeignAccess} methods * (e.g. <code> ForeignAccess.sendRead </code>) catch the exceptions and re-throw them as * checked exceptions. * * @param unknownIdentifier the identifier that could not be accessed * * @return the exception * @since 0.11 */ public static RuntimeException raise(String unknownIdentifier) { CompilerDirectives.transferToInterpreter(); return silenceException(RuntimeException.class, new UnknownIdentifierException(unknownIdentifier)); }
@TruffleBoundary public Object access(ArgumentsArrayObject argsArr, int index, Object value) { try { argsArr.args[index] = value; return value; } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
/** * Raises an {@link UnknownIdentifierException}, hidden as a {@link RuntimeException}, which * allows throwing it without an explicit throws declaration. The {@link ForeignAccess} methods * (e.g. <code> ForeignAccess.sendRead </code>) catch the exceptions and re-throw them as * checked exceptions. * * @param unknownIdentifier the identifier that could not be accessed * * @return the exception * @since 0.11 */ public static RuntimeException raise(String unknownIdentifier) { CompilerDirectives.transferToInterpreter(); return silenceException(RuntimeException.class, new UnknownIdentifierException(unknownIdentifier)); }
@TruffleBoundary public Object access(ArgumentsArrayObject argsArr, int index, Object value) { try { argsArr.args[index] = value; return value; } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary @SuppressWarnings("unused") public Object access(EmptyGlobalBindings obj, String name) { throw UnknownIdentifierException.raise(name); } }
@TruffleBoundary public Object access(VariableNamesObject varNames, int index) { try { return varNames.names.get(index); } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary public Object access(ArgumentsArrayObject argsArr, int index) { try { return argsArr.args[index]; } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary public Object access(ArgumentsArrayObject argsArr, int index, Object value) { try { argsArr.args[index] = value; return value; } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
public Object access(TruffleReadOnlyMapKeysObject keysObject, int index) { if (index >= keysObject.keys.length) { CompilerDirectives.transferToInterpreter(); throw UnknownIdentifierException.raise(Integer.toString(index)); } return keysObject.keys[index]; } }
@TruffleBoundary public Object access(ClassNamesObject varNames, int index) { try { return varNames.names.get(index); } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary public Object access(VariableNamesObject varNames, int index) { try { return varNames.names.get(index); } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary @SuppressWarnings("unused") public Object access(EmptyGlobalBindings obj, String name) { throw UnknownIdentifierException.raise(name); } }
@TruffleBoundary public Object access(ArgumentsArrayObject argsArr, int index) { try { return argsArr.args[index]; } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary public Object access(ClassNamesObject varNames, int index) { try { return varNames.names.get(index); } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary public Object access(VariableNamesObject varNames, int index) { try { return varNames.names.get(index); } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
@TruffleBoundary public Object access(ArgumentsArrayObject argsArr, int index) { try { return argsArr.args[index]; } catch (IndexOutOfBoundsException ioob) { throw UnknownIdentifierException.raise(Integer.toString(index)); } } }
private static RuntimeException unknownIdentifierException(int groupNumber) { CompilerDirectives.transferToInterpreter(); return UnknownIdentifierException.raise(Integer.toString(groupNumber)); }
private static RuntimeException unknownIdentifierException(int groupNumber) { CompilerDirectives.transferToInterpreter(); return UnknownIdentifierException.raise(Integer.toString(groupNumber)); }
@SuppressWarnings("unchecked") @TruffleBoundary @Specialization(guards = {"isMap(receiver)"}) protected Object doMapGeneric(JavaObject receiver, String name) { Map<String, Object> map = (Map<String, Object>) receiver.obj; if (!map.containsKey(name)) { throw UnknownIdentifierException.raise(name); } map.remove(name); return true; }