@abaplint/core 2.85.28 → 2.85.31
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.
|
@@ -103,7 +103,9 @@ class StatementParser {
|
|
|
103
103
|
lazyUnknown(wa) {
|
|
104
104
|
const result = [];
|
|
105
105
|
for (let statement of wa.statements) {
|
|
106
|
-
if
|
|
106
|
+
// dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statment if lazy logic is evaluated
|
|
107
|
+
if (statement.get() instanceof _statement_1.Unknown
|
|
108
|
+
&& statement.concatTokens().toUpperCase().startsWith("CALL METHOD ") === false) {
|
|
107
109
|
for (const { first, second } of this.buildSplits(statement.getTokens())) {
|
|
108
110
|
const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));
|
|
109
111
|
if (!(s.get() instanceof _statement_1.Unknown)) {
|
|
@@ -36,10 +36,11 @@ class MethodSource {
|
|
|
36
36
|
ooType: "CLAS"
|
|
37
37
|
};
|
|
38
38
|
scope.addReference(last.getFirstToken(), foundMethod, _reference_1.ReferenceType.MethodReference, filename, extra);
|
|
39
|
+
return foundMethod;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
else if (context instanceof basic_1.VoidType) {
|
|
42
|
-
return;
|
|
43
|
+
return context;
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
throw new Error("MethodSource, not a object reference, " + node.concatTokens());
|
|
@@ -61,6 +62,7 @@ class MethodSource {
|
|
|
61
62
|
new Dynamic().runSyntax(d, scope, filename);
|
|
62
63
|
}
|
|
63
64
|
*/
|
|
65
|
+
return undefined;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
exports.MethodSource = MethodSource;
|
|
@@ -17,11 +17,11 @@ class Call {
|
|
|
17
17
|
if (methodSource === undefined) {
|
|
18
18
|
throw new Error("Call, child MethodSource not found");
|
|
19
19
|
}
|
|
20
|
-
new method_source_1.MethodSource().runSyntax(methodSource, scope, filename);
|
|
20
|
+
const methodDef = new method_source_1.MethodSource().runSyntax(methodSource, scope, filename);
|
|
21
21
|
const body = node.findDirectExpression(Expressions.MethodCallBody);
|
|
22
22
|
if (body) {
|
|
23
23
|
// todo, resolve the method definition above and pass, if possible, in case of dynamic pass void
|
|
24
|
-
new method_call_body_1.MethodCallBody().runSyntax(body, scope, filename, new void_type_1.VoidType("CallTODO"));
|
|
24
|
+
new method_call_body_1.MethodCallBody().runSyntax(body, scope, filename, methodDef || new void_type_1.VoidType("CallTODO"));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -307,7 +307,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
307
307
|
return undefined;
|
|
308
308
|
}
|
|
309
309
|
downportSelectSingleInline(_low, high, lowFile, _highSyntax) {
|
|
310
|
-
var _a, _b, _c;
|
|
310
|
+
var _a, _b, _c, _d;
|
|
311
311
|
const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];
|
|
312
312
|
if (targets.length !== 1) {
|
|
313
313
|
return undefined;
|
|
@@ -338,6 +338,16 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
338
338
|
else if (fieldList.concatTokens() === "*") {
|
|
339
339
|
fieldDefinition = `DATA ${name} TYPE ${tableName}.`;
|
|
340
340
|
}
|
|
341
|
+
else if (fieldList.concatTokens().toUpperCase() === "COUNT( * )") {
|
|
342
|
+
fieldDefinition = `DATA ${name} TYPE i.`;
|
|
343
|
+
}
|
|
344
|
+
else if (fieldList.getChildren().length === 1 && fieldList.getChildren()[0].get() instanceof Expressions.SQLAggregation) {
|
|
345
|
+
const c = fieldList.getChildren()[0];
|
|
346
|
+
if (c instanceof nodes_1.ExpressionNode) {
|
|
347
|
+
const concat = (_d = c.findFirstExpression(Expressions.SQLArithmetics)) === null || _d === void 0 ? void 0 : _d.concatTokens();
|
|
348
|
+
fieldDefinition = `DATA ${name} TYPE ${tableName}-${concat}.`;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
341
351
|
else {
|
|
342
352
|
for (const f of fields) {
|
|
343
353
|
const fieldName = f.concatTokens();
|
|
@@ -474,6 +484,7 @@ ${indentation}`);
|
|
|
474
484
|
if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {
|
|
475
485
|
return undefined;
|
|
476
486
|
}
|
|
487
|
+
let type = "";
|
|
477
488
|
const source = node.findFirstExpression(Expressions.Source);
|
|
478
489
|
if (source === undefined) {
|
|
479
490
|
return undefined;
|
|
@@ -491,13 +502,25 @@ ${indentation}`);
|
|
|
491
502
|
return undefined;
|
|
492
503
|
}
|
|
493
504
|
else if (source.findFirstExpression(Expressions.TableExpression)) {
|
|
494
|
-
|
|
505
|
+
const chain = source.findDirectExpression(Expressions.FieldChain);
|
|
506
|
+
if (chain !== undefined
|
|
507
|
+
&& chain.getChildren().length === 2
|
|
508
|
+
&& chain.getChildren()[0].get() instanceof Expressions.SourceField
|
|
509
|
+
&& chain.getChildren()[1].get() instanceof Expressions.TableExpression) {
|
|
510
|
+
type = "LINE OF " + chain.getChildren()[0].concatTokens();
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
return undefined;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
type = source.concatTokens();
|
|
495
518
|
}
|
|
496
519
|
const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
497
520
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
498
521
|
const firstToken = node.getFirstToken();
|
|
499
522
|
const lastToken = node.getLastToken();
|
|
500
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${
|
|
523
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${type}.\n${indentation}`);
|
|
501
524
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);
|
|
502
525
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
503
526
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -1004,15 +1027,22 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1004
1027
|
if (spag === undefined) {
|
|
1005
1028
|
continue;
|
|
1006
1029
|
}
|
|
1007
|
-
|
|
1008
|
-
if (
|
|
1009
|
-
|
|
1030
|
+
let type = "";
|
|
1031
|
+
if (node.concatTokens().toUpperCase().startsWith("APPEND INITIAL LINE TO ")) {
|
|
1032
|
+
type = "LIKE LINE OF " + ((_b = node.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
|
|
1010
1033
|
}
|
|
1011
|
-
else
|
|
1012
|
-
|
|
1034
|
+
else {
|
|
1035
|
+
const found = spag.findVariable(name);
|
|
1036
|
+
if (found === undefined) {
|
|
1037
|
+
continue;
|
|
1038
|
+
}
|
|
1039
|
+
else if (found.getType() instanceof basic_1.VoidType) {
|
|
1040
|
+
return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Error outlining voided type", this.getMetadata().key, this.conf.severity);
|
|
1041
|
+
}
|
|
1042
|
+
type = "TYPE ";
|
|
1043
|
+
type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();
|
|
1013
1044
|
}
|
|
1014
|
-
const
|
|
1015
|
-
const code = `FIELD-SYMBOLS ${name} TYPE ${type}.\n` +
|
|
1045
|
+
const code = `FIELD-SYMBOLS ${name} ${type}.\n` +
|
|
1016
1046
|
" ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1017
1047
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
|
|
1018
1048
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);
|