Search in sources :

Example 1 with StopExecutionException

use of com.github.anba.es6draft.repl.functions.StopExecutionException in project es6draft by anba.

the class Repl method loop.

/**
 * REPL: Loop
 */
private void loop() throws InterruptedException {
    Realm realm = newRealm();
    World world = realm.getWorld();
    JobSource jobSource = createJobSource(realm);
    for (; ; ) {
        try {
            world.runEventLoop(jobSource);
            return;
        } catch (StopExecutionException e) {
            if (e.getReason() == Reason.Quit) {
                System.exit(0);
            }
        } catch (ParserExceptionWithSource e) {
            handleException(e);
        } catch (ScriptException e) {
            handleException(realm.defaultContext(), e);
        } catch (UnhandledRejectionException e) {
            handleException(realm.defaultContext(), e);
        } catch (StackOverflowError e) {
            handleException(realm.defaultContext(), e);
        } catch (OutOfMemoryError e) {
            handleException(realm.defaultContext(), e);
        } catch (InternalException e) {
            handleException(e);
        } catch (BootstrapMethodError e) {
            handleException(e.getCause());
        } catch (UncheckedIOException e) {
            handleException(e.getCause());
        }
    }
}
Also used : StopExecutionException(com.github.anba.es6draft.repl.functions.StopExecutionException) World(com.github.anba.es6draft.runtime.World) InitializeHostDefinedRealm(com.github.anba.es6draft.runtime.Realm.InitializeHostDefinedRealm) Realm(com.github.anba.es6draft.runtime.Realm)

Aggregations

StopExecutionException (com.github.anba.es6draft.repl.functions.StopExecutionException)1 Realm (com.github.anba.es6draft.runtime.Realm)1 InitializeHostDefinedRealm (com.github.anba.es6draft.runtime.Realm.InitializeHostDefinedRealm)1 World (com.github.anba.es6draft.runtime.World)1