Search in sources :

Example 1 with AbstractSourceDispatch

use of org.graalvm.polyglot.impl.AbstractPolyglotImpl.AbstractSourceDispatch in project graal by oracle.

the class HostContextDispatch method eval.

@Override
public Value eval(Object receiver, String language, Source source) {
    HostContext context = (HostContext) receiver;
    APIAccess apiAccess = polyglot.getAPIAccess();
    AbstractSourceDispatch sourceDispatch = apiAccess.getDispatch(source);
    Object sourceImpl = apiAccess.getReceiver(source);
    String languageId = sourceDispatch.getLanguage(sourceImpl);
    String characters = sourceDispatch.getCharacters(sourceImpl).toString();
    long remoteValue = hostToGuest.remoteEval(context.remoteContext, languageId, characters);
    return context.localContext.asValue(new HostGuestValue(hostToGuest, context.remoteContext, remoteValue));
}
Also used : AbstractSourceDispatch(org.graalvm.polyglot.impl.AbstractPolyglotImpl.AbstractSourceDispatch) TruffleObject(com.oracle.truffle.api.interop.TruffleObject) APIAccess(org.graalvm.polyglot.impl.AbstractPolyglotImpl.APIAccess)

Aggregations

TruffleObject (com.oracle.truffle.api.interop.TruffleObject)1 APIAccess (org.graalvm.polyglot.impl.AbstractPolyglotImpl.APIAccess)1 AbstractSourceDispatch (org.graalvm.polyglot.impl.AbstractPolyglotImpl.AbstractSourceDispatch)1