import { ASTNode } from "../../ast/ASTNode"; import { Observable } from "../../util/observe"; import { ConstructDescription, ConstructExplanation, ProgramContext, SemanticContext, TranslationUnitContext } from "../compilation/contexts"; import { CPPEntity } from "../compilation/entities"; import { Note, NoteRecorder } from "../compilation/errors"; import { FunctionCall } from "./FunctionCall"; import { RuntimeFunction } from "../compilation/functions"; import { CPPObject } from "../runtime/objects"; import { PotentialFullExpression } from "./PotentialFullExpression"; import { AnalyticConstruct } from "../../analysis/predicates"; import { SourceReference } from "../compilation/Program"; import { Simulation } from "../runtime/Simulation"; import { CompleteClassType } from "../compilation/types"; export declare abstract class CPPConstruct { abstract readonly construct_type: string; readonly t_analytic: AnalyticConstruct; private static NEXT_ID; readonly constructId: number; readonly notes: NoteRecorder; readonly context: ContextType; readonly ast?: ASTType; readonly sourceReference?: SourceReference; abstract readonly parent?: CPPConstruct; readonly children: readonly CPPConstruct[]; protected constructor(context: ContextType, ast: ASTType | undefined); attach(child: CPPConstruct): void; attachAll(children: readonly CPPConstruct[]): void; protected abstract onAttach(parent: this["parent"]): void; explain(sim: Simulation, rtConstruct: RuntimeConstruct): ConstructExplanation; describe(sim: Simulation, rtConstruct: RuntimeConstruct): ConstructDescription; addNote(note: Note): void; getContainedNotes(): NoteRecorder; getNearestSourceReference(this: CPPConstruct): SourceReference; isSuccessfullyCompiled(): this is CompiledConstruct; isFullExpression(): boolean; mayManageTemporaryLifetimes(): this is PotentialFullExpression | FunctionCall; findFullExpression(): PotentialFullExpression | FunctionCall | undefined; isSemanticallyEquivalent(other: CPPConstruct, equivalenceContext: SemanticContext): boolean; abstract isSemanticallyEquivalent_impl(other: AnalyticConstruct, equivalenceContext: SemanticContext): boolean; areChildrenSemanticallyEquivalent(other: CPPConstruct, equivalenceContext: SemanticContext): boolean; entitiesUsed(): CPPEntity[]; } export interface SuccessfullyCompiled { readonly _t_isCompiled: never; } export interface CompiledConstruct extends CPPConstruct, SuccessfullyCompiled { } export declare type TranslationUnitConstruct = CPPConstruct; export declare type StackType = "statement" | "expression" | "function" | "initializer" | "call" | "ctor-initializer" | "cleanup"; export declare abstract class RuntimeConstruct { readonly observable: Observable; readonly sim: Simulation; readonly model: C; readonly stackType: StackType; readonly children: { [index: string]: RuntimeConstruct; }; readonly parent?: RuntimeConstruct; private static NEXT_ID; readonly runtimeId: number; /** * WARNING: The containingRuntimeFunction property may be undefined, even though it's type suggests it will always * be defined. In most places where it is accessed, there is an implicit assumption that a runtime construct * situated inside a function is being used (e.g. looking up an entity that depends on a local function) and the * client code would end up needing a non-null assertion anyway. Those non-null assertions are annoying, so * instead we trick the type system and trust that this property will be used appropriately by the programmer. */ readonly containingRuntimeFunction: RuntimeFunction; private _contextualReceiver?; readonly stepsTakenAtStart: number; readonly isActive: boolean; readonly isUpNext: boolean; readonly isWaiting: boolean; readonly isDone: boolean; private cleanupConstruct?; readonly cleanupStarted: boolean; private pauses; constructor(model: C, stackType: StackType, parentOrSim: RuntimeConstruct | Simulation); protected setContainingRuntimeFunction(func: RuntimeFunction): void; setContextualReceiver(obj: CPPObject): void; /** * WARNING: The contextualReceiver property may be undefined, even though it's type suggests it will always * be defined. In most places where it is accessed, there is an implicit assumption that the runtime construct * for whom the lookup is being performed is situated in a context where there is a contextual receiver (e.g. * inside a member function) and the client code would end up needing a non-null assertion anyway. Those * non-null assertions are annoying, so instead we trick the type system and trust that this property will * be used appropriately by the programmer. */ get contextualReceiver(): CPPObject; /** * REQUIRES: this instance is on the top of the execution stack */ stepForward(): void; protected abstract stepForwardImpl(): void; upNext(): void; protected abstract upNextImpl(): void; setPauseWhenUpNext(): void; wait(): void; afterPushed(): void; setCleanupConstruct(cleanupConstruct: RuntimeConstruct): void; startCleanup(): void; afterPopped(): void; private addChild; findParentByStackType(stackType: StackType): RuntimeConstruct | undefined; findParentByModel(model: CPPConstruct): RuntimeConstruct | undefined; explain(): ConstructExplanation; }