@abaplint/core 2.112.4 → 2.112.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abaplint.d.ts +9 -8
- package/build/src/abap/2_statements/statement_parser.js +1 -1
- package/build/src/abap/5_syntax/_current_scope.js +1 -0
- package/build/src/abap/5_syntax/_object_oriented.js +5 -19
- package/build/src/abap/types/class_attributes.js +32 -1
- package/build/src/abap/types/class_definition.js +2 -4
- package/build/src/abap/types/interface_definition.js +34 -34
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
- package/build/src/abap/types/_aliases.js +0 -3
- package/build/src/abap/types/aliases.js +0 -61
package/build/abaplint.d.ts
CHANGED
|
@@ -346,9 +346,11 @@ declare class Attributes implements IAttributes {
|
|
|
346
346
|
private readonly types;
|
|
347
347
|
private readonly tlist;
|
|
348
348
|
private readonly filename;
|
|
349
|
+
private readonly aliases;
|
|
349
350
|
constructor(node: StructureNode, input: SyntaxInput);
|
|
350
351
|
getTypes(): TypeDefinitions;
|
|
351
352
|
getStatic(): ClassAttribute[];
|
|
353
|
+
getAliases(): Alias[];
|
|
352
354
|
getAll(): readonly ClassAttribute[];
|
|
353
355
|
getStaticsByVisibility(visibility: Visibility): ClassAttribute[];
|
|
354
356
|
getInstance(): ClassAttribute[];
|
|
@@ -358,6 +360,7 @@ declare class Attributes implements IAttributes {
|
|
|
358
360
|
findByName(name: string): ClassAttribute | ClassConstant | undefined;
|
|
359
361
|
private parse;
|
|
360
362
|
private parseSection;
|
|
363
|
+
private parseAlias;
|
|
361
364
|
private parseAttribute;
|
|
362
365
|
}
|
|
363
366
|
|
|
@@ -1029,7 +1032,7 @@ declare class ClassDefinition_3 extends Identifier implements IClassDefinition {
|
|
|
1029
1032
|
private readonly finalValue;
|
|
1030
1033
|
private readonly globalValue;
|
|
1031
1034
|
private readonly sharedMemory;
|
|
1032
|
-
private aliases;
|
|
1035
|
+
private readonly aliases;
|
|
1033
1036
|
constructor(node: StructureNode, input: SyntaxInput);
|
|
1034
1037
|
getFriends(): string[];
|
|
1035
1038
|
getEvents(): IEventDefinition[];
|
|
@@ -1040,7 +1043,7 @@ declare class ClassDefinition_3 extends Identifier implements IClassDefinition {
|
|
|
1040
1043
|
isGlobal(): boolean;
|
|
1041
1044
|
isFinal(): boolean;
|
|
1042
1045
|
getImplementing(): readonly IImplementing[];
|
|
1043
|
-
getAliases():
|
|
1046
|
+
getAliases(): Alias[];
|
|
1044
1047
|
isForTesting(): boolean;
|
|
1045
1048
|
isAbstract(): boolean;
|
|
1046
1049
|
isSharedMemory(): boolean;
|
|
@@ -2892,10 +2895,6 @@ declare class IACTemplate extends AbstractObject {
|
|
|
2892
2895
|
getDescription(): string | undefined;
|
|
2893
2896
|
}
|
|
2894
2897
|
|
|
2895
|
-
declare interface IAliases {
|
|
2896
|
-
getAll(): readonly Alias[];
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
2898
|
declare interface IAllowedNaming {
|
|
2900
2899
|
maxLength: number;
|
|
2901
2900
|
allowNamespace: boolean;
|
|
@@ -2925,6 +2924,7 @@ declare interface IAttributes {
|
|
|
2925
2924
|
findByName(name: string): ClassAttribute | ClassConstant | undefined;
|
|
2926
2925
|
getConstants(): readonly ClassConstant[];
|
|
2927
2926
|
getAll(): readonly ClassAttribute[];
|
|
2927
|
+
getAliases(): readonly Alias[];
|
|
2928
2928
|
getTypes(): ITypeDefinitions;
|
|
2929
2929
|
}
|
|
2930
2930
|
|
|
@@ -3188,7 +3188,7 @@ export declare interface IInterfaceDefinition extends Identifier {
|
|
|
3188
3188
|
getEvents(): readonly IEventDefinition[];
|
|
3189
3189
|
isGlobal(): boolean;
|
|
3190
3190
|
getSuperClass(): string | undefined;
|
|
3191
|
-
getAliases():
|
|
3191
|
+
getAliases(): readonly Alias[];
|
|
3192
3192
|
getImplementing(): readonly IImplementing[];
|
|
3193
3193
|
}
|
|
3194
3194
|
|
|
@@ -3579,13 +3579,14 @@ declare class InterfaceDefinition extends Identifier implements IInterfaceDefini
|
|
|
3579
3579
|
constructor(node: StructureNode, input: SyntaxInput);
|
|
3580
3580
|
getSuperClass(): undefined;
|
|
3581
3581
|
getImplementing(): readonly IImplementing[];
|
|
3582
|
-
getAliases():
|
|
3582
|
+
getAliases(): readonly Alias[];
|
|
3583
3583
|
getEvents(): IEventDefinition[];
|
|
3584
3584
|
getAttributes(): IAttributes;
|
|
3585
3585
|
getTypeDefinitions(): ITypeDefinitions;
|
|
3586
3586
|
isLocal(): boolean;
|
|
3587
3587
|
isGlobal(): boolean;
|
|
3588
3588
|
getMethodDefinitions(): IMethodDefinitions;
|
|
3589
|
+
private checkInterfacesExists;
|
|
3589
3590
|
private parse;
|
|
3590
3591
|
}
|
|
3591
3592
|
|
|
@@ -121,7 +121,7 @@ class StatementParser {
|
|
|
121
121
|
continue; // probably punctuation
|
|
122
122
|
}
|
|
123
123
|
const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));
|
|
124
|
-
if (!(s.get() instanceof _statement_1.Unknown)) {
|
|
124
|
+
if (!(s.get() instanceof _statement_1.Unknown) && !(s.get() instanceof _statement_1.Empty)) {
|
|
125
125
|
result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));
|
|
126
126
|
statement = s;
|
|
127
127
|
break;
|
|
@@ -113,6 +113,7 @@ class CurrentScope {
|
|
|
113
113
|
}
|
|
114
114
|
const upper = name.toUpperCase();
|
|
115
115
|
if (this.current.getData().vars[upper] !== undefined) {
|
|
116
|
+
// console.dir(new Error().stack);
|
|
116
117
|
throw new Error(`Variable name "${name}" already defined`);
|
|
117
118
|
}
|
|
118
119
|
else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
|
|
@@ -34,7 +34,7 @@ class ObjectOriented {
|
|
|
34
34
|
return ret;
|
|
35
35
|
}
|
|
36
36
|
addAliasedAttributes(classDefinition) {
|
|
37
|
-
for (const alias of classDefinition.getAliases()
|
|
37
|
+
for (const alias of classDefinition.getAliases()) {
|
|
38
38
|
const comp = alias.getComponent();
|
|
39
39
|
const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
|
|
40
40
|
if (idef) {
|
|
@@ -52,18 +52,6 @@ class ObjectOriented {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
addAliasedTypes(aliases) {
|
|
56
|
-
for (const alias of aliases.getAll()) {
|
|
57
|
-
const comp = alias.getComponent();
|
|
58
|
-
const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
|
|
59
|
-
if (idef) {
|
|
60
|
-
const found = idef.getTypeDefinitions().getByName(comp.split("~")[1]);
|
|
61
|
-
if (found) {
|
|
62
|
-
this.scope.addTypeNamed(alias.getName(), found);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
55
|
findMethodInInterface(interfaceName, methodName) {
|
|
68
56
|
const idef = this.scope.findInterfaceDefinition(interfaceName);
|
|
69
57
|
if (idef) {
|
|
@@ -78,7 +66,7 @@ class ObjectOriented {
|
|
|
78
66
|
return undefined;
|
|
79
67
|
}
|
|
80
68
|
findMethodViaAlias(methodName, def) {
|
|
81
|
-
for (const a of def.getAliases()
|
|
69
|
+
for (const a of def.getAliases()) {
|
|
82
70
|
if (a.getName().toUpperCase() === methodName.toUpperCase()) {
|
|
83
71
|
const comp = a.getComponent();
|
|
84
72
|
const res = this.findMethodInInterface(comp.split("~")[0], comp.split("~")[1]);
|
|
@@ -121,7 +109,6 @@ class ObjectOriented {
|
|
|
121
109
|
return ret;
|
|
122
110
|
}
|
|
123
111
|
searchEvent(def, name) {
|
|
124
|
-
var _a;
|
|
125
112
|
if (def === undefined || name === undefined) {
|
|
126
113
|
return undefined;
|
|
127
114
|
}
|
|
@@ -129,7 +116,7 @@ class ObjectOriented {
|
|
|
129
116
|
if (found) {
|
|
130
117
|
return found;
|
|
131
118
|
}
|
|
132
|
-
for (const a of
|
|
119
|
+
for (const a of def.getAliases() || []) {
|
|
133
120
|
if (a.getName().toUpperCase() === name.toUpperCase()) {
|
|
134
121
|
const comp = a.getComponent();
|
|
135
122
|
const res = this.searchEvent(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
|
|
@@ -146,7 +133,6 @@ class ObjectOriented {
|
|
|
146
133
|
}
|
|
147
134
|
// search in via super class, interfaces and aliases
|
|
148
135
|
searchAttributeName(def, name) {
|
|
149
|
-
var _a;
|
|
150
136
|
if (def === undefined || name === undefined) {
|
|
151
137
|
return undefined;
|
|
152
138
|
}
|
|
@@ -156,7 +142,7 @@ class ObjectOriented {
|
|
|
156
142
|
return a;
|
|
157
143
|
}
|
|
158
144
|
}
|
|
159
|
-
for (const a of
|
|
145
|
+
for (const a of def.getAliases() || []) {
|
|
160
146
|
if (a.getName().toUpperCase() === upper) {
|
|
161
147
|
const comp = a.getComponent();
|
|
162
148
|
const res = this.searchAttributeName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
|
|
@@ -209,7 +195,7 @@ class ObjectOriented {
|
|
|
209
195
|
return a;
|
|
210
196
|
}
|
|
211
197
|
}
|
|
212
|
-
for (const a of def.getAliases()
|
|
198
|
+
for (const a of def.getAliases()) {
|
|
213
199
|
if (a.getName().toUpperCase() === upper) {
|
|
214
200
|
const comp = a.getComponent();
|
|
215
201
|
const res = this.searchConstantName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Attributes = void 0;
|
|
4
4
|
const Structures = require("../3_structures/structures");
|
|
5
5
|
const Statements = require("../2_statements/statements");
|
|
6
|
+
const Expressions = require("../2_statements/expressions");
|
|
6
7
|
const class_attribute_1 = require("./class_attribute");
|
|
7
8
|
const class_constant_1 = require("./class_constant");
|
|
8
9
|
const nodes_1 = require("../nodes");
|
|
@@ -17,13 +18,16 @@ const constants_1 = require("../5_syntax/structures/constants");
|
|
|
17
18
|
const type_definitions_1 = require("./type_definitions");
|
|
18
19
|
const types_1 = require("../5_syntax/structures/types");
|
|
19
20
|
const type_1 = require("../5_syntax/statements/type");
|
|
21
|
+
const _reference_1 = require("../5_syntax/_reference");
|
|
22
|
+
const alias_1 = require("./alias");
|
|
20
23
|
class Attributes {
|
|
21
24
|
constructor(node, input) {
|
|
22
25
|
this.static = [];
|
|
23
26
|
this.instance = [];
|
|
24
27
|
this.constants = [];
|
|
25
|
-
this.
|
|
28
|
+
this.aliases = [];
|
|
26
29
|
this.tlist = [];
|
|
30
|
+
this.filename = input.filename;
|
|
27
31
|
this.parse(node, input);
|
|
28
32
|
this.types = new type_definitions_1.TypeDefinitions(this.tlist);
|
|
29
33
|
}
|
|
@@ -33,6 +37,9 @@ class Attributes {
|
|
|
33
37
|
getStatic() {
|
|
34
38
|
return this.static;
|
|
35
39
|
}
|
|
40
|
+
getAliases() {
|
|
41
|
+
return this.aliases;
|
|
42
|
+
}
|
|
36
43
|
getAll() {
|
|
37
44
|
let res = [];
|
|
38
45
|
res = res.concat(this.static);
|
|
@@ -171,6 +178,9 @@ class Attributes {
|
|
|
171
178
|
else if (ctyp instanceof Statements.ClassData) {
|
|
172
179
|
this.static.push(this.parseAttribute(c, visibility, input));
|
|
173
180
|
}
|
|
181
|
+
else if (ctyp instanceof Statements.Aliases) {
|
|
182
|
+
this.parseAlias(c, visibility, input);
|
|
183
|
+
}
|
|
174
184
|
else if (ctyp instanceof Statements.Constant) {
|
|
175
185
|
const found = new constant_1.Constant().runSyntax(c, input);
|
|
176
186
|
if (found) {
|
|
@@ -189,6 +199,27 @@ class Attributes {
|
|
|
189
199
|
}
|
|
190
200
|
}
|
|
191
201
|
}
|
|
202
|
+
parseAlias(node, visibility, input) {
|
|
203
|
+
const aliasName = node.findFirstExpression(Expressions.SimpleName).getFirstToken();
|
|
204
|
+
const compToken = node.findFirstExpression(Expressions.Field).getFirstToken();
|
|
205
|
+
const compName = compToken.getStr();
|
|
206
|
+
this.aliases.push(new alias_1.Alias(aliasName, visibility, compName, this.filename));
|
|
207
|
+
if (compName.includes("~")) {
|
|
208
|
+
const name = compName.split("~")[0];
|
|
209
|
+
const idef = input.scope.findInterfaceDefinition(name);
|
|
210
|
+
if (idef) {
|
|
211
|
+
input.scope.addReference(compToken, idef, _reference_1.ReferenceType.ObjectOrientedReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
212
|
+
const foundType = idef.getTypeDefinitions().getByName(compName.split("~")[1]);
|
|
213
|
+
if (foundType) {
|
|
214
|
+
input.scope.addTypeNamed(aliasName.getStr(), foundType);
|
|
215
|
+
}
|
|
216
|
+
const foundAttribute = idef.getAttributes().findByName(compName.split("~")[1]);
|
|
217
|
+
if (foundAttribute) {
|
|
218
|
+
input.scope.addNamedIdentifier(aliasName.getStr(), foundAttribute);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
192
223
|
parseAttribute(node, visibility, input) {
|
|
193
224
|
let found = undefined;
|
|
194
225
|
const s = node.get();
|
|
@@ -8,7 +8,6 @@ const Structures = require("../3_structures/structures");
|
|
|
8
8
|
const Expressions = require("../2_statements/expressions");
|
|
9
9
|
const class_attributes_1 = require("./class_attributes");
|
|
10
10
|
const _identifier_1 = require("../4_file_information/_identifier");
|
|
11
|
-
const aliases_1 = require("./aliases");
|
|
12
11
|
const _scope_type_1 = require("../5_syntax/_scope_type");
|
|
13
12
|
const event_definition_1 = require("./event_definition");
|
|
14
13
|
const visibility_1 = require("../4_file_information/visibility");
|
|
@@ -33,9 +32,9 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
33
32
|
this.parse(input, node);
|
|
34
33
|
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
35
34
|
helper.fromSuperClassesAndInterfaces(this);
|
|
36
|
-
helper.addAliasedTypes(this.aliases);
|
|
37
35
|
this.attributes = new class_attributes_1.Attributes(node, input);
|
|
38
36
|
this.types = this.attributes.getTypes();
|
|
37
|
+
this.aliases = this.attributes.getAliases();
|
|
39
38
|
const events = node.findAllStatements(Statements.Events);
|
|
40
39
|
for (const e of events) {
|
|
41
40
|
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input)); // todo, all these are not Public
|
|
@@ -116,7 +115,7 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
116
115
|
}
|
|
117
116
|
names.add(name);
|
|
118
117
|
}
|
|
119
|
-
for (const a of (cdef === null || cdef === void 0 ? void 0 : cdef.getAliases()
|
|
118
|
+
for (const a of (cdef === null || cdef === void 0 ? void 0 : cdef.getAliases()) || []) {
|
|
120
119
|
names.add(a.getName().toUpperCase());
|
|
121
120
|
}
|
|
122
121
|
sup = cdef === null || cdef === void 0 ? void 0 : cdef.getSuperClass();
|
|
@@ -171,7 +170,6 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
171
170
|
input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedUnknownReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
|
-
this.aliases = new aliases_1.Aliases(inputNode, this.filename, input.scope);
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
175
|
exports.ClassDefinition = ClassDefinition;
|
|
@@ -10,11 +10,7 @@ const visibility_1 = require("../4_file_information/visibility");
|
|
|
10
10
|
const _scope_type_1 = require("../5_syntax/_scope_type");
|
|
11
11
|
const event_definition_1 = require("./event_definition");
|
|
12
12
|
const method_definitions_1 = require("./method_definitions");
|
|
13
|
-
const aliases_1 = require("./aliases");
|
|
14
13
|
const _reference_1 = require("../5_syntax/_reference");
|
|
15
|
-
const class_constant_1 = require("./class_constant");
|
|
16
|
-
const _typed_identifier_1 = require("./_typed_identifier");
|
|
17
|
-
const tokens_1 = require("../1_lexer/tokens");
|
|
18
14
|
class InterfaceDefinition extends _identifier_1.Identifier {
|
|
19
15
|
constructor(node, input) {
|
|
20
16
|
if (!(node.get() instanceof Structures.Interface)) {
|
|
@@ -58,37 +54,8 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
58
54
|
return this.methodDefinitions;
|
|
59
55
|
}
|
|
60
56
|
/////////////////
|
|
61
|
-
|
|
57
|
+
checkInterfacesExists(input, node) {
|
|
62
58
|
var _a;
|
|
63
|
-
// todo, proper sequencing, the statements should be processed line by line
|
|
64
|
-
this.attributes = new class_attributes_1.Attributes(node, input);
|
|
65
|
-
this.typeDefinitions = this.attributes.getTypes();
|
|
66
|
-
this.aliases = new aliases_1.Aliases(node, this.filename, input.scope);
|
|
67
|
-
// todo, cleanup aliases, vs "object_oriented.ts" vs "class_implementation.ts"
|
|
68
|
-
// this adds the aliased types to scope?
|
|
69
|
-
for (const a of this.aliases.getAll()) {
|
|
70
|
-
const [objName, fieldName] = a.getComponent().split("~");
|
|
71
|
-
const idef = input.scope.findInterfaceDefinition(objName);
|
|
72
|
-
if (idef) {
|
|
73
|
-
const foundType = idef.getTypeDefinitions().getByName(fieldName);
|
|
74
|
-
if (foundType) {
|
|
75
|
-
input.scope.addTypeNamed(a.getName(), foundType);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
const foundField = idef.getAttributes().findByName(fieldName);
|
|
79
|
-
if (foundField && foundField instanceof class_constant_1.ClassConstant) {
|
|
80
|
-
const token = new tokens_1.Identifier(a.getStart(), a.getName());
|
|
81
|
-
const id = new _typed_identifier_1.TypedIdentifier(token, input.filename, foundField.getType());
|
|
82
|
-
const constant = new class_constant_1.ClassConstant(id, visibility_1.Visibility.Public, foundField.getValue());
|
|
83
|
-
input.scope.addIdentifier(constant);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const events = node.findAllStatements(Statements.Events);
|
|
89
|
-
for (const e of events) {
|
|
90
|
-
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input));
|
|
91
|
-
}
|
|
92
59
|
for (const i of node.findAllStatements(Statements.InterfaceDef)) {
|
|
93
60
|
const token = (_a = i.findDirectExpression(Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
94
61
|
const name = token === null || token === void 0 ? void 0 : token.getStr();
|
|
@@ -106,6 +73,39 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
106
73
|
}
|
|
107
74
|
}
|
|
108
75
|
}
|
|
76
|
+
}
|
|
77
|
+
parse(input, node) {
|
|
78
|
+
this.checkInterfacesExists(input, node);
|
|
79
|
+
// todo, proper sequencing, the statements should be processed line by line
|
|
80
|
+
this.attributes = new class_attributes_1.Attributes(node, input);
|
|
81
|
+
this.typeDefinitions = this.attributes.getTypes();
|
|
82
|
+
this.aliases = this.attributes.getAliases();
|
|
83
|
+
// todo, cleanup aliases, vs "object_oriented.ts" vs "class_implementation.ts"
|
|
84
|
+
// this adds the aliased types to scope?
|
|
85
|
+
/*
|
|
86
|
+
for (const a of this.aliases) {
|
|
87
|
+
const [objName, fieldName] = a.getComponent().split("~");
|
|
88
|
+
const idef = input.scope.findInterfaceDefinition(objName);
|
|
89
|
+
if (idef) {
|
|
90
|
+
const foundType = idef.getTypeDefinitions().getByName(fieldName);
|
|
91
|
+
if (foundType) {
|
|
92
|
+
input.scope.addTypeNamed(a.getName(), foundType);
|
|
93
|
+
} else {
|
|
94
|
+
const foundField = idef.getAttributes().findByName(fieldName);
|
|
95
|
+
if (foundField && foundField instanceof ClassConstant) {
|
|
96
|
+
const token = new TokenIdentifier(a.getStart(), a.getName());
|
|
97
|
+
const id = new TypedIdentifier(token, input.filename, foundField.getType());
|
|
98
|
+
const constant = new ClassConstant(id, Visibility.Public, foundField.getValue());
|
|
99
|
+
input.scope.addIdentifier(constant);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
*/
|
|
105
|
+
const events = node.findAllStatements(Statements.Events);
|
|
106
|
+
for (const e of events) {
|
|
107
|
+
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input));
|
|
108
|
+
}
|
|
109
109
|
this.methodDefinitions = new method_definitions_1.MethodDefinitions(node, input);
|
|
110
110
|
if (this.methodDefinitions.getByName("CONSTRUCTOR") !== undefined) {
|
|
111
111
|
throw new Error("Interfaces cannot have constructor methods");
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Aliases = void 0;
|
|
4
|
-
const alias_1 = require("./alias");
|
|
5
|
-
const Structures = require("../3_structures/structures");
|
|
6
|
-
const Statements = require("../2_statements/statements");
|
|
7
|
-
const Expressions = require("../2_statements/expressions");
|
|
8
|
-
const visibility_1 = require("../4_file_information/visibility");
|
|
9
|
-
const _reference_1 = require("../5_syntax/_reference");
|
|
10
|
-
class Aliases {
|
|
11
|
-
constructor(node, filename, scope) {
|
|
12
|
-
this.aliases = [];
|
|
13
|
-
this.filename = filename;
|
|
14
|
-
this.parse(node, scope, filename);
|
|
15
|
-
}
|
|
16
|
-
getAll() {
|
|
17
|
-
return this.aliases;
|
|
18
|
-
}
|
|
19
|
-
getByName(name) {
|
|
20
|
-
for (const a of this.aliases) {
|
|
21
|
-
if (a.getName().toLowerCase() === name.toLowerCase()) {
|
|
22
|
-
return a;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
/////////////////////////
|
|
28
|
-
parse(node, scope, filename) {
|
|
29
|
-
const cdef = node.findFirstStructure(Structures.ClassDefinition);
|
|
30
|
-
if (cdef) {
|
|
31
|
-
this.parseSection(cdef.findFirstStructure(Structures.PublicSection), visibility_1.Visibility.Public, scope, filename);
|
|
32
|
-
this.parseSection(cdef.findFirstStructure(Structures.PrivateSection), visibility_1.Visibility.Private, scope, filename);
|
|
33
|
-
this.parseSection(cdef.findFirstStructure(Structures.ProtectedSection), visibility_1.Visibility.Protected, scope, filename);
|
|
34
|
-
}
|
|
35
|
-
const idef = node.findFirstStructure(Structures.Interface);
|
|
36
|
-
if (idef) {
|
|
37
|
-
this.parseSection(idef, visibility_1.Visibility.Public, scope, filename);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
parseSection(node, visibility, scope, filename) {
|
|
41
|
-
if (!node) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const list = node.findAllStatements(Statements.Aliases);
|
|
45
|
-
for (const a of list) {
|
|
46
|
-
const name = a.findFirstExpression(Expressions.SimpleName).getFirstToken();
|
|
47
|
-
const compToken = a.findFirstExpression(Expressions.Field).getFirstToken();
|
|
48
|
-
const compName = compToken.getStr();
|
|
49
|
-
this.aliases.push(new alias_1.Alias(name, visibility, compName, this.filename));
|
|
50
|
-
if (compName.includes("~")) {
|
|
51
|
-
const name = compName.split("~")[0];
|
|
52
|
-
const idef = scope.findInterfaceDefinition(name);
|
|
53
|
-
if (idef) {
|
|
54
|
-
scope.addReference(compToken, idef, _reference_1.ReferenceType.ObjectOrientedReference, filename, { ooName: name.toUpperCase(), ooType: "INTF" });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.Aliases = Aliases;
|
|
61
|
-
//# sourceMappingURL=aliases.js.map
|