public Completion executeWith(JSObject withObj, BasicBlock block) { LexicalEnvironment oldEnv = this.lexicalEnvironment; LexicalEnvironment withEnv = LexicalEnvironment.newObjectEnvironment(withObj, true, oldEnv); try { this.lexicalEnvironment = withEnv; return block.call(this); } finally { this.lexicalEnvironment = oldEnv; } }
public Completion executeCatch(BasicBlock block, String identifier, Object thrown) { // 12.14 LexicalEnvironment oldEnv = this.lexicalEnvironment; LexicalEnvironment catchEnv = LexicalEnvironment.newDeclarativeEnvironment(oldEnv); catchEnv.getRecord().createMutableBinding(this, identifier, false); catchEnv.getRecord().setMutableBinding(this, identifier, thrown, false); try { this.lexicalEnvironment = catchEnv; return block.call(this); } catch (ThrowException e) { throw e; } catch (Throwable t) { throw new ThrowException(this, t); } finally { this.lexicalEnvironment = oldEnv; } }