@abaplint/core 2.120.67 → 2.120.69
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 +10 -0
- package/build/src/abap/5_syntax/_current_scope.js +11 -0
- package/build/src/abap/5_syntax/_object_oriented.js +36 -0
- package/build/src/abap/5_syntax/expressions/form_param.js +3 -0
- package/build/src/abap/5_syntax/expressions/method_call_chain.js +13 -0
- package/build/src/abap/5_syntax/expressions/method_param.js +3 -0
- package/build/src/abap/5_syntax/expressions/method_source.js +13 -0
- package/build/src/abap/5_syntax/expressions/source.js +20 -0
- package/build/src/abap/5_syntax/statements/create_object.js +2 -2
- package/build/src/abap/types/basic/index.js +1 -0
- package/build/src/abap/types/basic/ngeneric_type.js +23 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +52 -0
- package/build/src/rules/rfc_error_handling.js +14 -9
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -513,6 +513,7 @@ declare namespace BasicTypes {
|
|
|
513
513
|
HexType,
|
|
514
514
|
IntegerType,
|
|
515
515
|
Integer8Type,
|
|
516
|
+
NGenericType,
|
|
516
517
|
NumericGenericType,
|
|
517
518
|
NumericType,
|
|
518
519
|
ObjectReferenceType,
|
|
@@ -1628,6 +1629,7 @@ export declare class CurrentScope {
|
|
|
1628
1629
|
isInStaticMethod(): boolean;
|
|
1629
1630
|
addLocalFriend(className: string, friendName: string): void;
|
|
1630
1631
|
isLocalFriend(className: string, friendName: string): boolean;
|
|
1632
|
+
getEnclosingMethodName(): string | undefined;
|
|
1631
1633
|
getEnclosingClassName(): string | undefined;
|
|
1632
1634
|
isGlobalOO(): boolean;
|
|
1633
1635
|
isTypePool(): boolean;
|
|
@@ -5132,6 +5134,14 @@ declare class NewPage implements IStatement {
|
|
|
5132
5134
|
getMatcher(): IStatementRunnable;
|
|
5133
5135
|
}
|
|
5134
5136
|
|
|
5137
|
+
declare class NGenericType extends NumericType {
|
|
5138
|
+
private static readonly singleton;
|
|
5139
|
+
static get(): NGenericType;
|
|
5140
|
+
private constructor();
|
|
5141
|
+
toText(): string;
|
|
5142
|
+
isGeneric(): boolean;
|
|
5143
|
+
}
|
|
5144
|
+
|
|
5135
5145
|
declare namespace Nodes {
|
|
5136
5146
|
export {
|
|
5137
5147
|
ExpressionNode,
|
|
@@ -515,6 +515,17 @@ class CurrentScope {
|
|
|
515
515
|
var _a;
|
|
516
516
|
return ((_a = this.localFriends.get(className.toUpperCase())) === null || _a === void 0 ? void 0 : _a.includes(friendName.toUpperCase())) === true;
|
|
517
517
|
}
|
|
518
|
+
getEnclosingMethodName() {
|
|
519
|
+
let curr = this.current;
|
|
520
|
+
while (curr !== undefined) {
|
|
521
|
+
const stype = curr.getIdentifier().stype;
|
|
522
|
+
if (stype === _scope_type_1.ScopeType.Method || stype === _scope_type_1.ScopeType.MethodInstance) {
|
|
523
|
+
return curr.getIdentifier().sname;
|
|
524
|
+
}
|
|
525
|
+
curr = curr.getParent();
|
|
526
|
+
}
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
518
529
|
getEnclosingClassName() {
|
|
519
530
|
let curr = this.current;
|
|
520
531
|
while (curr !== undefined) {
|
|
@@ -212,6 +212,42 @@ class ObjectOriented {
|
|
|
212
212
|
}
|
|
213
213
|
return "private";
|
|
214
214
|
}
|
|
215
|
+
// the fixture methods of a test class are called by ABAP Unit only, returns the message otherwise
|
|
216
|
+
checkSpecialTestMethodCall(method, foundDef) {
|
|
217
|
+
if (method === undefined
|
|
218
|
+
|| !(foundDef instanceof types_1.ClassDefinition)
|
|
219
|
+
|| foundDef.isForTesting() === false) {
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
const name = method.getName().toUpperCase();
|
|
223
|
+
if (["SETUP", "TEARDOWN", "CLASS_SETUP", "CLASS_TEARDOWN"].includes(name) === false) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
return `The special method "${name}" cannot be called directly`;
|
|
227
|
+
}
|
|
228
|
+
// SUPER-> can only call the previous implementation of the method it is used in, returns the message otherwise
|
|
229
|
+
// both names are resolved in the super class, so an alias and the method it stands for are the same
|
|
230
|
+
checkSuperCall(superDef, methodName) {
|
|
231
|
+
const enclosing = this.scope.getEnclosingMethodName();
|
|
232
|
+
if (methodName === undefined
|
|
233
|
+
|| enclosing === undefined
|
|
234
|
+
|| methodName.toUpperCase() === enclosing.toUpperCase()) {
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
const message = "SUPER-> can only be used to call the previous implementation of the same method";
|
|
238
|
+
// a method that is not a redefinition has no previous implementation
|
|
239
|
+
const enclosingClass = this.scope.findClassDefinition(this.scope.getEnclosingClassName());
|
|
240
|
+
const ownDefinition = enclosingClass === null || enclosingClass === void 0 ? void 0 : enclosingClass.getMethodDefinitions().getByName(enclosing);
|
|
241
|
+
if (ownDefinition !== undefined && ownDefinition.isRedefinition() === false) {
|
|
242
|
+
return message;
|
|
243
|
+
}
|
|
244
|
+
const called = this.searchMethodName(superDef, methodName).method;
|
|
245
|
+
const own = this.searchMethodName(superDef, enclosing).method;
|
|
246
|
+
if (called === undefined || own === undefined || called === own) {
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
return message;
|
|
250
|
+
}
|
|
215
251
|
// the class declaring the attribute or constant, searched from def up through the super classes
|
|
216
252
|
findAttributeOwner(def, found) {
|
|
217
253
|
const visited = [];
|
|
@@ -52,6 +52,9 @@ class FormParam {
|
|
|
52
52
|
else if (typeName === "P" && bfound instanceof basic_1.PackedType) {
|
|
53
53
|
bfound = basic_1.PGenericType.get();
|
|
54
54
|
}
|
|
55
|
+
else if (typeName === "N" && bfound instanceof basic_1.NumericType) {
|
|
56
|
+
bfound = basic_1.NGenericType.get();
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
if (nameToken && bfound) {
|
|
57
60
|
return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, bfound, ["form_parameter" /* IdentifierMeta.FormParameter */]);
|
|
@@ -76,6 +76,14 @@ class MethodCallChain {
|
|
|
76
76
|
const methodToken = (_a = current.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
77
77
|
const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr();
|
|
78
78
|
const def = input.scope.findObjectDefinition(className);
|
|
79
|
+
const isSuper = current === children[2]
|
|
80
|
+
&& first.get() instanceof Expressions.FieldChain
|
|
81
|
+
&& first.concatTokens().toUpperCase() === "SUPER";
|
|
82
|
+
const superMessage = isSuper ? helper.checkSuperCall(def, methodName) : undefined;
|
|
83
|
+
if (superMessage !== undefined) {
|
|
84
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, superMessage));
|
|
85
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
86
|
+
}
|
|
79
87
|
// eslint-disable-next-line prefer-const
|
|
80
88
|
let { method, def: foundDef } = helper.searchMethodName(def, methodName);
|
|
81
89
|
if (method === undefined && current === first) {
|
|
@@ -103,6 +111,11 @@ class MethodCallChain {
|
|
|
103
111
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
104
112
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
105
113
|
}
|
|
114
|
+
const specialMessage = isSuper ? undefined : helper.checkSpecialTestMethodCall(method, foundDef);
|
|
115
|
+
if (specialMessage !== undefined) {
|
|
116
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, specialMessage));
|
|
117
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
118
|
+
}
|
|
106
119
|
const voidedName = context instanceof basic_1.VoidType ? context.getVoided() : undefined;
|
|
107
120
|
const extra = helper.methodReferenceExtras(foundDef, className || voidedName);
|
|
108
121
|
input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
|
|
@@ -70,6 +70,9 @@ class MethodParam {
|
|
|
70
70
|
else if (concat === "TYPE P" || concat.startsWith("TYPE P ")) {
|
|
71
71
|
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, basic_1.PGenericType.get(), meta);
|
|
72
72
|
}
|
|
73
|
+
else if (concat === "TYPE N" || concat.startsWith("TYPE N ")) {
|
|
74
|
+
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, basic_1.NGenericType.get(), meta);
|
|
75
|
+
}
|
|
73
76
|
const found = new basic_types_1.BasicTypes(input).parseType(type);
|
|
74
77
|
if (found) {
|
|
75
78
|
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, found, meta);
|
|
@@ -121,6 +121,14 @@ class MethodSource {
|
|
|
121
121
|
const methodToken = current.getFirstToken();
|
|
122
122
|
const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr();
|
|
123
123
|
const def = input.scope.findObjectDefinition(className);
|
|
124
|
+
const isSuper = implicitMe === false
|
|
125
|
+
&& first.get() instanceof Expressions.SourceField
|
|
126
|
+
&& first.concatTokens().toUpperCase() === "SUPER";
|
|
127
|
+
const superMessage = isSuper ? helper.checkSuperCall(def, methodName) : undefined;
|
|
128
|
+
if (superMessage !== undefined) {
|
|
129
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, superMessage));
|
|
130
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
131
|
+
}
|
|
124
132
|
// eslint-disable-next-line prefer-const
|
|
125
133
|
let { method, def: foundDef } = helper.searchMethodName(def, methodName);
|
|
126
134
|
if (implicitMe && current === first && (method === null || method === void 0 ? void 0 : method.isStatic()) === false && input.scope.isInStaticMethod() === true) {
|
|
@@ -137,6 +145,11 @@ class MethodSource {
|
|
|
137
145
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
138
146
|
}
|
|
139
147
|
else if (method) {
|
|
148
|
+
const specialMessage = isSuper ? undefined : helper.checkSpecialTestMethodCall(method, foundDef);
|
|
149
|
+
if (specialMessage !== undefined) {
|
|
150
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, specialMessage));
|
|
151
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
152
|
+
}
|
|
140
153
|
const extra = helper.methodReferenceExtras(foundDef, className);
|
|
141
154
|
input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
|
|
142
155
|
context = method;
|
|
@@ -56,6 +56,7 @@ const corresponding_body_1 = require("./corresponding_body");
|
|
|
56
56
|
const _builtin_1 = require("../_builtin");
|
|
57
57
|
const attribute_chain_1 = require("./attribute_chain");
|
|
58
58
|
const dereference_1 = require("./dereference");
|
|
59
|
+
const cast_1 = require("./cast");
|
|
59
60
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
60
61
|
const _type_utils_1 = require("../_type_utils");
|
|
61
62
|
const _syntax_input_1 = require("../_syntax_input");
|
|
@@ -279,6 +280,10 @@ class Source {
|
|
|
279
280
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
280
281
|
}
|
|
281
282
|
}
|
|
283
|
+
else if (get instanceof Expressions.Cast) {
|
|
284
|
+
const found = cast_1.Cast.runSyntax(first, input, targetType);
|
|
285
|
+
context = arithmetic === true ? this.infer(context, found, true) : found;
|
|
286
|
+
}
|
|
282
287
|
else if (get instanceof Expressions.FieldChain) {
|
|
283
288
|
const found = field_chain_1.FieldChain.runSyntax(first, input, type, allowGenericDeference);
|
|
284
289
|
context = arithmetic === true ? this.infer(context, found, true) : found;
|
|
@@ -295,6 +300,11 @@ class Source {
|
|
|
295
300
|
context = this.infer(context, found, arithmetic);
|
|
296
301
|
}
|
|
297
302
|
else if (get instanceof Expressions.Dereference) {
|
|
303
|
+
if (this.isNewObjectDereference(node, first)) {
|
|
304
|
+
const message = "NEW cannot be dereferenced directly";
|
|
305
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, first.getFirstToken(), message));
|
|
306
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
307
|
+
}
|
|
298
308
|
context = dereference_1.Dereference.runSyntax(first, context, input);
|
|
299
309
|
}
|
|
300
310
|
else if (get instanceof Expressions.ComponentChain) {
|
|
@@ -482,6 +492,16 @@ class Source {
|
|
|
482
492
|
}
|
|
483
493
|
return targetType;
|
|
484
494
|
}
|
|
495
|
+
// "NEW ty( )->*" is a syntax error, also in releases where a method call can be dereferenced
|
|
496
|
+
static isNewObjectDereference(node, deref) {
|
|
497
|
+
var _a;
|
|
498
|
+
const children = node.getChildren();
|
|
499
|
+
const before = children[children.indexOf(deref) - 1];
|
|
500
|
+
return before instanceof nodes_1.ExpressionNode
|
|
501
|
+
&& before.get() instanceof Expressions.MethodCallChain
|
|
502
|
+
&& before.getChildren().length === 1
|
|
503
|
+
&& ((_a = before.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.NewObject;
|
|
504
|
+
}
|
|
485
505
|
}
|
|
486
506
|
exports.Source = Source;
|
|
487
507
|
//# sourceMappingURL=source.js.map
|
|
@@ -203,9 +203,9 @@ class CreateObject {
|
|
|
203
203
|
if (name === undefined) {
|
|
204
204
|
continue;
|
|
205
205
|
}
|
|
206
|
-
const source = p.findDirectExpression(Expressions.Source);
|
|
207
|
-
const sourceType = source_1.Source.runSyntax(source, input);
|
|
208
206
|
const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
|
|
207
|
+
const source = p.findDirectExpression(Expressions.Source);
|
|
208
|
+
const sourceType = source_1.Source.runSyntax(source, input, found === null || found === void 0 ? void 0 : found.getType());
|
|
209
209
|
if (found === undefined) {
|
|
210
210
|
const message = `constructor parameter "${name}" does not exist`;
|
|
211
211
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
@@ -32,6 +32,7 @@ __exportStar(require("./generic_object_reference_type"), exports);
|
|
|
32
32
|
__exportStar(require("./hex_type"), exports);
|
|
33
33
|
__exportStar(require("./integer_type"), exports);
|
|
34
34
|
__exportStar(require("./integer8_type"), exports);
|
|
35
|
+
__exportStar(require("./ngeneric_type"), exports);
|
|
35
36
|
__exportStar(require("./numeric_generic_type"), exports);
|
|
36
37
|
__exportStar(require("./numeric_type"), exports);
|
|
37
38
|
__exportStar(require("./object_reference_type"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NGenericType = void 0;
|
|
4
|
+
const numeric_type_1 = require("./numeric_type");
|
|
5
|
+
// "TYPE n" of a method or FORM parameter, where no length can be given.
|
|
6
|
+
// It is a NumericType, so everything that handles n keeps treating it as such
|
|
7
|
+
class NGenericType extends numeric_type_1.NumericType {
|
|
8
|
+
static get() {
|
|
9
|
+
return this.singleton;
|
|
10
|
+
}
|
|
11
|
+
constructor() {
|
|
12
|
+
super(1);
|
|
13
|
+
}
|
|
14
|
+
toText() {
|
|
15
|
+
return "```n```";
|
|
16
|
+
}
|
|
17
|
+
isGeneric() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.NGenericType = NGenericType;
|
|
22
|
+
NGenericType.singleton = new NGenericType();
|
|
23
|
+
//# sourceMappingURL=ngeneric_type.js.map
|
package/build/src/registry.js
CHANGED
|
@@ -2419,8 +2419,17 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2419
2419
|
const extra = (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For)) ? " " : "";
|
|
2420
2420
|
data = indentation + extra + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
|
|
2421
2421
|
}
|
|
2422
|
+
// all rows are built in the same work area, a component a row leaves out must be initial,
|
|
2423
|
+
// not what an earlier row (or an earlier pass of a surrounding loop) put there
|
|
2424
|
+
const clearRows = valueBody !== undefined && this.valueRowsNeedClear(valueBody);
|
|
2425
|
+
const prefix = [];
|
|
2422
2426
|
for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
|
|
2423
2427
|
if (a.get() instanceof Expressions.FieldAssignment) {
|
|
2428
|
+
if (clearRows === true) {
|
|
2429
|
+
// the shared prefix applies to every following row, re-applied after each CLEAR
|
|
2430
|
+
prefix.push(a.concatTokens());
|
|
2431
|
+
continue;
|
|
2432
|
+
}
|
|
2424
2433
|
if (added === false) {
|
|
2425
2434
|
body += data;
|
|
2426
2435
|
added = true;
|
|
@@ -2444,6 +2453,16 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2444
2453
|
}
|
|
2445
2454
|
if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {
|
|
2446
2455
|
let skip = false;
|
|
2456
|
+
if (clearRows === true && this.isStructuredValueRow(a)) {
|
|
2457
|
+
if (added === false) {
|
|
2458
|
+
body += data;
|
|
2459
|
+
added = true;
|
|
2460
|
+
}
|
|
2461
|
+
body += indentation + `CLEAR ${structureName}.\n`;
|
|
2462
|
+
for (const p of prefix) {
|
|
2463
|
+
body += indentation + structureName + "-" + p + ".\n";
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2447
2466
|
for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {
|
|
2448
2467
|
if (b.get() instanceof Expressions.FieldAssignment) {
|
|
2449
2468
|
if (added === false) {
|
|
@@ -2522,6 +2541,39 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2522
2541
|
}
|
|
2523
2542
|
return undefined;
|
|
2524
2543
|
}
|
|
2544
|
+
/** a row that is built in the work area, ie. not "( source )" or "( LINES OF source )" */
|
|
2545
|
+
isStructuredValueRow(row) {
|
|
2546
|
+
return row.findDirectExpression(Expressions.Source) === undefined
|
|
2547
|
+
&& row.findDirectExpression(Expressions.ValueBodyLines) === undefined;
|
|
2548
|
+
}
|
|
2549
|
+
/** true if a row can observe a component that an earlier row, or an earlier pass of a surrounding loop,
|
|
2550
|
+
* left in the shared work area. Not the case if all rows assign the same components, and the shared
|
|
2551
|
+
* prefix is not changed between rows, eg. FOR rows or "( a = 1 b = 2 ) ( a = 3 b = 4 )" */
|
|
2552
|
+
valueRowsNeedClear(valueBody) {
|
|
2553
|
+
let shape = undefined;
|
|
2554
|
+
let rowSeen = false;
|
|
2555
|
+
for (const c of valueBody.getChildren()) {
|
|
2556
|
+
if (c.get() instanceof Expressions.FieldAssignment) {
|
|
2557
|
+
if (rowSeen === true) {
|
|
2558
|
+
return true;
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
else if (c instanceof nodes_1.ExpressionNode
|
|
2562
|
+
&& c.get() instanceof Expressions.ValueBodyLine
|
|
2563
|
+
&& this.isStructuredValueRow(c)) {
|
|
2564
|
+
rowSeen = true;
|
|
2565
|
+
const current = c.findDirectExpressions(Expressions.FieldAssignment)
|
|
2566
|
+
.map(f => { var _a; return (_a = f.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase().replace(/\s/g, ""); })
|
|
2567
|
+
.sort()
|
|
2568
|
+
.join(",");
|
|
2569
|
+
if (shape !== undefined && shape !== current) {
|
|
2570
|
+
return true;
|
|
2571
|
+
}
|
|
2572
|
+
shape = current;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
return false;
|
|
2576
|
+
}
|
|
2525
2577
|
outlineLet(node, indentation, highSyntax, lowFile) {
|
|
2526
2578
|
var _a;
|
|
2527
2579
|
let ret = "";
|
|
@@ -54,7 +54,9 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
|
|
|
54
54
|
title: "RFC error handling",
|
|
55
55
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
56
56
|
shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,
|
|
57
|
-
extendedInformation: `
|
|
57
|
+
extendedInformation: `RESOURCE_FAILURE is also required for asynchronous calls with DESTINATION IN GROUP.
|
|
58
|
+
|
|
59
|
+
https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenrfc_exception.html`,
|
|
58
60
|
badExample: `CALL FUNCTION 'ZRFC'
|
|
59
61
|
DESTINATION lv_rfc.`,
|
|
60
62
|
goodExample: `CALL FUNCTION 'ZRFC'
|
|
@@ -62,12 +64,12 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
|
|
|
62
64
|
EXCEPTIONS
|
|
63
65
|
system_failure = 1 MESSAGE msg
|
|
64
66
|
communication_failure = 2 MESSAGE msg
|
|
65
|
-
|
|
66
|
-
OTHERS = 4.`,
|
|
67
|
+
OTHERS = 3.`,
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
getMessage() {
|
|
70
|
-
return "RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE
|
|
70
|
+
getMessage(requireResourceFailure) {
|
|
71
|
+
return "RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE"
|
|
72
|
+
+ (requireResourceFailure ? ", RESOURCE_FAILURE" : "");
|
|
71
73
|
}
|
|
72
74
|
getConfig() {
|
|
73
75
|
return this.conf;
|
|
@@ -82,12 +84,15 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
|
|
|
82
84
|
if (!(stat.get() instanceof Statements.CallFunction)) {
|
|
83
85
|
continue;
|
|
84
86
|
}
|
|
85
|
-
|
|
87
|
+
const destination = stat.findFirstExpression(Expressions.Destination);
|
|
88
|
+
if (destination === undefined) {
|
|
86
89
|
continue;
|
|
87
90
|
}
|
|
91
|
+
const requireResourceFailure = stat.findDirectTokenByText("STARTING") !== undefined
|
|
92
|
+
&& destination.findDirectTokenByText("GROUP") !== undefined;
|
|
88
93
|
const list = stat.findFirstExpression(Expressions.ParameterListExceptions);
|
|
89
94
|
if (list === undefined) {
|
|
90
|
-
const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
|
|
95
|
+
const issue = issue_1.Issue.atToken(file, token, this.getMessage(requireResourceFailure), this.getMetadata().key, this.conf.severity);
|
|
91
96
|
output.push(issue);
|
|
92
97
|
continue;
|
|
93
98
|
}
|
|
@@ -98,8 +103,8 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
|
|
|
98
103
|
}
|
|
99
104
|
if (names.indexOf("SYSTEM_FAILURE") < 0
|
|
100
105
|
|| names.indexOf("COMMUNICATION_FAILURE") < 0
|
|
101
|
-
|| names.indexOf("RESOURCE_FAILURE") < 0) {
|
|
102
|
-
const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
|
|
106
|
+
|| (requireResourceFailure && names.indexOf("RESOURCE_FAILURE") < 0)) {
|
|
107
|
+
const issue = issue_1.Issue.atToken(file, token, this.getMessage(requireResourceFailure), this.getMetadata().key, this.conf.severity);
|
|
103
108
|
output.push(issue);
|
|
104
109
|
continue;
|
|
105
110
|
}
|