@abaplint/core 2.95.0 → 2.95.2
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
CHANGED
|
@@ -5308,6 +5308,7 @@ declare class StatementNode extends AbstractNode<ExpressionNode | TokenNode> {
|
|
|
5308
5308
|
includesToken(search: Token): boolean;
|
|
5309
5309
|
getTokenNodes(): readonly TokenNode[];
|
|
5310
5310
|
concatTokens(): string;
|
|
5311
|
+
concatTokensVirtual(): string;
|
|
5311
5312
|
concatTokensWithoutStringsAndComments(): string;
|
|
5312
5313
|
getTerminator(): string;
|
|
5313
5314
|
getFirstToken(): Token;
|
|
@@ -90,7 +90,7 @@ class ExpandMacros {
|
|
|
90
90
|
if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {
|
|
91
91
|
const macroName = this.findName(statement.getTokens());
|
|
92
92
|
if (macroName && this.macros.isMacro(macroName)) {
|
|
93
|
-
result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall()).setChildren(this.tokensToNodes(statement.getTokens())));
|
|
93
|
+
result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall(), statement.getColon()).setChildren(this.tokensToNodes(statement.getTokens())));
|
|
94
94
|
const expanded = this.expandContents(macroName, statement);
|
|
95
95
|
const handled = this.handleMacros(expanded);
|
|
96
96
|
for (const e of handled.statements) {
|
|
@@ -85,6 +85,30 @@ class StatementNode extends _abstract_node_1.AbstractNode {
|
|
|
85
85
|
}
|
|
86
86
|
return str;
|
|
87
87
|
}
|
|
88
|
+
concatTokensVirtual() {
|
|
89
|
+
let str = "";
|
|
90
|
+
let prev;
|
|
91
|
+
for (const token of this.getTokens()) {
|
|
92
|
+
if (token instanceof pragma_1.Pragma) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const vprev = prev === null || prev === void 0 ? void 0 : prev.getStart();
|
|
96
|
+
const vtoke = token === null || token === void 0 ? void 0 : token.getStart();
|
|
97
|
+
if (str === "") {
|
|
98
|
+
str = token.getStr();
|
|
99
|
+
}
|
|
100
|
+
else if (prev && vprev && vtoke
|
|
101
|
+
&& prev.getStr().length + vprev.vcol === vtoke.vcol
|
|
102
|
+
&& vprev.vrow === vtoke.vrow) {
|
|
103
|
+
str = str + token.getStr();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
str = str + " " + token.getStr();
|
|
107
|
+
}
|
|
108
|
+
prev = token;
|
|
109
|
+
}
|
|
110
|
+
return str;
|
|
111
|
+
}
|
|
88
112
|
concatTokensWithoutStringsAndComments() {
|
|
89
113
|
let str = "";
|
|
90
114
|
let prev;
|
package/build/src/registry.js
CHANGED
|
@@ -52,14 +52,24 @@ _hello.`,
|
|
|
52
52
|
for (let j = i + 1; j < statements.length; j++) {
|
|
53
53
|
const sub = statements[j];
|
|
54
54
|
if (sub.getFirstToken().getStart() instanceof position_1.VirtualPosition) {
|
|
55
|
-
replace
|
|
55
|
+
if (replace !== "") {
|
|
56
|
+
replace += "\n";
|
|
57
|
+
}
|
|
58
|
+
replace += sub.concatTokensVirtual();
|
|
56
59
|
}
|
|
57
60
|
else {
|
|
58
61
|
break;
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
|
|
64
|
+
if (statementNode.getColon()) {
|
|
65
|
+
replace += "\n";
|
|
66
|
+
}
|
|
67
|
+
const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statementNode);
|
|
68
|
+
const fix2 = edit_helper_1.EditHelper.insertAt(file, statementNode.getStart(), replace);
|
|
69
|
+
const fix = edit_helper_1.EditHelper.merge(fix1, fix2);
|
|
62
70
|
issues.push(issue_1.Issue.atStatement(file, statementNode, message, this.getMetadata().key, this.conf.severity, fix));
|
|
71
|
+
// only one fix at a time per file
|
|
72
|
+
break;
|
|
63
73
|
}
|
|
64
74
|
return issues;
|
|
65
75
|
}
|