Beispiel #1
0
 /**
  * REPL: Eval
  *
  * @param realm the realm instance
  * @param parsedScript the parsed script node
  * @return the evaluated script result
  */
 private Object eval(Realm realm, com.github.anba.es6draft.ast.Script parsedScript) {
   String className = "#typein_" + scriptCounter.incrementAndGet();
   Script script;
   if (options.noInterpreter) {
     script = realm.getScriptLoader().compile(parsedScript, className);
   } else {
     script = realm.getScriptLoader().load(parsedScript, className);
   }
   return script.evaluate(realm);
 }
Beispiel #2
0
 private static com.github.anba.es6draft.ast.Script parse(
     Realm realm, Source source, String sourceCode) throws ParserException {
   return realm.getScriptLoader().parseScript(source, sourceCode);
 }