# HG changeset patch # User Jaroslav Tulach # Date 1447685883 -3600 # Node ID a765d165e7ecc485cefc9c2b19c756cb2783787b # Parent 72545ac338eb962aa9830fa78478aac98496ae51 Give languages a chance to separate (and optimize) parsing and evaluation. diff -r 72545ac338eb -r a765d165e7ec truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java Mon Nov 16 15:51:36 2015 +0100 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java Mon Nov 16 15:58:03 2015 +0100 @@ -391,13 +391,12 @@ * . * * @param source the source to evaluate - * @return the result of the evaluation + * @return the call target representing the parsed result * @throws IOException if the parsing or evaluation fails for some reason */ - public Object eval(Source source) throws IOException { + public CallTarget parse(Source source) throws IOException { TruffleLanguage language = API.findLanguageImpl(vm, null, source.getMimeType()); - CallTarget call = language.parse(source, null); - return call.call(); + return language.parse(source, null); } /** diff -r 72545ac338eb -r a765d165e7ec truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java --- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Mon Nov 16 15:51:36 2015 +0100 +++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Mon Nov 16 15:58:03 2015 +0100 @@ -235,6 +235,6 @@ } public Object evalAny(Source source) throws IOException { - return env.eval(source); + return env.parse(source).call(); } }