import AssignmentNode from "../ast/AssignmentNode"; import { FunctionDeclarationStmt, ModuleDeclarationStmt } from "../ast/statements"; export type KeysOfType = { [P in keyof T]: T[P] extends TProp ? P : never; }[keyof T]; /** * Represents a lexical scope, where variables, modules, and functions are resolved. * It links symbol names with their declarations. */ export default class Scope { /** * References to other, 'include'd or 'use'd file scopes, filled by the solution manager. * We can use those scopes to resolve types from those files. */ siblingScopes: Scope[]; parent: Scope | null; functions: Map; variables: Map; modules: Map; copy(): Scope; lookupVariable(name: string): AssignmentNode; lookupModule(name: string): ModuleDeclarationStmt; lookupFunction(name: string): FunctionDeclarationStmt; private lookup; }