typir
Version:
General purpose type checking library
36 lines • 2.55 kB
TypeScript
/******************************************************************************
* Copyright 2024 TypeFox GmbH
* This program and the accompanying materials are made available under the
* terms of the MIT License, which is available in the project root.
******************************************************************************/
import { Type, TypeStateListener } from '../../graph/type-node.js';
import { TypeInitializer } from '../../initialization/type-initializer.js';
import { TypeInferenceRule } from '../../services/inference.js';
import { TypirServices, TypirSpecifics } from '../../typir.js';
import { InferenceRuleWithOptions } from '../../utils/utils-definitions.js';
import { CreateFunctionTypeDetails, FunctionKind, InferFunctionCall } from './function-kind.js';
import { AvailableFunctionsManager } from './function-overloading.js';
import { FunctionType } from './function-type.js';
/**
* For each call of FunctionKind.create()...finish(), one instance of this class will be created,
* which at some point in time returns a new or an existing FunctionType.
*
* If the function type to create already exists, the given inference rules (and its validation rules) will be registered for the existing function type.
*/
export declare class FunctionTypeInitializer<Specifics extends TypirSpecifics> extends TypeInitializer<FunctionType, Specifics> implements TypeStateListener {
protected readonly typeDetails: CreateFunctionTypeDetails<Specifics>;
protected readonly functions: AvailableFunctionsManager<Specifics>;
protected readonly initialFunctionType: FunctionType;
protected inferenceForCall: Array<InferenceRuleWithOptions<Specifics>>;
protected inferenceForDeclaration: Array<InferenceRuleWithOptions<Specifics>>;
constructor(services: TypirServices<Specifics>, kind: FunctionKind<Specifics>, typeDetails: CreateFunctionTypeDetails<Specifics>);
getTypeInitial(): FunctionType;
onSwitchedToIdentifiable(functionType: Type): void;
onSwitchedToCompleted(functionType: Type): void;
onSwitchedToInvalid(_functionType: Type): void;
protected registerRules(functionName: string, functionType: FunctionType | undefined): void;
protected deregisterRules(functionName: string, functionType: FunctionType | undefined): void;
protected createRules(functionType: FunctionType): void;
protected createFunctionCallInferenceRule(rule: InferFunctionCall<Specifics>, functionType: FunctionType): TypeInferenceRule<Specifics>;
}
//# sourceMappingURL=function-initializer.d.ts.map