import { Node , ESTree } from "../../Node" ; import { BaseClosure , } from '../../Closure' ; import { Messages } from '../../Message' ; import { Interpreter } from '../../../interpreter/main' ; import Scope , { ScopeData , } from '../../Scope' ; import { WithScopeName } from '../../Symbols' ; export function withStatementHandler ( this , node ) { const objectClosure = this . createClosure ( node . object ) ; const bodyClosure = this . createClosure ( node . body ) ; return ( ) => { const data = objectClosure ( ) as ScopeData ; const currentScope = this . getCurrentScope ( ) ; const newScope = new Scope ( data , currentScope , WithScopeName ) ; this . setCurrentScope ( newScope ) ; const result = this . setValue ( bodyClosure ( ) ) ; this . setCurrentScope ( currentScope ) ; return result ; } ; }