@abaplint/core 2.119.15 → 2.119.17
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 +2 -0
- package/build/src/abap/2_statements/expressions/parameter_exception.js +2 -1
- package/build/src/abap/5_syntax/_type_utils.js +21 -9
- package/build/src/abap/5_syntax/expressions/field_chain.js +2 -2
- package/build/src/abap/types/class_definition.js +19 -7
- package/build/src/abap/types/interface_definition.js +12 -4
- package/build/src/abap/types/method_definitions.js +13 -7
- package/build/src/abap/types/method_parameters.js +17 -2
- package/build/src/registry.js +1 -1
- package/build/src/rules/parser_bad_exceptions.js +21 -4
- package/build/src/rules/superclass_final.js +32 -0
- package/package.json +3 -3
package/build/abaplint.d.ts
CHANGED
|
@@ -4619,6 +4619,7 @@ declare class MethodDefinitions implements IMethodDefinitions {
|
|
|
4619
4619
|
getByName(name: string | undefined): IMethodDefinition | undefined;
|
|
4620
4620
|
private parseInterface;
|
|
4621
4621
|
private parse;
|
|
4622
|
+
private add;
|
|
4622
4623
|
}
|
|
4623
4624
|
|
|
4624
4625
|
declare class MethodDefRaising extends Expression {
|
|
@@ -4684,6 +4685,7 @@ declare class MethodParameters_2 implements IMethodParameters {
|
|
|
4684
4685
|
getExceptions(): string[];
|
|
4685
4686
|
getParameterDefault(parameter: string): ExpressionNode;
|
|
4686
4687
|
private parse;
|
|
4688
|
+
private checkDuplicateNames;
|
|
4687
4689
|
private workaroundRAP;
|
|
4688
4690
|
private add;
|
|
4689
4691
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ParameterException = void 0;
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
|
+
const tokens_1 = require("../../1_lexer/tokens");
|
|
5
6
|
const _1 = require(".");
|
|
6
7
|
class ParameterException extends combi_1.Expression {
|
|
7
8
|
getRunnable() {
|
|
8
|
-
const name = (0, combi_1.altPrio)("OTHERS", _1.ParameterName);
|
|
9
|
+
const name = (0, combi_1.altPrio)("OTHERS", (0, combi_1.seq)(_1.ParameterName, (0, combi_1.tok)(tokens_1.Dash), _1.ComponentName), _1.ParameterName);
|
|
9
10
|
return (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)("=", (0, combi_1.altPrio)(_1.Integer, _1.SimpleFieldChain), (0, combi_1.optPrio)((0, combi_1.seq)("MESSAGE", _1.Target)))));
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -7,6 +7,7 @@ const table_type_1 = require("../types/basic/table_type");
|
|
|
7
7
|
const enum_type_1 = require("../types/basic/enum_type");
|
|
8
8
|
const cgeneric_type_1 = require("../types/basic/cgeneric_type");
|
|
9
9
|
const Expressions = require("../2_statements/expressions");
|
|
10
|
+
const nodes_1 = require("../nodes");
|
|
10
11
|
// todo: refactor to static? for performance
|
|
11
12
|
class TypeUtils {
|
|
12
13
|
constructor(scope) {
|
|
@@ -257,6 +258,18 @@ class TypeUtils {
|
|
|
257
258
|
return false;
|
|
258
259
|
}
|
|
259
260
|
*/
|
|
261
|
+
var _a;
|
|
262
|
+
if (node.getChildren().length === 4
|
|
263
|
+
&& node.getFirstChild() instanceof nodes_1.TokenNodeRegex
|
|
264
|
+
&& ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "BOOLC") {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
if (node.getChildren().length >= 3) {
|
|
268
|
+
const second = node.getChildren()[1];
|
|
269
|
+
if (second.getFirstToken().getStr() === "&&") {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
260
273
|
const calculated = node.findFirstExpression(Expressions.MethodCallChain) !== undefined
|
|
261
274
|
|| node.findFirstExpression(Expressions.StringTemplate) !== undefined
|
|
262
275
|
|| node.findFirstExpression(Expressions.ArithOperator) !== undefined;
|
|
@@ -270,7 +283,7 @@ class TypeUtils {
|
|
|
270
283
|
return this.isAssignable(source, target);
|
|
271
284
|
}
|
|
272
285
|
isAssignableStrict(source, target, node) {
|
|
273
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
286
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
274
287
|
const calculated = node ? this.isCalculated(node) : false;
|
|
275
288
|
/*
|
|
276
289
|
console.dir(source);
|
|
@@ -329,16 +342,15 @@ class TypeUtils {
|
|
|
329
342
|
else if (source instanceof basic_1.StringType) {
|
|
330
343
|
if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
|
|
331
344
|
return false;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (source.getAbstractTypeData()
|
|
335
|
-
|
|
345
|
+
}
|
|
346
|
+
else if (target instanceof basic_1.CharacterType) {
|
|
347
|
+
if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
|
|
348
|
+
return true;
|
|
336
349
|
}
|
|
337
350
|
return false;
|
|
338
|
-
*/
|
|
339
351
|
}
|
|
340
352
|
else if (target instanceof basic_1.IntegerType) {
|
|
341
|
-
if (((
|
|
353
|
+
if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
|
|
342
354
|
return true;
|
|
343
355
|
}
|
|
344
356
|
return false;
|
|
@@ -348,7 +360,7 @@ class TypeUtils {
|
|
|
348
360
|
return false;
|
|
349
361
|
}
|
|
350
362
|
else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
|
|
351
|
-
if (((
|
|
363
|
+
if (((_j = source.getAbstractTypeData()) === null || _j === void 0 ? void 0 : _j.derivedFromConstant) === true) {
|
|
352
364
|
return true;
|
|
353
365
|
}
|
|
354
366
|
return false;
|
|
@@ -392,7 +404,7 @@ class TypeUtils {
|
|
|
392
404
|
return false;
|
|
393
405
|
}
|
|
394
406
|
else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
|
|
395
|
-
if (((
|
|
407
|
+
if (((_k = source.getAbstractTypeData()) === null || _k === void 0 ? void 0 : _k.derivedFromConstant) === true) {
|
|
396
408
|
return true;
|
|
397
409
|
}
|
|
398
410
|
return false;
|
|
@@ -24,8 +24,8 @@ class FieldChain {
|
|
|
24
24
|
&& node.findDirectExpression(Expressions.ComponentName)) {
|
|
25
25
|
// workaround for names with dashes, eg. "sy-repid"
|
|
26
26
|
const concat = node.concatTokens().replace(/ /g, "");
|
|
27
|
-
const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
|
|
28
|
-
const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
|
|
27
|
+
const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(/ /g, "")) || "";
|
|
28
|
+
const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens().replace(/ /g, "")) || "";
|
|
29
29
|
const found = input.scope.findVariable(concat.replace(offset, "").replace(length, ""));
|
|
30
30
|
if (found) {
|
|
31
31
|
if (refType) {
|
|
@@ -41,7 +41,8 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
41
41
|
for (const e of events) {
|
|
42
42
|
const eventName = (_a = e.findDirectExpression(Expressions.EventName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
43
43
|
if (this.events.find(ev => ev.getName().toUpperCase() === eventName) !== undefined) {
|
|
44
|
-
|
|
44
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, e.getFirstToken(), "Event " + eventName + " already defined"));
|
|
45
|
+
continue;
|
|
45
46
|
}
|
|
46
47
|
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input)); // todo, all these are not Public
|
|
47
48
|
}
|
|
@@ -61,8 +62,8 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
61
62
|
this.createVisibilityValue = visibility_1.Visibility.Public;
|
|
62
63
|
}
|
|
63
64
|
// perform checks after everything has been initialized
|
|
64
|
-
this.checkMethodsFromSuperClasses(input
|
|
65
|
-
this.checkMethodNameLength();
|
|
65
|
+
this.checkMethodsFromSuperClasses(input);
|
|
66
|
+
this.checkMethodNameLength(input);
|
|
66
67
|
}
|
|
67
68
|
getFriends() {
|
|
68
69
|
return this.friends;
|
|
@@ -118,18 +119,20 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
118
119
|
const name = token === null || token === void 0 ? void 0 : token.getStr();
|
|
119
120
|
return name;
|
|
120
121
|
}
|
|
121
|
-
checkMethodNameLength() {
|
|
122
|
+
checkMethodNameLength(input) {
|
|
122
123
|
for (const m of this.methodDefs.getAll()) {
|
|
123
124
|
if (m.getName().length > 30 && m.getName().includes("~") === false) {
|
|
124
125
|
const message = `Method name "${m.getName()}" is too long, maximum length is 30 characters`;
|
|
125
|
-
|
|
126
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), message));
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
checkMethodsFromSuperClasses(
|
|
130
|
+
checkMethodsFromSuperClasses(input) {
|
|
130
131
|
var _a;
|
|
132
|
+
const scope = input.scope;
|
|
131
133
|
let sup = this.getSuperClass();
|
|
132
134
|
const names = new Set();
|
|
135
|
+
const methods = new Map();
|
|
133
136
|
while (sup !== undefined) {
|
|
134
137
|
const cdef = scope.findClassDefinition(sup);
|
|
135
138
|
for (const m of ((_a = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
|
|
@@ -143,6 +146,9 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
143
146
|
continue;
|
|
144
147
|
}
|
|
145
148
|
names.add(name);
|
|
149
|
+
if (methods.has(name) === false) {
|
|
150
|
+
methods.set(name, m.getVisibility());
|
|
151
|
+
}
|
|
146
152
|
}
|
|
147
153
|
for (const a of (cdef === null || cdef === void 0 ? void 0 : cdef.getAliases()) || []) {
|
|
148
154
|
names.add(a.getName().toUpperCase());
|
|
@@ -152,7 +158,13 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
152
158
|
for (const m of this.getMethodDefinitions().getAll()) {
|
|
153
159
|
if (names.has(m.getName().toUpperCase())
|
|
154
160
|
&& m.isRedefinition() === false) {
|
|
155
|
-
|
|
161
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), `${m.getName().toUpperCase()} already declared in superclass`));
|
|
162
|
+
}
|
|
163
|
+
const superVisibility = methods.get(m.getName().toUpperCase());
|
|
164
|
+
if (m.isRedefinition() === true
|
|
165
|
+
&& superVisibility !== undefined
|
|
166
|
+
&& m.getVisibility() !== superVisibility) {
|
|
167
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), `${m.getName().toUpperCase()} redefinition visibility cannot be changed`));
|
|
156
168
|
}
|
|
157
169
|
}
|
|
158
170
|
}
|
|
@@ -11,6 +11,7 @@ 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
13
|
const _reference_1 = require("../5_syntax/_reference");
|
|
14
|
+
const _syntax_input_1 = require("../5_syntax/_syntax_input");
|
|
14
15
|
const _object_oriented_1 = require("../5_syntax/_object_oriented");
|
|
15
16
|
class InterfaceDefinition extends _identifier_1.Identifier {
|
|
16
17
|
constructor(node, input) {
|
|
@@ -27,7 +28,7 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
27
28
|
this.parse(input, node);
|
|
28
29
|
input.scope.pop(node.getLastToken().getEnd());
|
|
29
30
|
// perform checks after everything has been initialized
|
|
30
|
-
this.checkMethodNameLength();
|
|
31
|
+
this.checkMethodNameLength(input);
|
|
31
32
|
}
|
|
32
33
|
getSuperClass() {
|
|
33
34
|
return undefined;
|
|
@@ -57,11 +58,11 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
57
58
|
return this.methodDefinitions;
|
|
58
59
|
}
|
|
59
60
|
/////////////////
|
|
60
|
-
checkMethodNameLength() {
|
|
61
|
+
checkMethodNameLength(input) {
|
|
61
62
|
for (const m of this.methodDefinitions.getAll()) {
|
|
62
63
|
if (m.getName().length > 30) {
|
|
63
64
|
const message = `Method name "${m.getName()}" is too long, maximum length is 30 characters`;
|
|
64
|
-
|
|
65
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), message));
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -86,6 +87,7 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
parse(input, node) {
|
|
90
|
+
var _a;
|
|
89
91
|
this.checkInterfacesExists(input, node);
|
|
90
92
|
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
91
93
|
helper.fromInterfaces(this);
|
|
@@ -95,11 +97,17 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
95
97
|
this.aliases = this.attributes.getAliases();
|
|
96
98
|
const events = node.findAllStatements(Statements.Events);
|
|
97
99
|
for (const e of events) {
|
|
100
|
+
const eventName = (_a = e.findDirectExpression(Expressions.EventName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
101
|
+
if (this.events.find(ev => ev.getName().toUpperCase() === eventName) !== undefined) {
|
|
102
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, e.getFirstToken(), "Event " + eventName + " already defined"));
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
98
105
|
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input));
|
|
99
106
|
}
|
|
100
107
|
this.methodDefinitions = new method_definitions_1.MethodDefinitions(node, input);
|
|
101
108
|
if (this.methodDefinitions.getByName("CONSTRUCTOR") !== undefined) {
|
|
102
|
-
|
|
109
|
+
const constructor = this.methodDefinitions.getByName("CONSTRUCTOR");
|
|
110
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, constructor.getToken(), "Interfaces cannot have constructor methods"));
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
}
|
|
@@ -5,6 +5,7 @@ const method_definition_1 = require("./method_definition");
|
|
|
5
5
|
const Structures = require("../3_structures/structures");
|
|
6
6
|
const statements_1 = require("../2_statements/statements");
|
|
7
7
|
const visibility_1 = require("../4_file_information/visibility");
|
|
8
|
+
const _syntax_input_1 = require("../5_syntax/_syntax_input");
|
|
8
9
|
class MethodDefinitions {
|
|
9
10
|
constructor(node, input) {
|
|
10
11
|
this.all = {};
|
|
@@ -26,8 +27,7 @@ class MethodDefinitions {
|
|
|
26
27
|
parseInterface(node, input) {
|
|
27
28
|
const defs = node.findAllStatements(statements_1.MethodDef);
|
|
28
29
|
for (const def of defs) {
|
|
29
|
-
|
|
30
|
-
this.all[m.getName().toUpperCase()] = m;
|
|
30
|
+
this.add(def, visibility_1.Visibility.Public, input);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
parse(node, input) {
|
|
@@ -41,19 +41,25 @@ class MethodDefinitions {
|
|
|
41
41
|
}
|
|
42
42
|
const pri = cdef.findDirectStructure(Structures.PrivateSection);
|
|
43
43
|
for (const def of (pri === null || pri === void 0 ? void 0 : pri.findAllStatements(statements_1.MethodDef)) || []) {
|
|
44
|
-
|
|
45
|
-
this.all[m.getName().toUpperCase()] = m;
|
|
44
|
+
this.add(def, visibility_1.Visibility.Private, input);
|
|
46
45
|
}
|
|
47
46
|
const pro = node.findDirectStructure(Structures.ProtectedSection);
|
|
48
47
|
for (const def of (pro === null || pro === void 0 ? void 0 : pro.findAllStatements(statements_1.MethodDef)) || []) {
|
|
49
|
-
|
|
50
|
-
this.all[m.getName().toUpperCase()] = m;
|
|
48
|
+
this.add(def, visibility_1.Visibility.Protected, input);
|
|
51
49
|
}
|
|
52
50
|
const pub = node.findDirectStructure(Structures.PublicSection);
|
|
53
51
|
for (const def of (pub === null || pub === void 0 ? void 0 : pub.findAllStatements(statements_1.MethodDef)) || []) {
|
|
54
|
-
|
|
52
|
+
this.add(def, visibility_1.Visibility.Public, input);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
add(def, visibility, input) {
|
|
56
|
+
try {
|
|
57
|
+
const m = new method_definition_1.MethodDefinition(def, visibility, input);
|
|
55
58
|
this.all[m.getName().toUpperCase()] = m;
|
|
56
59
|
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, def.getFirstToken(), e.message));
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
exports.MethodDefinitions = MethodDefinitions;
|
|
@@ -32,8 +32,13 @@ class MethodParameters {
|
|
|
32
32
|
// need the scope for LIKE typing inside method parameters
|
|
33
33
|
const parentName = input.scope.getName();
|
|
34
34
|
input.scope.push(_scope_type_1.ScopeType.MethodDefinition, "method definition", node.getStart(), input.filename);
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
try {
|
|
36
|
+
this.parse(node, input, parentName, abstractMethod);
|
|
37
|
+
this.checkDuplicateNames();
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
input.scope.pop(node.getEnd());
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
getFilename() {
|
|
39
44
|
return this.filename;
|
|
@@ -170,6 +175,16 @@ class MethodParameters {
|
|
|
170
175
|
}
|
|
171
176
|
this.workaroundRAP(node, input, parentName);
|
|
172
177
|
}
|
|
178
|
+
checkDuplicateNames() {
|
|
179
|
+
const names = new Set();
|
|
180
|
+
for (const parameter of this.getAll()) {
|
|
181
|
+
const name = parameter.getName().toUpperCase();
|
|
182
|
+
if (names.has(name)) {
|
|
183
|
+
throw new Error(`Method parameter "${name}" already defined`);
|
|
184
|
+
}
|
|
185
|
+
names.add(name);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
173
188
|
workaroundRAP(node, input, parentName) {
|
|
174
189
|
const resultName = node.findExpressionAfterToken("RESULT");
|
|
175
190
|
const isRap = node.findExpressionAfterToken("IMPORTING");
|
package/build/src/registry.js
CHANGED
|
@@ -22,10 +22,6 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
|
|
|
22
22
|
title: "Parser Error, bad EXCEPTIONS in CALL FUNCTION",
|
|
23
23
|
shortDescription: `Checks for syntax not recognized by abaplint, related to EXCEPTIONS in CALL FUNCTION.`,
|
|
24
24
|
tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
|
|
25
|
-
/*
|
|
26
|
-
badExample: `IF ( foo = 'bar').`,
|
|
27
|
-
goodExample: `IF ( foo = 'bar' ).`,
|
|
28
|
-
*/
|
|
29
25
|
};
|
|
30
26
|
}
|
|
31
27
|
getConfig() {
|
|
@@ -40,6 +36,15 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
|
|
|
40
36
|
if (!(statement.get() instanceof Statements.CallFunction)) {
|
|
41
37
|
continue;
|
|
42
38
|
}
|
|
39
|
+
const exceptionTokens = this.findExceptionTokens(statement);
|
|
40
|
+
if (exceptionTokens !== undefined
|
|
41
|
+
&& this.containsMixedExceptionSyntax(statement.findAllExpressions(Expressions.ParameterException))) {
|
|
42
|
+
const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
|
|
43
|
+
for (const token of exceptionTokens) {
|
|
44
|
+
issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
45
|
+
}
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
43
48
|
for (const e of statement.findAllExpressions(Expressions.ParameterException)) {
|
|
44
49
|
if (e.findDirectTokenByText("=") === undefined) {
|
|
45
50
|
const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
|
|
@@ -49,6 +54,18 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
|
|
|
49
54
|
}
|
|
50
55
|
return issues;
|
|
51
56
|
}
|
|
57
|
+
containsMixedExceptionSyntax(exceptions) {
|
|
58
|
+
return exceptions.some(e => e.findDirectTokenByText("=") === undefined)
|
|
59
|
+
&& exceptions.some(e => e.findDirectTokenByText("=") !== undefined);
|
|
60
|
+
}
|
|
61
|
+
findExceptionTokens(statement) {
|
|
62
|
+
const tokens = statement.getTokens();
|
|
63
|
+
const index = tokens.findIndex(t => t.getStr().toUpperCase() === "EXCEPTIONS");
|
|
64
|
+
if (index === -1) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return tokens.slice(index).filter(t => t.getStr() !== ".");
|
|
68
|
+
}
|
|
52
69
|
}
|
|
53
70
|
exports.ParserBadExceptions = ParserBadExceptions;
|
|
54
71
|
//# sourceMappingURL=parser_bad_exceptions.js.map
|
|
@@ -6,6 +6,7 @@ const _abap_rule_1 = require("./_abap_rule");
|
|
|
6
6
|
const Objects = require("../objects");
|
|
7
7
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
9
|
+
const include_graph_1 = require("../utils/include_graph");
|
|
9
10
|
class SuperclassFinalConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
11
|
}
|
|
11
12
|
exports.SuperclassFinalConf = SuperclassFinalConf;
|
|
@@ -13,6 +14,7 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
|
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
16
|
this.conf = new SuperclassFinalConf();
|
|
17
|
+
this.graph = undefined;
|
|
16
18
|
}
|
|
17
19
|
getMetadata() {
|
|
18
20
|
return {
|
|
@@ -51,6 +53,9 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
if (found === undefined && obj instanceof Objects.Program) {
|
|
57
|
+
found = this.findInRelatedProgramIncludes(file, sup);
|
|
58
|
+
}
|
|
54
59
|
if (found === undefined) {
|
|
55
60
|
const clas = this.reg.getObject("CLAS", sup);
|
|
56
61
|
if (clas) {
|
|
@@ -70,6 +75,33 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
|
|
|
70
75
|
}
|
|
71
76
|
return output;
|
|
72
77
|
}
|
|
78
|
+
findInRelatedProgramIncludes(file, superClassName) {
|
|
79
|
+
if (this.graph === undefined) {
|
|
80
|
+
this.graph = new include_graph_1.IncludeGraph(this.reg);
|
|
81
|
+
}
|
|
82
|
+
const mainFilenames = this.graph.listMainForInclude(file.getFilename());
|
|
83
|
+
if (mainFilenames.length === 0) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
for (const object of this.reg.getObjectsByType("PROG")) {
|
|
87
|
+
if (!(object instanceof Objects.Program)) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const programFile = object.getMainABAPFile();
|
|
91
|
+
if (programFile === undefined) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const programMainFilenames = this.graph.listMainForInclude(programFile.getFilename());
|
|
95
|
+
if (mainFilenames.some(filename => programMainFilenames.includes(filename)) === false) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const found = programFile.getInfo().getClassDefinitionByName(superClassName);
|
|
99
|
+
if (found !== undefined) {
|
|
100
|
+
return found;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
73
105
|
}
|
|
74
106
|
exports.SuperclassFinal = SuperclassFinal;
|
|
75
107
|
//# sourceMappingURL=superclass_final.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.119.
|
|
3
|
+
"version": "2.119.17",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.58.
|
|
53
|
+
"@microsoft/api-extractor": "^7.58.7",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
56
|
"@types/node": "^24.12.2",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.
|
|
66
|
+
"fast-xml-parser": "^5.8.0",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|