@abaplint/cli 2.120.4 → 2.120.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/cli.js +197 -68
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -30015,7 +30015,7 @@ class CondBody {
|
|
|
30015
30015
|
type = source_1.Source.runSyntax(s, input, targetType);
|
|
30016
30016
|
}
|
|
30017
30017
|
else {
|
|
30018
|
-
source_1.Source.runSyntax(s, input, targetType);
|
|
30018
|
+
source_1.Source.runSyntax(s, input, targetType !== null && targetType !== void 0 ? targetType : type);
|
|
30019
30019
|
}
|
|
30020
30020
|
}
|
|
30021
30021
|
if (scoped === true) {
|
|
@@ -31419,6 +31419,10 @@ class InlineData {
|
|
|
31419
31419
|
static runSyntax(node, input, type) {
|
|
31420
31420
|
var _a;
|
|
31421
31421
|
const token = (_a = node.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
31422
|
+
if (token && token.getStr().length > 30) {
|
|
31423
|
+
const message = "DATA name too long, " + token.getStr();
|
|
31424
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
31425
|
+
}
|
|
31422
31426
|
if (token && type) {
|
|
31423
31427
|
if (type instanceof basic_1.CSequenceType || type instanceof basic_1.CLikeType) {
|
|
31424
31428
|
type = basic_1.StringType.get();
|
|
@@ -31590,10 +31594,16 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
|
|
|
31590
31594
|
const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
31591
31595
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
31592
31596
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
31597
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
31593
31598
|
class InlineFS {
|
|
31594
31599
|
static runSyntax(node, input, type) {
|
|
31595
31600
|
var _a;
|
|
31596
31601
|
const token = (_a = node.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
31602
|
+
const fs = node.findFirstExpression(Expressions.FieldSymbol);
|
|
31603
|
+
if (fs && fs.concatTokens().length > 30) {
|
|
31604
|
+
const message = "FIELD-SYMBOLS name too long, " + fs.concatTokens();
|
|
31605
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fs.getFirstToken(), message));
|
|
31606
|
+
}
|
|
31597
31607
|
if (token && type) {
|
|
31598
31608
|
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
31599
31609
|
input.scope.addIdentifier(identifier);
|
|
@@ -34084,7 +34094,7 @@ class Source {
|
|
|
34084
34094
|
case "SWITCH":
|
|
34085
34095
|
{
|
|
34086
34096
|
const foundType = this.determineType(node, input, targetType);
|
|
34087
|
-
const bodyType = switch_body_1.SwitchBody.runSyntax(node.findDirectExpression(Expressions.SwitchBody), input);
|
|
34097
|
+
const bodyType = switch_body_1.SwitchBody.runSyntax(node.findDirectExpression(Expressions.SwitchBody), input, foundType);
|
|
34088
34098
|
if (foundType === undefined || foundType.isGeneric()) {
|
|
34089
34099
|
this.addIfInferred(node, input, bodyType);
|
|
34090
34100
|
}
|
|
@@ -35166,7 +35176,7 @@ const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_s
|
|
|
35166
35176
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
35167
35177
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
35168
35178
|
class SwitchBody {
|
|
35169
|
-
static runSyntax(node, input) {
|
|
35179
|
+
static runSyntax(node, input, targetType) {
|
|
35170
35180
|
if (node === undefined) {
|
|
35171
35181
|
return;
|
|
35172
35182
|
}
|
|
@@ -35176,12 +35186,12 @@ class SwitchBody {
|
|
|
35176
35186
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
35177
35187
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
35178
35188
|
}
|
|
35179
|
-
const type = source_1.Source.runSyntax(thenSource, input);
|
|
35189
|
+
const type = source_1.Source.runSyntax(thenSource, input, targetType);
|
|
35180
35190
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
35181
35191
|
if (s === thenSource) {
|
|
35182
35192
|
continue;
|
|
35183
35193
|
}
|
|
35184
|
-
source_1.Source.runSyntax(s, input);
|
|
35194
|
+
source_1.Source.runSyntax(s, input, targetType !== null && targetType !== void 0 ? targetType : type);
|
|
35185
35195
|
}
|
|
35186
35196
|
return type;
|
|
35187
35197
|
}
|
|
@@ -36728,6 +36738,75 @@ exports.Assign = Assign;
|
|
|
36728
36738
|
|
|
36729
36739
|
/***/ },
|
|
36730
36740
|
|
|
36741
|
+
/***/ "../core/build/src/abap/5_syntax/statements/at_selection_screen.js"
|
|
36742
|
+
/*!*************************************************************************!*\
|
|
36743
|
+
!*** ../core/build/src/abap/5_syntax/statements/at_selection_screen.js ***!
|
|
36744
|
+
\*************************************************************************/
|
|
36745
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
36746
|
+
|
|
36747
|
+
"use strict";
|
|
36748
|
+
|
|
36749
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
36750
|
+
if (k2 === undefined) k2 = k;
|
|
36751
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
36752
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
36753
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
36754
|
+
}
|
|
36755
|
+
Object.defineProperty(o, k2, desc);
|
|
36756
|
+
}) : (function(o, m, k, k2) {
|
|
36757
|
+
if (k2 === undefined) k2 = k;
|
|
36758
|
+
o[k2] = m[k];
|
|
36759
|
+
}));
|
|
36760
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
36761
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36762
|
+
}) : function(o, v) {
|
|
36763
|
+
o["default"] = v;
|
|
36764
|
+
});
|
|
36765
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
36766
|
+
var ownKeys = function(o) {
|
|
36767
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36768
|
+
var ar = [];
|
|
36769
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36770
|
+
return ar;
|
|
36771
|
+
};
|
|
36772
|
+
return ownKeys(o);
|
|
36773
|
+
};
|
|
36774
|
+
return function (mod) {
|
|
36775
|
+
if (mod && mod.__esModule) return mod;
|
|
36776
|
+
var result = {};
|
|
36777
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36778
|
+
__setModuleDefault(result, mod);
|
|
36779
|
+
return result;
|
|
36780
|
+
};
|
|
36781
|
+
})();
|
|
36782
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36783
|
+
exports.AtSelectionScreen = void 0;
|
|
36784
|
+
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
36785
|
+
const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
36786
|
+
const source_field_1 = __webpack_require__(/*! ../expressions/source_field */ "../core/build/src/abap/5_syntax/expressions/source_field.js");
|
|
36787
|
+
class AtSelectionScreen {
|
|
36788
|
+
runSyntax(node, input) {
|
|
36789
|
+
// "AT SELECTION-SCREEN ON <field>", "ON VALUE-REQUEST FOR <field>",
|
|
36790
|
+
// "ON HELP-REQUEST FOR <field>" and "ON END OF <field>" all reference
|
|
36791
|
+
// a parameter or select-option, register these as read references so
|
|
36792
|
+
// they are not reported as unused.
|
|
36793
|
+
const fields = [
|
|
36794
|
+
...node.findDirectExpressions(Expressions.FieldSub),
|
|
36795
|
+
...node.findDirectExpressions(Expressions.Field),
|
|
36796
|
+
];
|
|
36797
|
+
for (const field of fields) {
|
|
36798
|
+
const token = field.getFirstToken();
|
|
36799
|
+
if (input.scope.findVariable(token.getStr()) !== undefined) {
|
|
36800
|
+
source_field_1.SourceField.runSyntax(field, input, _reference_1.ReferenceType.DataReadReference, false);
|
|
36801
|
+
}
|
|
36802
|
+
}
|
|
36803
|
+
}
|
|
36804
|
+
}
|
|
36805
|
+
exports.AtSelectionScreen = AtSelectionScreen;
|
|
36806
|
+
//# sourceMappingURL=at_selection_screen.js.map
|
|
36807
|
+
|
|
36808
|
+
/***/ },
|
|
36809
|
+
|
|
36731
36810
|
/***/ "../core/build/src/abap/5_syntax/statements/authority_check.js"
|
|
36732
36811
|
/*!*********************************************************************!*\
|
|
36733
36812
|
!*** ../core/build/src/abap/5_syntax/statements/authority_check.js ***!
|
|
@@ -38313,6 +38392,10 @@ class Constant {
|
|
|
38313
38392
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), message));
|
|
38314
38393
|
return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, basic_2.VoidType.get(_syntax_input_1.CheckSyntaxKey), meta, val);
|
|
38315
38394
|
}
|
|
38395
|
+
if (this.isNameTooLong(found.getName())) {
|
|
38396
|
+
const message = "CONSTANTS name too long, " + found.getName();
|
|
38397
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), message));
|
|
38398
|
+
}
|
|
38316
38399
|
return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, found.getType(), meta, val);
|
|
38317
38400
|
}
|
|
38318
38401
|
const fallback = node.findFirstExpression(Expressions.DefinitionName);
|
|
@@ -38321,10 +38404,17 @@ class Constant {
|
|
|
38321
38404
|
const message = "not possible to have a name with only digits";
|
|
38322
38405
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fallback.getFirstToken(), message));
|
|
38323
38406
|
}
|
|
38407
|
+
if (this.isNameTooLong(fallback.concatTokens())) {
|
|
38408
|
+
const message = "CONSTANTS name too long, " + fallback.concatTokens();
|
|
38409
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fallback.getFirstToken(), message));
|
|
38410
|
+
}
|
|
38324
38411
|
return new _typed_identifier_1.TypedIdentifier(fallback.getFirstToken(), input.filename, new basic_1.UnknownType("constant, fallback"));
|
|
38325
38412
|
}
|
|
38326
38413
|
throw new assert_error_1.AssertError("Statement Constant: unexpected structure");
|
|
38327
38414
|
}
|
|
38415
|
+
isNameTooLong(name) {
|
|
38416
|
+
return name.length > 30;
|
|
38417
|
+
}
|
|
38328
38418
|
isOnlyDigits(name) {
|
|
38329
38419
|
return /^[0-9]+$/.test(name);
|
|
38330
38420
|
}
|
|
@@ -38915,6 +39005,10 @@ class Data {
|
|
|
38915
39005
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), message));
|
|
38916
39006
|
return new _typed_identifier_1.TypedIdentifier(id.getToken(), input.filename, basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey));
|
|
38917
39007
|
}
|
|
39008
|
+
if (id && this.isNameTooLong(id.getName())) {
|
|
39009
|
+
const message = "DATA name too long, " + id.getName();
|
|
39010
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), message));
|
|
39011
|
+
}
|
|
38918
39012
|
if ((id === null || id === void 0 ? void 0 : id.getType().isGeneric()) === true
|
|
38919
39013
|
&& (id === null || id === void 0 ? void 0 : id.getType().containsVoid()) === false) {
|
|
38920
39014
|
const message = "DATA definition cannot be generic, " + (name === null || name === void 0 ? void 0 : name.concatTokens());
|
|
@@ -38928,10 +39022,17 @@ class Data {
|
|
|
38928
39022
|
const message = "not possible to have a name with only digits";
|
|
38929
39023
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name.getFirstToken(), message));
|
|
38930
39024
|
}
|
|
39025
|
+
if (this.isNameTooLong(name.concatTokens())) {
|
|
39026
|
+
const message = "DATA name too long, " + name.concatTokens();
|
|
39027
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name.getFirstToken(), message));
|
|
39028
|
+
}
|
|
38931
39029
|
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, new unknown_type_1.UnknownType("data, fallback"));
|
|
38932
39030
|
}
|
|
38933
39031
|
return undefined;
|
|
38934
39032
|
}
|
|
39033
|
+
isNameTooLong(name) {
|
|
39034
|
+
return name.length > 30;
|
|
39035
|
+
}
|
|
38935
39036
|
isOnlyDigits(name) {
|
|
38936
39037
|
return /^[0-9]+$/.test(name);
|
|
38937
39038
|
}
|
|
@@ -39893,14 +39994,19 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
|
|
|
39893
39994
|
const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
39894
39995
|
const basic_types_1 = __webpack_require__(/*! ../basic_types */ "../core/build/src/abap/5_syntax/basic_types.js");
|
|
39895
39996
|
const unknown_type_1 = __webpack_require__(/*! ../../types/basic/unknown_type */ "../core/build/src/abap/types/basic/unknown_type.js");
|
|
39997
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
39896
39998
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
39897
39999
|
class FieldSymbol {
|
|
39898
40000
|
runSyntax(node, input) {
|
|
39899
|
-
|
|
39900
|
-
const fsname =
|
|
39901
|
-
if (fsname === undefined) {
|
|
40001
|
+
const fs = node.findFirstExpression(Expressions.FieldSymbol);
|
|
40002
|
+
const fsname = fs === null || fs === void 0 ? void 0 : fs.getFirstToken();
|
|
40003
|
+
if (fs === undefined || fsname === undefined) {
|
|
39902
40004
|
return;
|
|
39903
40005
|
}
|
|
40006
|
+
if (fs.concatTokens().length > 30) {
|
|
40007
|
+
const message = "FIELD-SYMBOLS name too long, " + fs.concatTokens();
|
|
40008
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fsname, message));
|
|
40009
|
+
}
|
|
39904
40010
|
if (node.getChildren().length === 5) {
|
|
39905
40011
|
// no type specified
|
|
39906
40012
|
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(fsname, input.filename, basic_1.VoidType.get("FS-SIMPLE")));
|
|
@@ -47303,6 +47409,7 @@ const if_1 = __webpack_require__(/*! ./statements/if */ "../core/build/src/abap/
|
|
|
47303
47409
|
const else_if_1 = __webpack_require__(/*! ./statements/else_if */ "../core/build/src/abap/5_syntax/statements/else_if.js");
|
|
47304
47410
|
const append_1 = __webpack_require__(/*! ./statements/append */ "../core/build/src/abap/5_syntax/statements/append.js");
|
|
47305
47411
|
const selection_screen_1 = __webpack_require__(/*! ./statements/selection_screen */ "../core/build/src/abap/5_syntax/statements/selection_screen.js");
|
|
47412
|
+
const at_selection_screen_1 = __webpack_require__(/*! ./statements/at_selection_screen */ "../core/build/src/abap/5_syntax/statements/at_selection_screen.js");
|
|
47306
47413
|
const ranges_1 = __webpack_require__(/*! ./statements/ranges */ "../core/build/src/abap/5_syntax/statements/ranges.js");
|
|
47307
47414
|
const write_1 = __webpack_require__(/*! ./statements/write */ "../core/build/src/abap/5_syntax/statements/write.js");
|
|
47308
47415
|
const case_1 = __webpack_require__(/*! ./statements/case */ "../core/build/src/abap/5_syntax/statements/case.js");
|
|
@@ -47510,6 +47617,7 @@ if (Object.keys(map).length === 0) {
|
|
|
47510
47617
|
addToMap(new authority_check_1.AuthorityCheck());
|
|
47511
47618
|
addToMap(new insert_report_1.InsertReport());
|
|
47512
47619
|
addToMap(new selection_screen_1.SelectionScreen());
|
|
47620
|
+
addToMap(new at_selection_screen_1.AtSelectionScreen());
|
|
47513
47621
|
addToMap(new ranges_1.Ranges());
|
|
47514
47622
|
addToMap(new add_1.Add());
|
|
47515
47623
|
addToMap(new raise_event_1.RaiseEvent());
|
|
@@ -47548,16 +47656,17 @@ class SyntaxLogic {
|
|
|
47548
47656
|
this.reg = reg;
|
|
47549
47657
|
this.issues = [];
|
|
47550
47658
|
this.object = object;
|
|
47551
|
-
this.scope = _current_scope_1.CurrentScope.buildDefault(this.reg, object);
|
|
47552
|
-
this.helpers = {
|
|
47553
|
-
oooc: new _object_oriented_1.ObjectOriented(this.scope),
|
|
47554
|
-
proc: new _procedural_1.Procedural(this.reg, this.scope),
|
|
47555
|
-
};
|
|
47556
47659
|
}
|
|
47557
47660
|
run() {
|
|
47558
47661
|
if (this.object.syntaxResult !== undefined) {
|
|
47559
47662
|
return this.object.syntaxResult;
|
|
47560
47663
|
}
|
|
47664
|
+
// the scope is built here instead of in the constructor, cached results must stay cheap
|
|
47665
|
+
this.scope = _current_scope_1.CurrentScope.buildDefault(this.reg, this.object);
|
|
47666
|
+
this.helpers = {
|
|
47667
|
+
oooc: new _object_oriented_1.ObjectOriented(this.scope),
|
|
47668
|
+
proc: new _procedural_1.Procedural(this.reg, this.scope),
|
|
47669
|
+
};
|
|
47561
47670
|
this.issues = [];
|
|
47562
47671
|
this.reg.getDDICReferences().clear(this.object);
|
|
47563
47672
|
this.reg.getMSAGReferences().clear(this.object);
|
|
@@ -51208,6 +51317,7 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
51208
51317
|
this.createVisibilityValue = visibility_1.Visibility.Public;
|
|
51209
51318
|
}
|
|
51210
51319
|
// perform checks after everything has been initialized
|
|
51320
|
+
this.checkInterfaceVisibility(input, node);
|
|
51211
51321
|
this.checkMethodsFromSuperClasses(input);
|
|
51212
51322
|
this.checkMethodNameLength(input);
|
|
51213
51323
|
this.checkClassConstructorStatic(input);
|
|
@@ -51281,6 +51391,17 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
51281
51391
|
}
|
|
51282
51392
|
}
|
|
51283
51393
|
}
|
|
51394
|
+
checkInterfaceVisibility(input, node) {
|
|
51395
|
+
const sections = [
|
|
51396
|
+
node.findDirectStructure(Structures.ProtectedSection),
|
|
51397
|
+
node.findDirectStructure(Structures.PrivateSection),
|
|
51398
|
+
];
|
|
51399
|
+
for (const section of sections) {
|
|
51400
|
+
for (const statement of (section === null || section === void 0 ? void 0 : section.findAllStatements(Statements.InterfaceDef)) || []) {
|
|
51401
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, statement.getFirstToken(), "INTERFACES can only be declared in public sections"));
|
|
51402
|
+
}
|
|
51403
|
+
}
|
|
51404
|
+
}
|
|
51284
51405
|
checkMethodsFromSuperClasses(input) {
|
|
51285
51406
|
var _a;
|
|
51286
51407
|
const scope = input.scope;
|
|
@@ -69043,7 +69164,7 @@ class Registry {
|
|
|
69043
69164
|
}
|
|
69044
69165
|
static abaplintVersion() {
|
|
69045
69166
|
// magic, see build script "version.js"
|
|
69046
|
-
return "2.120.
|
|
69167
|
+
return "2.120.6";
|
|
69047
69168
|
}
|
|
69048
69169
|
getDDICReferences() {
|
|
69049
69170
|
return this.ddicReferences;
|
|
@@ -97006,35 +97127,38 @@ class UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
97006
97127
|
exports.UnusedVariablesConf = UnusedVariablesConf;
|
|
97007
97128
|
class WorkArea {
|
|
97008
97129
|
constructor() {
|
|
97009
|
-
this
|
|
97130
|
+
// keyed by filename + start position, this equals Identifier.equals()
|
|
97131
|
+
this.workarea = new Map();
|
|
97010
97132
|
}
|
|
97011
97133
|
push(id, count = 1) {
|
|
97012
|
-
|
|
97013
|
-
|
|
97014
|
-
|
|
97015
|
-
}
|
|
97134
|
+
const key = this.buildKey(id);
|
|
97135
|
+
if (this.workarea.has(key)) {
|
|
97136
|
+
return;
|
|
97016
97137
|
}
|
|
97017
|
-
this.workarea.
|
|
97138
|
+
this.workarea.set(key, { id, count });
|
|
97018
97139
|
}
|
|
97019
97140
|
removeIfExists(id) {
|
|
97020
97141
|
if (id === undefined) {
|
|
97021
97142
|
return;
|
|
97022
97143
|
}
|
|
97023
|
-
|
|
97024
|
-
|
|
97025
|
-
|
|
97026
|
-
|
|
97027
|
-
|
|
97028
|
-
|
|
97029
|
-
return;
|
|
97144
|
+
const key = this.buildKey(id);
|
|
97145
|
+
const found = this.workarea.get(key);
|
|
97146
|
+
if (found !== undefined) {
|
|
97147
|
+
found.count--;
|
|
97148
|
+
if (found.count === 0) {
|
|
97149
|
+
this.workarea.delete(key);
|
|
97030
97150
|
}
|
|
97031
97151
|
}
|
|
97032
97152
|
}
|
|
97033
97153
|
get() {
|
|
97034
|
-
return this.workarea;
|
|
97154
|
+
return [...this.workarea.values()];
|
|
97035
97155
|
}
|
|
97036
97156
|
count() {
|
|
97037
|
-
return this.workarea.
|
|
97157
|
+
return this.workarea.size;
|
|
97158
|
+
}
|
|
97159
|
+
buildKey(id) {
|
|
97160
|
+
const start = id.getStart();
|
|
97161
|
+
return id.getFilename() + "," + start.getRow() + "," + start.getCol();
|
|
97038
97162
|
}
|
|
97039
97163
|
}
|
|
97040
97164
|
class UnusedVariables {
|
|
@@ -97168,6 +97292,9 @@ Errors found in INCLUDES are reported for the main program.`,
|
|
|
97168
97292
|
}
|
|
97169
97293
|
buildIssues(obj) {
|
|
97170
97294
|
const ret = [];
|
|
97295
|
+
const metadata = this.getMetadata();
|
|
97296
|
+
const pragma = metadata.pragma + "";
|
|
97297
|
+
const files = new Map();
|
|
97171
97298
|
for (const w of this.workarea.get()) {
|
|
97172
97299
|
const filename = w.id.getFilename();
|
|
97173
97300
|
if (this.reg.isFileDependency(filename) === true) {
|
|
@@ -97176,41 +97303,52 @@ Errors found in INCLUDES are reported for the main program.`,
|
|
|
97176
97303
|
else if (obj instanceof objects_1.Program === false && obj.containsFile(filename) === false) {
|
|
97177
97304
|
continue;
|
|
97178
97305
|
}
|
|
97179
|
-
|
|
97180
|
-
|
|
97181
|
-
|
|
97306
|
+
if (files.has(filename) === false) {
|
|
97307
|
+
files.set(filename, this.findFile(filename));
|
|
97308
|
+
}
|
|
97309
|
+
const file = files.get(filename);
|
|
97310
|
+
let statement = undefined;
|
|
97311
|
+
let statementIndex = -1;
|
|
97312
|
+
if (file !== undefined) {
|
|
97313
|
+
const statements = file.getStatements();
|
|
97314
|
+
const token = w.id.getToken();
|
|
97315
|
+
for (let i = 0; i < statements.length; i++) {
|
|
97316
|
+
if (statements[i].includesToken(token)) {
|
|
97317
|
+
statement = statements[i];
|
|
97318
|
+
statementIndex = i;
|
|
97319
|
+
break;
|
|
97320
|
+
}
|
|
97321
|
+
}
|
|
97182
97322
|
}
|
|
97183
|
-
|
|
97184
|
-
|
|
97323
|
+
if (statement !== undefined && file !== undefined) {
|
|
97324
|
+
if (statement.getPragmas().some(t => t.getStr() === pragma)) {
|
|
97325
|
+
continue;
|
|
97326
|
+
}
|
|
97327
|
+
else if (this.suppressedbyPseudo(file, statementIndex, w.id, obj)) {
|
|
97328
|
+
continue;
|
|
97329
|
+
}
|
|
97185
97330
|
}
|
|
97186
97331
|
const name = w.id.getName();
|
|
97187
97332
|
const message = "Variable \"" + name.toLowerCase() + "\" not used";
|
|
97188
|
-
const fix = this.buildFix(w.id, obj);
|
|
97189
|
-
ret.push(issue_1.Issue.atIdentifier(w.id, message,
|
|
97333
|
+
const fix = this.buildFix(w.id, obj, statement);
|
|
97334
|
+
ret.push(issue_1.Issue.atIdentifier(w.id, message, metadata.key, this.conf.severity, fix));
|
|
97190
97335
|
}
|
|
97191
97336
|
return ret;
|
|
97192
97337
|
}
|
|
97193
|
-
suppressedbyPseudo(
|
|
97194
|
-
|
|
97338
|
+
suppressedbyPseudo(file, statementIndex, v, obj) {
|
|
97339
|
+
// pseudo comments are only found in files belonging to the object itself, not in eg. includes
|
|
97340
|
+
if (obj.getABAPFileByName(v.getFilename()) === undefined) {
|
|
97195
97341
|
return false;
|
|
97196
97342
|
}
|
|
97197
|
-
const
|
|
97198
|
-
|
|
97199
|
-
|
|
97200
|
-
|
|
97201
|
-
|
|
97202
|
-
|
|
97203
|
-
if (next === true && s.get() instanceof _statement_1.Comment) {
|
|
97204
|
-
return s.concatTokens().includes(this.getMetadata().pseudoComment + "");
|
|
97205
|
-
}
|
|
97206
|
-
if (s === statement) {
|
|
97207
|
-
next = true;
|
|
97208
|
-
}
|
|
97209
|
-
}
|
|
97210
|
-
return false;
|
|
97343
|
+
const statements = file.getStatements();
|
|
97344
|
+
const next = statements[statementIndex + 1];
|
|
97345
|
+
return (next === null || next === void 0 ? void 0 : next.get()) instanceof _statement_1.Comment
|
|
97346
|
+
&& next.concatTokens().includes(this.getMetadata().pseudoComment + "");
|
|
97347
|
+
// removed by dead control flow
|
|
97348
|
+
|
|
97211
97349
|
}
|
|
97212
|
-
|
|
97213
|
-
const file = this.reg.getFileByName(
|
|
97350
|
+
findFile(filename) {
|
|
97351
|
+
const file = this.reg.getFileByName(filename);
|
|
97214
97352
|
if (file === undefined) {
|
|
97215
97353
|
return undefined;
|
|
97216
97354
|
}
|
|
@@ -97218,26 +97356,17 @@ Errors found in INCLUDES are reported for the main program.`,
|
|
|
97218
97356
|
if (!(object instanceof _abap_object_1.ABAPObject)) {
|
|
97219
97357
|
return undefined;
|
|
97220
97358
|
}
|
|
97221
|
-
|
|
97222
|
-
|
|
97359
|
+
return object.getABAPFileByName(filename);
|
|
97360
|
+
}
|
|
97361
|
+
buildFix(v, obj, statement) {
|
|
97362
|
+
if (statement === undefined || !(statement.get() instanceof Statements.Data)) {
|
|
97223
97363
|
return undefined;
|
|
97224
97364
|
}
|
|
97225
|
-
const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), abapfile);
|
|
97226
|
-
return statement;
|
|
97227
|
-
}
|
|
97228
|
-
buildFix(v, obj) {
|
|
97229
97365
|
const file = obj.getABAPFileByName(v.getFilename());
|
|
97230
97366
|
if (file === undefined) {
|
|
97231
97367
|
return undefined;
|
|
97232
97368
|
}
|
|
97233
|
-
|
|
97234
|
-
if (statement === undefined) {
|
|
97235
|
-
return undefined;
|
|
97236
|
-
}
|
|
97237
|
-
else if (statement.get() instanceof Statements.Data) {
|
|
97238
|
-
return edit_helper_1.EditHelper.deleteStatement(file, statement);
|
|
97239
|
-
}
|
|
97240
|
-
return undefined;
|
|
97369
|
+
return edit_helper_1.EditHelper.deleteStatement(file, statement);
|
|
97241
97370
|
}
|
|
97242
97371
|
}
|
|
97243
97372
|
exports.UnusedVariables = UnusedVariables;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.6",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.120.
|
|
42
|
+
"@abaplint/core": "^2.120.6",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|