@deepkit/core
Version:
Deepkit core library
31 lines (30 loc) • 1.12 kB
TypeScript
export declare class CompilerContext {
readonly context: Map<string, any>;
protected constVariables: Map<any, string>;
maxReservedVariable: number;
protected reservedNames: Set<string>;
protected variableContext: {
[name: string]: any;
};
/**
* Code that is executed in the context, but before the actual function is generated.
* This helps for example to initialize dynamically some context variables.
*/
preCode: string;
initialiseVariables: string[];
config: {
indent: boolean;
};
constructor(config?: Partial<CompilerContext['config']>);
reserveName(name: string): string;
/**
* Returns always the same variable name for the same value.
* The variable name should not be set afterwards.
*/
reserveConst(value: any, name?: string): string;
reserveVariable(name?: string, value?: any): string;
raw(functionCode: string): Function;
protected format(code: string): string;
build(functionCode: string, ...args: string[]): any;
buildAsync(functionCode: string, ...args: string[]): Function;
}