@abaplint/core 2.85.35 → 2.85.38
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.
|
@@ -107,6 +107,9 @@ class StatementParser {
|
|
|
107
107
|
if (statement.get() instanceof _statement_1.Unknown
|
|
108
108
|
&& statement.concatTokens().toUpperCase().startsWith("CALL METHOD ") === false) {
|
|
109
109
|
for (const { first, second } of this.buildSplits(statement.getTokens())) {
|
|
110
|
+
if (second.length === 1) {
|
|
111
|
+
continue; // probably punctuation
|
|
112
|
+
}
|
|
110
113
|
const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));
|
|
111
114
|
if (!(s.get() instanceof _statement_1.Unknown)) {
|
|
112
115
|
result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));
|
package/build/src/registry.js
CHANGED
|
@@ -19,6 +19,8 @@ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
|
|
|
19
19
|
const basic_1 = require("../abap/types/basic");
|
|
20
20
|
const config_1 = require("../config");
|
|
21
21
|
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
22
|
+
const include_graph_1 = require("../utils/include_graph");
|
|
23
|
+
const objects_1 = require("../objects");
|
|
22
24
|
// todo: refactor each sub-rule to new classes?
|
|
23
25
|
// todo: add configuration
|
|
24
26
|
class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
@@ -75,10 +77,12 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
75
77
|
const version = this.lowReg.getConfig().getVersion();
|
|
76
78
|
if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {
|
|
77
79
|
this.initHighReg();
|
|
80
|
+
this.graph = new include_graph_1.IncludeGraph(reg);
|
|
78
81
|
}
|
|
79
82
|
return this;
|
|
80
83
|
}
|
|
81
84
|
run(lowObj) {
|
|
85
|
+
var _a;
|
|
82
86
|
const ret = [];
|
|
83
87
|
this.counter = 1;
|
|
84
88
|
const version = this.lowReg.getConfig().getVersion();
|
|
@@ -92,7 +96,20 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
92
96
|
if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {
|
|
93
97
|
return ret;
|
|
94
98
|
}
|
|
95
|
-
|
|
99
|
+
let highSyntaxObj = highObj;
|
|
100
|
+
// for includes do the syntax check via a main program
|
|
101
|
+
if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {
|
|
102
|
+
const mains = this.graph.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());
|
|
103
|
+
if (mains.length <= 0) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
const f = this.highReg.getFileByName(mains[0]);
|
|
107
|
+
if (f === undefined) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
highSyntaxObj = this.highReg.findObjectForFile(f);
|
|
111
|
+
}
|
|
112
|
+
const highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
|
|
96
113
|
for (const lowFile of lowObj.getABAPFiles()) {
|
|
97
114
|
const highFile = highObj.getABAPFileByName(lowFile.getFilename());
|
|
98
115
|
if (highFile === undefined) {
|
|
@@ -242,7 +259,6 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
242
259
|
if (found) {
|
|
243
260
|
return found;
|
|
244
261
|
}
|
|
245
|
-
// note: line_exists() must be replaced before this call
|
|
246
262
|
found = this.replaceTableExpression(high, lowFile, highSyntax);
|
|
247
263
|
if (found) {
|
|
248
264
|
return found;
|
|
@@ -450,6 +466,11 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
450
466
|
if (tableExpression === undefined) {
|
|
451
467
|
continue;
|
|
452
468
|
}
|
|
469
|
+
const concat = node.concatTokens().toUpperCase();
|
|
470
|
+
if (concat.includes(" LINE_EXISTS( ") || concat.includes(" LINE_INDEX( ")) {
|
|
471
|
+
// note: line_exists() must be replaced before handling table expressions
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
453
474
|
let pre = "";
|
|
454
475
|
let startToken = undefined;
|
|
455
476
|
for (const child of fieldChain.getChildren()) {
|
|
@@ -1148,8 +1169,8 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1148
1169
|
if (found === undefined) {
|
|
1149
1170
|
continue;
|
|
1150
1171
|
}
|
|
1151
|
-
else if (found.getType() instanceof basic_1.VoidType) {
|
|
1152
|
-
|
|
1172
|
+
else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {
|
|
1173
|
+
continue;
|
|
1153
1174
|
}
|
|
1154
1175
|
const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();
|
|
1155
1176
|
const code = `DATA ${name} TYPE ${type}.\n` +
|
|
@@ -1306,9 +1327,11 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1306
1327
|
var _a, _b;
|
|
1307
1328
|
const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
|
|
1308
1329
|
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
1330
|
+
if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {
|
|
1331
|
+
continue;
|
|
1332
|
+
}
|
|
1309
1333
|
const func = r.position.getName().toUpperCase();
|
|
1310
|
-
if (
|
|
1311
|
-
&& (func === "LINE_EXISTS" || func === "LINE_INDEX")) {
|
|
1334
|
+
if (func === "LINE_EXISTS" || func === "LINE_INDEX") {
|
|
1312
1335
|
const token = r.position.getToken();
|
|
1313
1336
|
const expression = this.findMethodCallExpression(node, token);
|
|
1314
1337
|
if (expression === undefined) {
|
|
@@ -1327,7 +1350,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1327
1350
|
}
|
|
1328
1351
|
condition += c.concatTokens() + " ";
|
|
1329
1352
|
}
|
|
1330
|
-
const tableName = (_b = expression
|
|
1353
|
+
const tableName = (_b = expression.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens().split("[")[0];
|
|
1331
1354
|
const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1332
1355
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1333
1356
|
const sy = func === "LINE_EXISTS" ? "sy-subrc" : "sy-tabix";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.85.
|
|
3
|
+
"version": "2.85.38",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"typescript": "^4.6.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"fast-xml-parser": "^4.0.
|
|
61
|
+
"fast-xml-parser": "^4.0.4",
|
|
62
62
|
"json5": "^2.2.0",
|
|
63
63
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
64
64
|
"vscode-languageserver-types": "^3.16.0"
|