@abaplint/transpiler-cli 2.8.26 → 2.8.27
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/bundle.js +246 -26
- package/package.json +4 -4
package/build/bundle.js
CHANGED
|
@@ -2589,17 +2589,23 @@ class Macros {
|
|
|
2589
2589
|
constructor(globalMacros) {
|
|
2590
2590
|
this.macros = {};
|
|
2591
2591
|
for (const m of globalMacros) {
|
|
2592
|
-
this.macros[m.toUpperCase()] =
|
|
2592
|
+
this.macros[m.toUpperCase()] = {
|
|
2593
|
+
statements: [],
|
|
2594
|
+
filename: undefined,
|
|
2595
|
+
};
|
|
2593
2596
|
}
|
|
2594
2597
|
}
|
|
2595
|
-
addMacro(name, contents) {
|
|
2598
|
+
addMacro(name, contents, filename) {
|
|
2596
2599
|
if (this.isMacro(name)) {
|
|
2597
2600
|
return;
|
|
2598
2601
|
}
|
|
2599
|
-
this.macros[name.toUpperCase()] =
|
|
2602
|
+
this.macros[name.toUpperCase()] = {
|
|
2603
|
+
statements: contents,
|
|
2604
|
+
filename: filename,
|
|
2605
|
+
};
|
|
2600
2606
|
}
|
|
2601
2607
|
getContents(name) {
|
|
2602
|
-
return this.macros[name.toUpperCase()];
|
|
2608
|
+
return this.macros[name.toUpperCase()].statements;
|
|
2603
2609
|
}
|
|
2604
2610
|
listMacroNames() {
|
|
2605
2611
|
return Object.keys(this.macros);
|
|
@@ -2610,6 +2616,9 @@ class Macros {
|
|
|
2610
2616
|
}
|
|
2611
2617
|
return false;
|
|
2612
2618
|
}
|
|
2619
|
+
getMacroFilename(name) {
|
|
2620
|
+
return this.macros[name.toUpperCase()].filename;
|
|
2621
|
+
}
|
|
2613
2622
|
}
|
|
2614
2623
|
class ExpandMacros {
|
|
2615
2624
|
// "reg" must be supplied if there are cross object macros via INCLUDE
|
|
@@ -2619,35 +2628,42 @@ class ExpandMacros {
|
|
|
2619
2628
|
this.globalMacros = globalMacros;
|
|
2620
2629
|
this.reg = reg;
|
|
2621
2630
|
}
|
|
2622
|
-
find(statements) {
|
|
2623
|
-
var _a, _b;
|
|
2624
|
-
let
|
|
2631
|
+
find(statements, file, clear = true) {
|
|
2632
|
+
var _a, _b, _c;
|
|
2633
|
+
let nameToken = undefined;
|
|
2634
|
+
let start = undefined;
|
|
2625
2635
|
let contents = [];
|
|
2636
|
+
const macroReferences = (_a = this.reg) === null || _a === void 0 ? void 0 : _a.getMacroReferences();
|
|
2637
|
+
if (clear) {
|
|
2638
|
+
macroReferences === null || macroReferences === void 0 ? void 0 : macroReferences.clear(file.getFilename());
|
|
2639
|
+
}
|
|
2626
2640
|
for (let i = 0; i < statements.length; i++) {
|
|
2627
2641
|
const statement = statements[i];
|
|
2628
2642
|
const type = statement.get();
|
|
2629
2643
|
if (type instanceof Statements.Define) {
|
|
2630
2644
|
// todo, will this break if first token is a pragma?
|
|
2631
|
-
|
|
2645
|
+
nameToken = statement.getTokens()[1];
|
|
2646
|
+
start = statement.getFirstToken().getStart();
|
|
2632
2647
|
contents = [];
|
|
2633
2648
|
}
|
|
2634
2649
|
else if (type instanceof Statements.Include) {
|
|
2635
|
-
const includeName = (
|
|
2650
|
+
const includeName = (_b = statement.findDirectExpression(Expressions.IncludeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
2636
2651
|
// todo, this does not take function module includes into account
|
|
2637
|
-
const prog = (
|
|
2652
|
+
const prog = (_c = this.reg) === null || _c === void 0 ? void 0 : _c.getObject("PROG", includeName);
|
|
2638
2653
|
if (prog) {
|
|
2639
2654
|
prog.parse(this.version, this.globalMacros, this.reg);
|
|
2640
|
-
const
|
|
2641
|
-
if (
|
|
2655
|
+
const includeMainFile = prog.getMainABAPFile();
|
|
2656
|
+
if (includeMainFile) {
|
|
2642
2657
|
// slow, this copies everything,
|
|
2643
|
-
this.find([...
|
|
2658
|
+
this.find([...includeMainFile.getStatements()], includeMainFile, false);
|
|
2644
2659
|
}
|
|
2645
2660
|
}
|
|
2646
2661
|
}
|
|
2647
|
-
else if (
|
|
2662
|
+
else if (nameToken) {
|
|
2648
2663
|
if (type instanceof Statements.EndOfDefinition) {
|
|
2649
|
-
this.macros.addMacro(
|
|
2650
|
-
|
|
2664
|
+
this.macros.addMacro(nameToken.getStr(), contents, file.getFilename());
|
|
2665
|
+
macroReferences === null || macroReferences === void 0 ? void 0 : macroReferences.addDefinition({ filename: file.getFilename(), token: nameToken }, start, statement.getLastToken().getEnd());
|
|
2666
|
+
nameToken = undefined;
|
|
2651
2667
|
}
|
|
2652
2668
|
else if (!(type instanceof _statement_1.Comment)) {
|
|
2653
2669
|
statements[i] = new statement_node_1.StatementNode(new _statement_1.MacroContent()).setChildren(this.tokensToNodes(statement.getTokens()));
|
|
@@ -2656,17 +2672,26 @@ class ExpandMacros {
|
|
|
2656
2672
|
}
|
|
2657
2673
|
}
|
|
2658
2674
|
}
|
|
2659
|
-
handleMacros(statements) {
|
|
2675
|
+
handleMacros(statements, file) {
|
|
2676
|
+
var _a;
|
|
2660
2677
|
const result = [];
|
|
2661
2678
|
let containsUnknown = false;
|
|
2679
|
+
const macroReferences = (_a = this.reg) === null || _a === void 0 ? void 0 : _a.getMacroReferences();
|
|
2662
2680
|
for (const statement of statements) {
|
|
2663
2681
|
const type = statement.get();
|
|
2664
2682
|
if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {
|
|
2665
2683
|
const macroName = this.findName(statement.getTokens());
|
|
2666
2684
|
if (macroName && this.macros.isMacro(macroName)) {
|
|
2685
|
+
const filename = this.macros.getMacroFilename(macroName);
|
|
2686
|
+
if (filename) {
|
|
2687
|
+
macroReferences === null || macroReferences === void 0 ? void 0 : macroReferences.addReference({
|
|
2688
|
+
filename: filename,
|
|
2689
|
+
token: statement.getFirstToken(),
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2667
2692
|
result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall(), statement.getColon()).setChildren(this.tokensToNodes(statement.getTokens())));
|
|
2668
2693
|
const expanded = this.expandContents(macroName, statement);
|
|
2669
|
-
const handled = this.handleMacros(expanded);
|
|
2694
|
+
const handled = this.handleMacros(expanded, file);
|
|
2670
2695
|
for (const e of handled.statements) {
|
|
2671
2696
|
result.push(e);
|
|
2672
2697
|
}
|
|
@@ -3560,9 +3585,9 @@ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/co
|
|
|
3560
3585
|
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
3561
3586
|
class CondBody extends combi_1.Expression {
|
|
3562
3587
|
getRunnable() {
|
|
3563
|
-
const when = (0, combi_1.seq)("WHEN", (0, combi_1.
|
|
3564
|
-
const elsee = (0, combi_1.seq)("ELSE", (0, combi_1.
|
|
3565
|
-
return (0, combi_1.seq)((0, combi_1.
|
|
3588
|
+
const when = (0, combi_1.seq)("WHEN", (0, combi_1.altPrio)(_1.Cond, _1.Source), "THEN", (0, combi_1.altPrio)(_1.Throw, _1.Source));
|
|
3589
|
+
const elsee = (0, combi_1.seq)("ELSE", (0, combi_1.altPrio)(_1.Throw, _1.Source));
|
|
3590
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.plusPrio)(when), (0, combi_1.optPrio)(elsee));
|
|
3566
3591
|
}
|
|
3567
3592
|
}
|
|
3568
3593
|
exports.CondBody = CondBody;
|
|
@@ -8522,10 +8547,10 @@ class StatementParser {
|
|
|
8522
8547
|
for (const w of wa) {
|
|
8523
8548
|
this.process(w);
|
|
8524
8549
|
this.categorize(w);
|
|
8525
|
-
macros.find(w.statements);
|
|
8550
|
+
macros.find(w.statements, w.file);
|
|
8526
8551
|
}
|
|
8527
8552
|
for (const w of wa) {
|
|
8528
|
-
const res = macros.handleMacros(w.statements);
|
|
8553
|
+
const res = macros.handleMacros(w.statements, w.file);
|
|
8529
8554
|
w.statements = res.statements;
|
|
8530
8555
|
if (res.containsUnknown === true) {
|
|
8531
8556
|
this.lazyUnknown(w);
|
|
@@ -40592,6 +40617,7 @@ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./n
|
|
|
40592
40617
|
const _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
|
|
40593
40618
|
const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
|
|
40594
40619
|
const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
|
|
40620
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
40595
40621
|
class LSPLookup {
|
|
40596
40622
|
static lookup(cursor, reg, obj) {
|
|
40597
40623
|
var _a, _b;
|
|
@@ -40708,6 +40734,18 @@ class LSPLookup {
|
|
|
40708
40734
|
scope: bottomScope,
|
|
40709
40735
|
};
|
|
40710
40736
|
}
|
|
40737
|
+
if (cursor.snode.get() instanceof _statement_1.MacroCall) {
|
|
40738
|
+
const macroDefinition = reg.getMacroReferences().findDefinitionByUsage(cursor.identifier.getFilename(), cursor.snode.getFirstToken());
|
|
40739
|
+
if (macroDefinition) {
|
|
40740
|
+
return {
|
|
40741
|
+
hover: "Macro Call",
|
|
40742
|
+
definition: {
|
|
40743
|
+
uri: macroDefinition === null || macroDefinition === void 0 ? void 0 : macroDefinition.filename,
|
|
40744
|
+
range: _lsp_utils_1.LSPUtils.tokenToRange(macroDefinition.token),
|
|
40745
|
+
},
|
|
40746
|
+
};
|
|
40747
|
+
}
|
|
40748
|
+
}
|
|
40711
40749
|
if (hoverValue !== "") {
|
|
40712
40750
|
return { hover: hoverValue, scope: bottomScope };
|
|
40713
40751
|
}
|
|
@@ -41084,6 +41122,9 @@ class CodeActions {
|
|
|
41084
41122
|
const diagnostics = [];
|
|
41085
41123
|
const fixes = [];
|
|
41086
41124
|
for (const i of issues) {
|
|
41125
|
+
if (i.getKey() !== key) {
|
|
41126
|
+
continue;
|
|
41127
|
+
}
|
|
41087
41128
|
const fix = i.getDefaultFix();
|
|
41088
41129
|
if (fix === undefined) {
|
|
41089
41130
|
continue;
|
|
@@ -41772,11 +41813,13 @@ exports.Highlight = Highlight;
|
|
|
41772
41813
|
|
|
41773
41814
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
41774
41815
|
exports.Hover = void 0;
|
|
41816
|
+
const Tokens = __webpack_require__(/*! ../abap/1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
|
|
41817
|
+
const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
41775
41818
|
const LServer = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/umd/main.js");
|
|
41776
41819
|
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
|
|
41777
41820
|
const _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
|
|
41778
|
-
const Tokens = __webpack_require__(/*! ../abap/1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
|
|
41779
41821
|
const _lookup_1 = __webpack_require__(/*! ./_lookup */ "./node_modules/@abaplint/core/build/src/lsp/_lookup.js");
|
|
41822
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
41780
41823
|
class Hover {
|
|
41781
41824
|
constructor(reg) {
|
|
41782
41825
|
this.reg = reg;
|
|
@@ -41800,6 +41843,12 @@ class Hover {
|
|
|
41800
41843
|
|| found.token instanceof Tokens.StringTemplateMiddle) {
|
|
41801
41844
|
return { kind: LServer.MarkupKind.Markdown, value: "String Template" };
|
|
41802
41845
|
}
|
|
41846
|
+
else if (found.snode.get() instanceof _statement_1.MacroCall) {
|
|
41847
|
+
return { kind: LServer.MarkupKind.Markdown, value: "Macro Call" };
|
|
41848
|
+
}
|
|
41849
|
+
else if (found.snode.get() instanceof Statements.Define && found.stack.length === 2) {
|
|
41850
|
+
return { kind: LServer.MarkupKind.Markdown, value: "Macro Name" };
|
|
41851
|
+
}
|
|
41803
41852
|
else if (found.token instanceof Tokens.Comment) {
|
|
41804
41853
|
let type = "Comment";
|
|
41805
41854
|
if (found.token.getStr().startsWith(`"!`)) {
|
|
@@ -42168,6 +42217,7 @@ class References {
|
|
|
42168
42217
|
const locs = this.search(lookup.definitionId, lookup.scope);
|
|
42169
42218
|
return locs.map(_lsp_utils_1.LSPUtils.identiferToLocation);
|
|
42170
42219
|
}
|
|
42220
|
+
////////////////////////////////////////////
|
|
42171
42221
|
// todo, cleanup this mehtod, some of the method parameters are not used anymore?
|
|
42172
42222
|
search(identifier, node, exitAfterFound = false, removeDuplicates = true) {
|
|
42173
42223
|
let ret = [];
|
|
@@ -42195,7 +42245,6 @@ class References {
|
|
|
42195
42245
|
return ret;
|
|
42196
42246
|
}
|
|
42197
42247
|
}
|
|
42198
|
-
////////////////////////////////////////////
|
|
42199
42248
|
removeDuplicates(arr) {
|
|
42200
42249
|
const values = {};
|
|
42201
42250
|
return arr.filter(item => {
|
|
@@ -42621,6 +42670,87 @@ exports.Symbols = Symbols;
|
|
|
42621
42670
|
|
|
42622
42671
|
/***/ }),
|
|
42623
42672
|
|
|
42673
|
+
/***/ "./node_modules/@abaplint/core/build/src/macro_references.js":
|
|
42674
|
+
/*!*******************************************************************!*\
|
|
42675
|
+
!*** ./node_modules/@abaplint/core/build/src/macro_references.js ***!
|
|
42676
|
+
\*******************************************************************/
|
|
42677
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
42678
|
+
|
|
42679
|
+
"use strict";
|
|
42680
|
+
|
|
42681
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
42682
|
+
exports.MacroReferences = void 0;
|
|
42683
|
+
class MacroReferences {
|
|
42684
|
+
constructor() {
|
|
42685
|
+
this.definitions = {};
|
|
42686
|
+
this.references = {};
|
|
42687
|
+
}
|
|
42688
|
+
addDefinition(ref, start, end) {
|
|
42689
|
+
if (this.definitions[ref.filename] === undefined) {
|
|
42690
|
+
this.definitions[ref.filename] = [];
|
|
42691
|
+
}
|
|
42692
|
+
else if (this.definitions[ref.filename].find((d) => d.token.getStart().equals(ref.token.getStart()))) {
|
|
42693
|
+
return;
|
|
42694
|
+
}
|
|
42695
|
+
this.definitions[ref.filename].push({ token: ref.token, start, end });
|
|
42696
|
+
}
|
|
42697
|
+
getDefinitionRange(filename, token) {
|
|
42698
|
+
for (const d of this.definitions[filename] || []) {
|
|
42699
|
+
if (d.token.getStart().equals(token.getStart())) {
|
|
42700
|
+
return { start: d.start, end: d.end };
|
|
42701
|
+
}
|
|
42702
|
+
}
|
|
42703
|
+
return undefined;
|
|
42704
|
+
}
|
|
42705
|
+
addReference(ref) {
|
|
42706
|
+
if (this.references[ref.filename] === undefined) {
|
|
42707
|
+
this.references[ref.filename] = [];
|
|
42708
|
+
}
|
|
42709
|
+
this.references[ref.filename].push(ref);
|
|
42710
|
+
}
|
|
42711
|
+
listDefinitionsByFile(filename) {
|
|
42712
|
+
const ret = [];
|
|
42713
|
+
for (const d of this.definitions[filename] || []) {
|
|
42714
|
+
ret.push(d.token);
|
|
42715
|
+
}
|
|
42716
|
+
return ret;
|
|
42717
|
+
}
|
|
42718
|
+
listUsagesbyMacro(filename, token) {
|
|
42719
|
+
const ret = [];
|
|
42720
|
+
const tokenStr = token.getStr().toUpperCase();
|
|
42721
|
+
for (const ref of this.references[filename] || []) {
|
|
42722
|
+
if (ref.token.getStr().toUpperCase() === tokenStr) {
|
|
42723
|
+
ret.push(ref);
|
|
42724
|
+
}
|
|
42725
|
+
}
|
|
42726
|
+
return ret;
|
|
42727
|
+
}
|
|
42728
|
+
clear(filename) {
|
|
42729
|
+
delete this.definitions[filename];
|
|
42730
|
+
delete this.references[filename];
|
|
42731
|
+
}
|
|
42732
|
+
findDefinitionByUsage(filename, token) {
|
|
42733
|
+
const tokenStr = token.getStr().toUpperCase();
|
|
42734
|
+
for (const ref of this.references[filename] || []) {
|
|
42735
|
+
if (ref.token.getStart().equals(token.getStart())) {
|
|
42736
|
+
for (const d of this.definitions[ref.filename] || []) {
|
|
42737
|
+
if (d.token.getStr().toUpperCase() === tokenStr) {
|
|
42738
|
+
return {
|
|
42739
|
+
filename: ref.filename,
|
|
42740
|
+
token: d.token,
|
|
42741
|
+
};
|
|
42742
|
+
}
|
|
42743
|
+
}
|
|
42744
|
+
}
|
|
42745
|
+
}
|
|
42746
|
+
return undefined;
|
|
42747
|
+
}
|
|
42748
|
+
}
|
|
42749
|
+
exports.MacroReferences = MacroReferences;
|
|
42750
|
+
//# sourceMappingURL=macro_references.js.map
|
|
42751
|
+
|
|
42752
|
+
/***/ }),
|
|
42753
|
+
|
|
42624
42754
|
/***/ "./node_modules/@abaplint/core/build/src/msag_references.js":
|
|
42625
42755
|
/*!******************************************************************!*\
|
|
42626
42756
|
!*** ./node_modules/@abaplint/core/build/src/msag_references.js ***!
|
|
@@ -50526,6 +50656,7 @@ const excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ "./node
|
|
|
50526
50656
|
const ddic_references_1 = __webpack_require__(/*! ./ddic_references */ "./node_modules/@abaplint/core/build/src/ddic_references.js");
|
|
50527
50657
|
const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "./node_modules/@abaplint/core/build/src/rules_runner.js");
|
|
50528
50658
|
const msag_references_1 = __webpack_require__(/*! ./msag_references */ "./node_modules/@abaplint/core/build/src/msag_references.js");
|
|
50659
|
+
const macro_references_1 = __webpack_require__(/*! ./macro_references */ "./node_modules/@abaplint/core/build/src/macro_references.js");
|
|
50529
50660
|
// todo, this should really be an instance in case there are multiple Registry'ies
|
|
50530
50661
|
class ParsingPerformance {
|
|
50531
50662
|
static clear() {
|
|
@@ -50580,10 +50711,11 @@ class Registry {
|
|
|
50580
50711
|
this.conf = conf ? conf : config_1.Config.getDefault();
|
|
50581
50712
|
this.ddicReferences = new ddic_references_1.DDICReferences();
|
|
50582
50713
|
this.msagReferences = new msag_references_1.MSAGReferences();
|
|
50714
|
+
this.macroReferences = new macro_references_1.MacroReferences();
|
|
50583
50715
|
}
|
|
50584
50716
|
static abaplintVersion() {
|
|
50585
50717
|
// magic, see build script "version.sh"
|
|
50586
|
-
return "2.
|
|
50718
|
+
return "2.109.3";
|
|
50587
50719
|
}
|
|
50588
50720
|
getDDICReferences() {
|
|
50589
50721
|
return this.ddicReferences;
|
|
@@ -50591,6 +50723,9 @@ class Registry {
|
|
|
50591
50723
|
getMSAGReferences() {
|
|
50592
50724
|
return this.msagReferences;
|
|
50593
50725
|
}
|
|
50726
|
+
getMacroReferences() {
|
|
50727
|
+
return this.macroReferences;
|
|
50728
|
+
}
|
|
50594
50729
|
*getObjects() {
|
|
50595
50730
|
for (const name in this.objects) {
|
|
50596
50731
|
for (const type in this.objects[name]) {
|
|
@@ -61322,6 +61457,7 @@ __exportStar(__webpack_require__(/*! ./cds_legacy_view */ "./node_modules/@abapl
|
|
|
61322
61457
|
__exportStar(__webpack_require__(/*! ./cds_parser_error */ "./node_modules/@abaplint/core/build/src/rules/cds_parser_error.js"), exports);
|
|
61323
61458
|
__exportStar(__webpack_require__(/*! ./chain_mainly_declarations */ "./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js"), exports);
|
|
61324
61459
|
__exportStar(__webpack_require__(/*! ./change_if_to_case */ "./node_modules/@abaplint/core/build/src/rules/change_if_to_case.js"), exports);
|
|
61460
|
+
__exportStar(__webpack_require__(/*! ./unused_macros */ "./node_modules/@abaplint/core/build/src/rules/unused_macros.js"), exports);
|
|
61325
61461
|
__exportStar(__webpack_require__(/*! ./check_abstract */ "./node_modules/@abaplint/core/build/src/rules/check_abstract.js"), exports);
|
|
61326
61462
|
__exportStar(__webpack_require__(/*! ./check_comments */ "./node_modules/@abaplint/core/build/src/rules/check_comments.js"), exports);
|
|
61327
61463
|
__exportStar(__webpack_require__(/*! ./check_ddic */ "./node_modules/@abaplint/core/build/src/rules/check_ddic.js"), exports);
|
|
@@ -71200,6 +71336,90 @@ exports.UnusedDDIC = UnusedDDIC;
|
|
|
71200
71336
|
|
|
71201
71337
|
/***/ }),
|
|
71202
71338
|
|
|
71339
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/unused_macros.js":
|
|
71340
|
+
/*!**********************************************************************!*\
|
|
71341
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/unused_macros.js ***!
|
|
71342
|
+
\**********************************************************************/
|
|
71343
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
71344
|
+
|
|
71345
|
+
"use strict";
|
|
71346
|
+
|
|
71347
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71348
|
+
exports.UnusedMacros = exports.UnusedMacrosConf = void 0;
|
|
71349
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
71350
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
71351
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
71352
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
|
|
71353
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
71354
|
+
class UnusedMacrosConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71355
|
+
constructor() {
|
|
71356
|
+
super(...arguments);
|
|
71357
|
+
/** skip specific names, case insensitive
|
|
71358
|
+
* @uniqueItems true
|
|
71359
|
+
*/
|
|
71360
|
+
this.skipNames = [];
|
|
71361
|
+
}
|
|
71362
|
+
}
|
|
71363
|
+
exports.UnusedMacrosConf = UnusedMacrosConf;
|
|
71364
|
+
class UnusedMacros {
|
|
71365
|
+
constructor() {
|
|
71366
|
+
this.conf = new UnusedMacrosConf();
|
|
71367
|
+
}
|
|
71368
|
+
getMetadata() {
|
|
71369
|
+
return {
|
|
71370
|
+
key: "unused_macros",
|
|
71371
|
+
title: "Unused macros",
|
|
71372
|
+
shortDescription: `Checks for unused macro definitions definitions`,
|
|
71373
|
+
tags: [_irule_1.RuleTag.Quickfix],
|
|
71374
|
+
badExample: `DEFINE foobar1.
|
|
71375
|
+
WRITE 'hello'.
|
|
71376
|
+
END-OF-DEFINITION.`,
|
|
71377
|
+
goodExample: `DEFINE foobar2.
|
|
71378
|
+
WRITE 'hello'.
|
|
71379
|
+
END-OF-DEFINITION.
|
|
71380
|
+
|
|
71381
|
+
foobar2.`,
|
|
71382
|
+
};
|
|
71383
|
+
}
|
|
71384
|
+
getConfig() {
|
|
71385
|
+
return this.conf;
|
|
71386
|
+
}
|
|
71387
|
+
setConfig(conf) {
|
|
71388
|
+
this.conf = conf;
|
|
71389
|
+
if (this.conf.skipNames === undefined) {
|
|
71390
|
+
this.conf.skipNames = [];
|
|
71391
|
+
}
|
|
71392
|
+
}
|
|
71393
|
+
initialize(reg) {
|
|
71394
|
+
this.reg = reg;
|
|
71395
|
+
return this;
|
|
71396
|
+
}
|
|
71397
|
+
run(obj) {
|
|
71398
|
+
var _a;
|
|
71399
|
+
const result = [];
|
|
71400
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
71401
|
+
return [];
|
|
71402
|
+
}
|
|
71403
|
+
const references = this.reg.getMacroReferences();
|
|
71404
|
+
for (const file of obj.getABAPFiles()) {
|
|
71405
|
+
for (const macroToken of references.listDefinitionsByFile(file.getFilename())) {
|
|
71406
|
+
const usages = references.listUsagesbyMacro(file.getFilename(), macroToken);
|
|
71407
|
+
if (usages.length === 0 && ((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.includes(macroToken.getStr().toUpperCase())) === false) {
|
|
71408
|
+
const message = "Unused macro definition: " + macroToken.getStr();
|
|
71409
|
+
const pos = references.getDefinitionRange(file.getFilename(), macroToken);
|
|
71410
|
+
const fix = edit_helper_1.EditHelper.deleteRange(file, pos.start, pos.end);
|
|
71411
|
+
result.push(issue_1.Issue.atToken(file, macroToken, message, this.getMetadata().key, this.conf.severity, fix));
|
|
71412
|
+
}
|
|
71413
|
+
}
|
|
71414
|
+
}
|
|
71415
|
+
return result;
|
|
71416
|
+
}
|
|
71417
|
+
}
|
|
71418
|
+
exports.UnusedMacros = UnusedMacros;
|
|
71419
|
+
//# sourceMappingURL=unused_macros.js.map
|
|
71420
|
+
|
|
71421
|
+
/***/ }),
|
|
71422
|
+
|
|
71203
71423
|
/***/ "./node_modules/@abaplint/core/build/src/rules/unused_methods.js":
|
|
71204
71424
|
/*!***********************************************************************!*\
|
|
71205
71425
|
!*** ./node_modules/@abaplint/core/build/src/rules/unused_methods.js ***!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.27",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"author": "abaplint",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@abaplint/transpiler": "^2.8.
|
|
29
|
+
"@abaplint/transpiler": "^2.8.27",
|
|
30
30
|
"@types/glob": "^8.1.0",
|
|
31
31
|
"glob": "=7.2.0",
|
|
32
32
|
"@types/progress": "^2.0.7",
|
|
33
|
-
"@types/node": "^20.14.
|
|
34
|
-
"@abaplint/core": "^2.
|
|
33
|
+
"@types/node": "^20.14.2",
|
|
34
|
+
"@abaplint/core": "^2.109.3",
|
|
35
35
|
"progress": "^2.0.3",
|
|
36
36
|
"webpack": "^5.91.0",
|
|
37
37
|
"webpack-cli": "^5.1.4",
|