@Override public boolean isInteractive() { return key.base.isInteractive(); }
@Override public boolean isInteractive(Object impl) { com.oracle.truffle.api.source.Source source = (com.oracle.truffle.api.source.Source) impl; return source.isInteractive(); }
@Override public boolean isInteractive(Object impl) { com.oracle.truffle.api.source.Source source = (com.oracle.truffle.api.source.Source) impl; return source.isInteractive(); }
final boolean equalAttributes(Source other) { return Objects.equals(getMimeType(), other.getMimeType()) && Objects.equals(getLanguage(), other.getLanguage()) && Objects.equals(getName(), other.getName()) && Objects.equals(getPath(), other.getPath()) && isInternal() == other.isInternal() && isInteractive() == other.isInteractive(); }
return Source.newBuilder(source.getLanguage(), new InputStreamReader(connection.getInputStream()), name).uri(uri).cached(false).interactive(source.isInteractive()).internal( source.isInternal()).mimeType(source.getMimeType()).build(); } catch (IOException ex) {
@Override protected Object executeImpl(VirtualFrame frame) { if (call == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); initialize(); } Object result = call.call(EMPTY_ARRAY); // TODO null is not valid value, wrap it using java interop // we should make this a strong check. if (result == null) { result = NULL_VALUE; } if (source.isInteractive()) { printResult(result); } return result; }
@Override public Value eval(String languageId, Object sourceImpl) { PolyglotLanguage language = requirePublicLanguage(languageId); Object prev = enterIfNeeded(); PolyglotLanguageContext languageContext = getContext(language); try { languageContext.checkAccess(null); languageContext.ensureInitialized(null); com.oracle.truffle.api.source.Source source = (com.oracle.truffle.api.source.Source) sourceImpl; CallTarget target = languageContext.parseCached(null, source, null); Object result = target.call(PolyglotImpl.EMPTY_ARGS); Value hostValue; try { hostValue = languageContext.asValue(result); } catch (NullPointerException | ClassCastException e) { throw new AssertionError(String.format("Language %s returned an invalid return value %s. Must be an interop value.", languageId, result), e); } if (source.isInteractive()) { printResult(languageContext, result); } return hostValue; } catch (Throwable e) { throw PolyglotImpl.wrapGuestException(languageContext, e); } finally { leaveIfNeeded(prev); } }
/** * {@inheritDoc} * * @since 1.0 */ @Override public String toString() { return "Source [language=" + getLanguage() + ", name=" + getName() + ", path=" + getPath() + ", internal=" + isInternal() + ", cached=" + isCached() + ", interactive=" + isInteractive() + ", hasBytes=" + hasBytes() + ", hasCharacters=" + hasCharacters() + ", URL=" + getURL() + ", URI=" + getURI() + ", mimeType=" + getMimeType() + "]"; }
@Override public Value eval(String languageId, Object sourceImpl) { PolyglotLanguage language = requirePublicLanguage(languageId); Object prev = enter(); PolyglotLanguageContext languageContext = contexts[language.index]; try { languageContext.checkAccess(null); com.oracle.truffle.api.source.Source source = (com.oracle.truffle.api.source.Source) sourceImpl; CallTarget target = languageContext.parseCached(source); Object result = target.call(PolyglotImpl.EMPTY_ARGS); if (source.isInteractive()) { printResult(languageContext, result); } return languageContext.toHostValue(result); } catch (Throwable e) { throw PolyglotImpl.wrapGuestException(languageContext, e); } finally { leave(prev); } }