use of com.github.anba.es6draft.runtime.internal.ScriptCache in project es6draft by anba.
the class ShellGlobalObject method include.
/**
* Parses, compiles and executes the javascript file. (Uses the script cache.)
*
* @param file
* the path to the script file
* @throws IOException
* if there was any I/O error
* @throws ParserException
* if the source contains any syntax errors
* @throws CompilationException
* if the parsed source could not be compiled
*/
public void include(Path file) throws IOException, ParserException, CompilationException {
Realm realm = getRealm();
ScriptCache scriptCache = getRuntimeContext().getScriptCache();
Path path = getRuntimeContext().getBaseDirectory().resolve(file);
Script script = scriptCache.get(realm.getScriptLoader(), path);
script.evaluate(realm);
}
use of com.github.anba.es6draft.runtime.internal.ScriptCache in project es6draft by anba.
the class TestGlobals method before.
@Override
protected void before() throws Throwable {
if (!Resources.isEnabled(configuration)) {
// skip initialization if test suite not enabled
return;
}
scriptCache = new ScriptCache();
// read options ...
EnumSet<CompatibilityOption> compatibilityOptions = EnumSet.noneOf(CompatibilityOption.class);
optionsFromMode(compatibilityOptions, configuration.getString("mode", DEFAULT_MODE));
optionsFromVersion(compatibilityOptions, configuration.getString("version", DEFAULT_VERSION));
optionsFromStage(compatibilityOptions, configuration.getString("stage", DEFAULT_STAGE));
optionsFromFeatures(compatibilityOptions, configuration.getList("features", DEFAULT_FEATURES));
options = compatibilityOptions;
// pre-compile initialization scripts and modules
scripts = compileScripts();
modules = compileModules();
}
Aggregations