type ScopeType = 'block' | 'function' ; export default class Scope { readonly name : string | undefined | Symbol ; readonly parent : Scope | null ; readonly data : ScopeData ; type : ScopeType ; labelStack : string [ ] ; lexDeclared : { [ key ] : { kind : 'const' | 'let' ; init : boolean ; } ; } ; constructor ( data , parent = null , name ? , type = 'function' ) { this . name = name ; this . parent = parent ; this . data = data ; this . labelStack = [ ] ; this . type = type ; this . lexDeclared = Object . create ( null ) ; } } export type ScopeData = { [ prop ] : any ; [ prop ] : any ; } ; export function createScope ( parent = null , name ? , type = 'function' ) { return new Scope ( Object . create ( null ) , parent , name , type ) ; }