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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1381x 1381x 1381x 1381x 1x 1x 2383x 2383x 1x 1x 1x 1x 1x 1x 1381x 1381x 1132x 1132x 1132x 1132x 1381x 1381x 1381x 249x 249x 1381x 1x 1x 3645x 2622x 2622x 1023x 1023x 3645x 22x 22x 22x 22x 22x 22x 22x 22x 22x 22x 17x 17x 22x 22x 1023x 1x 1x | import {StructureNode} from "../nodes"; import {Alias} from "./alias"; import * as Structures from "../3_structures/structures"; import * as Statements from "../2_statements/statements"; import * as Expressions from "../2_statements/expressions"; import {Visibility} from "../4_file_information/visibility"; import {IAliases} from "./_aliases"; import {CurrentScope} from "../5_syntax/_current_scope"; import {ReferenceType} from "../5_syntax/_reference"; export class Aliases implements IAliases { private readonly aliases: Alias[]; private readonly filename: string; public constructor(node: StructureNode, filename: string, scope: CurrentScope) { this.aliases = []; this.filename = filename; this.parse(node, scope, filename); } public getAll(): readonly Alias[] { return this.aliases; } public getByName(name: string): Alias | undefined { for (const a of this.aliases) { if (a.getName().toLowerCase() === name.toLowerCase()) { return a; } } return undefined; } ///////////////////////// private parse(node: StructureNode, scope: CurrentScope, filename: string): void { const cdef = node.findFirstStructure(Structures.ClassDefinition); if (cdef) { this.parseSection(cdef.findFirstStructure(Structures.PublicSection), Visibility.Public, scope, filename); this.parseSection(cdef.findFirstStructure(Structures.PrivateSection), Visibility.Private, scope, filename); this.parseSection(cdef.findFirstStructure(Structures.ProtectedSection), Visibility.Protected, scope, filename); } const idef = node.findFirstStructure(Structures.Interface); if (idef) { this.parseSection(idef, Visibility.Public, scope, filename); } } private parseSection(node: StructureNode | undefined, visibility: Visibility, scope: CurrentScope, filename: string): void { if (!node) { return; } const list = node.findAllStatements(Statements.Aliases); for (const a of list) { const name = a.findFirstExpression(Expressions.SimpleName)!.getFirstToken(); const compToken = a.findFirstExpression(Expressions.Field)!.getFirstToken(); const compName = compToken.getStr(); this.aliases.push(new Alias(name, visibility, compName, this.filename)); if (compName.includes("~")) { const name = compName.split("~")[0]; const idef = scope.findInterfaceDefinition(name); if (idef) { scope.addReference(compToken, idef, ReferenceType.ObjectOrientedReference, filename, {ooName: name.toUpperCase(), ooType: "INTF"}); } } } } } |