import { Node , ESTree } from "../../Node" ; import { BaseClosure , } from '../../Closure' ; import { Messages } from '../../Message' ; import { Interpreter } from '../../../interpreter/main' ; import { EmptyStatementReturn } from '../../Symbols' ; import { Return , BreakLabel , ContinueLabel } from '../../TokenClass' ; import { Break , Continue } from '../../Symbols' ; import Scope , { createScope } from "../../Scope" ; export function groupStatementHandler ( this , node ) { const stmtClosures = ( node . body as Node [ ] ) . map ( ( stmt ) => { return this . createClosure ( stmt ) ; } ) ; return ( ) => { let result = EmptyStatementReturn ; let prevScope ; let newScope ; for ( let i = 0 ; i < stmtClosures . length ; i ++ ) { const stmtClosure = stmtClosures [ i ] ; const ret = this . setValue ( stmtClosure ( ) ) ; if ( ret === EmptyStatementReturn ) continue ; result = ret ; if ( result instanceof Return || result instanceof BreakLabel || result instanceof ContinueLabel || result === Break || result === Continue ) { break ; } } return result ; } ; }