import { Node , ESTree } from "../../Node" ; import { BaseClosure , } from '../../Closure' ; import { Messages } from '../../Message' ; import { Interpreter } from '../../../interpreter/main' ; import { EmptyStatementReturn } from '../../Symbols' ; export function functionDeclarationHandler ( this , node ) { let functionClosure ; let functionName ; if ( node . id ) { functionClosure = this . functionExpressionHandler ( node ) ; Object . defineProperty ( functionClosure , "isFunctionDeclareClosure" , { value : true , writable : false , configurable : false , enumerable : false , } ) ; functionName = node . id . name ; this . funcDeclaration ( node . id . name , undefined ) ; } return ( ) => { if ( functionClosure ) { if ( this . _functionVarScope && ( this . _functionVarScope . data [ functionName ] === undefined || typeof this . _functionVarScope . data [ functionName ] == 'function' ) ) { let theFunc = functionClosure ( this . getCurrentScope ( ) ) ; this . _functionVarScope . data [ functionName ] = theFunc ; } } return EmptyStatementReturn ; } ; }