Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 543x 543x 543x 543x 145x 145x 543x 543x 543x 543x 543x 145x 145x 145x 41x 41x 145x 543x 543x 543x 541x 543x 413x 413x 2x 2x 413x 541x 541x 541x 1x | import {ExpressionNode, StatementNode} from "../../nodes"; import {TypedIdentifier} from "../../types/_typed_identifier"; import {BasicTypes} from "../basic_types"; import * as Expressions from "../../2_statements/expressions"; import {UnknownType} from "../../types/basic"; import {ScopeType} from "../_scope_type"; import {TypeTableKey} from "./type_table_key"; import {SyntaxInput} from "../_syntax_input"; export class TypeTable { public static runSyntax(node: ExpressionNode | StatementNode, input: SyntaxInput, qualifiedNamePrefix?: string): TypedIdentifier | undefined { // todo, input is currently the statement, but should be the expression? let nameExpr = node.findFirstExpression(Expressions.DefinitionName); if (nameExpr === undefined) { nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName); } if (nameExpr === undefined) { return undefined; } const name = nameExpr.getFirstToken(); let qualifiedName = qualifiedNamePrefix || ""; if (node.getFirstToken().getStr().toUpperCase() === "TYPES") { qualifiedName = qualifiedName + name.getStr(); if (input.scope.getType() === ScopeType.ClassDefinition || input.scope.getType() === ScopeType.Interface) { qualifiedName = input.scope.getName() + "=>" + qualifiedName; } } let type = new BasicTypes(input).parseTable(node, qualifiedName); if (type === undefined) { return new TypedIdentifier(name, input.filename, new UnknownType("TableType, fallback")); } for (const tt of node.findAllExpressions(Expressions.TypeTableKey)) { const error = TypeTableKey.runSyntax(tt, type); if (error) { type = error; } } return new TypedIdentifier(name, input.filename, type); } } |