1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const index_1 = require("../sources/index");
|
4 | const abstract_1 = require("./abstract");
|
5 | const container_1 = require("./container");
|
6 | class ProjectReflection extends container_1.ContainerReflection {
|
7 | constructor(name) {
|
8 | super(name, abstract_1.ReflectionKind.Global);
|
9 | this.reflections = {};
|
10 | this.symbolMapping = {};
|
11 | this.directory = new index_1.SourceDirectory();
|
12 | this.files = [];
|
13 | }
|
14 | isProject() {
|
15 | return true;
|
16 | }
|
17 | getReflectionsByKind(kind) {
|
18 | const values = [];
|
19 | for (let id in this.reflections) {
|
20 | const reflection = this.reflections[id];
|
21 | if (reflection.kindOf(kind)) {
|
22 | values.push(reflection);
|
23 | }
|
24 | }
|
25 | return values;
|
26 | }
|
27 | findReflectionByName(arg) {
|
28 | const names = Array.isArray(arg) ? arg : arg.split('.');
|
29 | const name = names.pop();
|
30 | search: for (let key in this.reflections) {
|
31 | const reflection = this.reflections[key];
|
32 | if (reflection.name !== name) {
|
33 | continue;
|
34 | }
|
35 | let depth = names.length - 1;
|
36 | let target = reflection;
|
37 | while ((target = target.parent) && depth >= 0) {
|
38 | if (target.name !== names[depth]) {
|
39 | continue search;
|
40 | }
|
41 | depth -= 1;
|
42 | }
|
43 | return reflection;
|
44 | }
|
45 | return undefined;
|
46 | }
|
47 | }
|
48 | exports.ProjectReflection = ProjectReflection;
|
49 |
|
\ | No newline at end of file |