UNPKG

plaxtony

Version:

Static code analysis of SC2 Galaxy Script

181 lines (180 loc) 7.46 kB
import * as gt from './types'; import { Store, QualifiedSourceFile } from '../service/store'; export declare function getNodeId(node: gt.Node): number; export declare function getSymbolId(symbol: gt.Symbol): number; export declare abstract class AbstractType implements gt.Type { flags: gt.TypeFlags; symbol: gt.Symbol; abstract isAssignableTo(target: AbstractType): boolean; abstract isComparableTo(target: AbstractType): boolean; abstract isBoolExpression(negation: boolean): boolean; isValidBinaryOperation(operation: gt.BinaryOperator, rightType: AbstractType): boolean; isValidPrefixOperation(operation: gt.PrefixUnaryOperator): boolean; isValidPostfixOperation(operation: gt.PostfixUnaryOperator): boolean; getName(): string; } export declare class UnknownType extends AbstractType { flags: gt.TypeFlags; isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; } export declare class IntrinsicType extends AbstractType { readonly name: string; constructor(flags: gt.TypeFlags, name: string); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; isValidBinaryOperation(operation: gt.BinaryOperator, rightType: AbstractType): boolean; isValidPrefixOperation(operation: gt.PrefixUnaryOperator): boolean; isValidPostfixOperation(operation: gt.PostfixUnaryOperator): boolean; getName(): string; } export declare class ComplexType extends AbstractType implements gt.ComplexType { kind: gt.SyntaxKind; constructor(kind: gt.SyntaxKind); get extendsHandle(): boolean; isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; isValidBinaryOperation(operation: gt.BinaryOperator, rightType: AbstractType): boolean; isValidPrefixOperation(operation: gt.PrefixUnaryOperator): boolean; getName(): string; } export declare class LiteralType extends AbstractType { value: gt.Literal; constructor(flags: gt.TypeFlags, value: gt.Literal); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; isValidBinaryOperation(operation: gt.BinaryOperator, rightType: AbstractType): boolean; isValidPrefixOperation(operation: gt.PrefixUnaryOperator): boolean; getName(): string; } export declare class StructType extends AbstractType implements gt.StructType { symbol: gt.Symbol; constructor(symbol: gt.Symbol); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; getName(): string; } export declare class SignatureMeta { returnType: AbstractType; args: AbstractType[]; constructor(returnType: AbstractType, args: AbstractType[]); match(other: SignatureMeta): boolean; toString(): string; } export declare class FunctionType extends AbstractType implements gt.FunctionType { symbol: gt.Symbol; signature: SignatureMeta; constructor(symbol: gt.Symbol, signature: SignatureMeta); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; getName(): string; } export declare type ReferenceKind = gt.SyntaxKind.FuncrefKeyword | gt.SyntaxKind.StructrefKeyword | gt.SyntaxKind.ArrayrefKeyword; export declare class ReferenceType extends AbstractType { kind: ReferenceKind; declaredType: AbstractType; constructor(kind: ReferenceKind, declaredType: AbstractType); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; getName(): string; } export declare class ArrayType extends AbstractType implements gt.ArrayType { elementType: AbstractType; constructor(elementType: AbstractType); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; getName(): string; } export declare class TypedefType extends AbstractType implements gt.TypedefType { referencedType: AbstractType; constructor(referencedType: AbstractType); isAssignableTo(target: AbstractType): boolean; isComparableTo(target: AbstractType): boolean; isBoolExpression(negation: boolean): boolean; getName(): string; } export declare class TypeChecker { private store; private nodeLinks; private diagnostics; private currentSymbolContainer; private currentSymbolReferences; private currentDocuments; constructor(store: Store); private report; private getNodeLinks; private checkTypeAssignableTo; private checkTypeComparableTo; private checkTypeBoolExpression; private getTypeFromArrayTypeNode; private getTypeFromMappedTypeNode; private resolveMappedReference; private getPropertyOfType; private getDeclaredTypeOfStruct; getSignatureOfFunction(fnDecl: gt.FunctionDeclaration): SignatureMeta; private getTypeOfFunction; private getTypeOfTypedef; private getDeclaredTypeOfSymbol; private getTypeFromTypeNode; private getTypeOfSymbol; private getTypeOfVariableOrParameterOrProperty; getTypeOfNode(node: gt.Node, followRef?: boolean): AbstractType; private getRegularTypeOfExpression; private getTypeOfExpression; private clear; checkSourceFile(sourceFile: gt.SourceFile, bindSymbols?: boolean): gt.Diagnostic[]; protected checkSourceFileRecursivelyWorker(sourceFile: gt.SourceFile): void; checkSourceFileRecursively(sourceFile: gt.SourceFile): { success: boolean; diagnostics: Map<string, gt.Diagnostic[]>; sourceFiles: Map<string, QualifiedSourceFile>; }; private checkForIdentifierDefinitions; private checkIsSymbolDeclarationDefined; private checkForUnusedLocalDefinitions; private checkSourceElement; private checkIncludeStatement; private checkTypedefDeclaration; private checkDeclarationType; private checkFunction; private checkLocalDeclaration; private checkParameterDeclaration; private checkVariableDeclaration; private checkTypeNoRefs; private checkPropertyDeclaration; private checkStructDeclaration; private checkIfStatement; private checkForStatement; private checkWhileStatement; private checkBreakOrContinueStatement; private checkReturnStatement; private checkArrayType; private checkMappedType; private checkBlock; private checkExpressionStatement; private checkExpression; private checkExpressionWorker; private checkLiteralExpression; private checkBinaryExpression; private checkParenthesizedExpression; private checkPrefixUnaryExpression; private checkPostfixUnaryExpression; private isTypeIdentifier; private checkIdentifier; private checkCallExpression; private checkIndexedAccess; private checkPropertyAccessExpression; private resolveName; private resolveGlobalSymbol; private resolveEntityName; private getSymbolOfEntityNameOrPropertyAccessExpression; getSymbolAtLocation(node: gt.Node): gt.Symbol | undefined; }