@abaplint/core 2.93.35 → 2.93.37
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
|
@@ -5698,7 +5698,7 @@ declare class Table extends AbstractObject {
|
|
|
5698
5698
|
allowNamespace: boolean;
|
|
5699
5699
|
};
|
|
5700
5700
|
setDirty(): void;
|
|
5701
|
-
listKeys(): string[];
|
|
5701
|
+
listKeys(reg: IRegistry): string[];
|
|
5702
5702
|
parseType(reg: IRegistry): AbstractType;
|
|
5703
5703
|
getTableCategory(): TableCategory | undefined;
|
|
5704
5704
|
getEnhancementCategory(): EnhancementCategory;
|
|
@@ -42,7 +42,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
42
42
|
this.parsedData = undefined;
|
|
43
43
|
super.setDirty();
|
|
44
44
|
}
|
|
45
|
-
listKeys() {
|
|
45
|
+
listKeys(reg) {
|
|
46
46
|
if (this.parsedData === undefined) {
|
|
47
47
|
this.parseXML();
|
|
48
48
|
}
|
|
@@ -51,7 +51,15 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
51
51
|
}
|
|
52
52
|
const ret = [];
|
|
53
53
|
for (const p of this.parsedData.fields) {
|
|
54
|
-
if (p.KEYFLAG === "X") {
|
|
54
|
+
if (p.KEYFLAG === "X" && p.FIELDNAME === ".INCLUDE") {
|
|
55
|
+
const lookup = new ddic_1.DDIC(reg).lookupTableOrView(p.PRECFIELD).type;
|
|
56
|
+
if (lookup instanceof Types.StructureType) {
|
|
57
|
+
for (const c of lookup.getComponents()) {
|
|
58
|
+
ret.push(c.name);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (p.KEYFLAG === "X") {
|
|
55
63
|
ret.push(p.FIELDNAME);
|
|
56
64
|
}
|
|
57
65
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -50,6 +50,7 @@ Current rules:
|
|
|
50
50
|
* COND is outlined
|
|
51
51
|
* REDUCE is outlined
|
|
52
52
|
* SWITCH is outlined
|
|
53
|
+
* FILTER is outlined
|
|
53
54
|
* APPEND expression is outlined
|
|
54
55
|
* INSERT expression is outlined
|
|
55
56
|
* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/
|
|
@@ -288,6 +289,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
288
289
|
if (found) {
|
|
289
290
|
return found;
|
|
290
291
|
}
|
|
292
|
+
found = this.outlineFilter(low, high, lowFile, highSyntax);
|
|
293
|
+
if (found) {
|
|
294
|
+
return found;
|
|
295
|
+
}
|
|
291
296
|
found = this.outlineCast(low, high, lowFile, highSyntax);
|
|
292
297
|
if (found) {
|
|
293
298
|
return found;
|
|
@@ -1538,6 +1543,53 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1538
1543
|
}
|
|
1539
1544
|
return { body, end };
|
|
1540
1545
|
}
|
|
1546
|
+
outlineFilter(low, high, lowFile, highSyntax) {
|
|
1547
|
+
var _a, _b, _c;
|
|
1548
|
+
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
1549
|
+
return undefined;
|
|
1550
|
+
}
|
|
1551
|
+
for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {
|
|
1552
|
+
const firstToken = i.getFirstToken();
|
|
1553
|
+
if (firstToken.getStr().toUpperCase() !== "FILTER") {
|
|
1554
|
+
continue;
|
|
1555
|
+
}
|
|
1556
|
+
const filterBody = i.findDirectExpression(Expressions.FilterBody);
|
|
1557
|
+
if (filterBody === undefined) {
|
|
1558
|
+
continue;
|
|
1559
|
+
}
|
|
1560
|
+
let type = this.findType(i, lowFile, highSyntax);
|
|
1561
|
+
if (type === undefined) {
|
|
1562
|
+
if (high.get() instanceof Statements.Move
|
|
1563
|
+
&& high.findDirectExpression(Expressions.Source) === i
|
|
1564
|
+
&& ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
|
|
1565
|
+
type = "LIKE " + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
|
|
1566
|
+
}
|
|
1567
|
+
if (type === undefined) {
|
|
1568
|
+
continue;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
else {
|
|
1572
|
+
type = "TYPE " + type;
|
|
1573
|
+
}
|
|
1574
|
+
const sourceName = (_c = filterBody.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
1575
|
+
if (sourceName === undefined) {
|
|
1576
|
+
continue;
|
|
1577
|
+
}
|
|
1578
|
+
const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
|
|
1579
|
+
const loopName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
|
|
1580
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1581
|
+
let body = "";
|
|
1582
|
+
body += `${indentation}DATA ${uniqueName} ${type}.\n`;
|
|
1583
|
+
body += `${indentation}LOOP AT ${sourceName} INTO DATA(${loopName}) ${filterBody.concatTokens().substring(sourceName.length + 1)}.\n`;
|
|
1584
|
+
body += `${indentation} INSERT ${loopName} INTO TABLE ${uniqueName}.\n`;
|
|
1585
|
+
body += `${indentation}ENDLOOP.\n`;
|
|
1586
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);
|
|
1587
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);
|
|
1588
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
1589
|
+
return issue_1.Issue.atToken(lowFile, firstToken, "Downport FILTER", this.getMetadata().key, this.conf.severity, fix);
|
|
1590
|
+
}
|
|
1591
|
+
return undefined;
|
|
1592
|
+
}
|
|
1541
1593
|
outlineSwitch(low, high, lowFile, highSyntax) {
|
|
1542
1594
|
var _a, _b, _c, _d;
|
|
1543
1595
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.93.
|
|
3
|
+
"version": "2.93.37",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@microsoft/api-extractor": "^7.32.0",
|
|
50
50
|
"@types/chai": "^4.3.3",
|
|
51
51
|
"@types/mocha": "^10.0.0",
|
|
52
|
-
"@types/node": "^18.8.
|
|
52
|
+
"@types/node": "^18.8.3",
|
|
53
53
|
"chai": "^4.3.6",
|
|
54
54
|
"eslint": "^8.24.0",
|
|
55
55
|
"mocha": "^10.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"typescript": "^4.8.4"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"fast-xml-parser": "^4.0.
|
|
62
|
+
"fast-xml-parser": "^4.0.11",
|
|
63
63
|
"json5": "^2.2.1",
|
|
64
64
|
"vscode-languageserver-types": "^3.17.2"
|
|
65
65
|
}
|