@abaplint/core 2.85.27 → 2.85.30
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/src/abap/2_statements/statement_parser.js +3 -1
- package/build/src/abap/5_syntax/expressions/method_source.js +3 -1
- package/build/src/abap/5_syntax/statements/call.js +2 -2
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +9 -1
- package/build/src/rules/many_parentheses.js +17 -0
- package/package.json +1 -1
|
@@ -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
|
@@ -338,6 +338,9 @@ 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
|
+
}
|
|
341
344
|
else {
|
|
342
345
|
for (const f of fields) {
|
|
343
346
|
const fieldName = f.concatTokens();
|
|
@@ -490,6 +493,9 @@ ${indentation}`);
|
|
|
490
493
|
else if (source.findFirstExpression(Expressions.FieldLength)) {
|
|
491
494
|
return undefined;
|
|
492
495
|
}
|
|
496
|
+
else if (source.findFirstExpression(Expressions.TableExpression)) {
|
|
497
|
+
return undefined;
|
|
498
|
+
}
|
|
493
499
|
const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
494
500
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
495
501
|
const firstToken = node.getFirstToken();
|
|
@@ -1147,7 +1153,9 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1147
1153
|
uniqueName(position, filename, highSyntax) {
|
|
1148
1154
|
const spag = highSyntax.spaghetti.lookupPosition(position, filename);
|
|
1149
1155
|
if (spag === undefined) {
|
|
1150
|
-
|
|
1156
|
+
const name = "temprr" + this.counter;
|
|
1157
|
+
this.counter++;
|
|
1158
|
+
return name;
|
|
1151
1159
|
}
|
|
1152
1160
|
while (true) {
|
|
1153
1161
|
const name = "temp" + this.counter;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ManyParentheses = exports.ManyParenthesesConf = void 0;
|
|
4
4
|
const Expressions = require("../abap/2_statements/expressions");
|
|
5
|
+
const Statements = require("../abap/2_statements/statements");
|
|
5
6
|
const issue_1 = require("../issue");
|
|
6
7
|
const _abap_rule_1 = require("./_abap_rule");
|
|
7
8
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
@@ -64,9 +65,25 @@ ENDIF.
|
|
|
64
65
|
issues.push(issue);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
for (const m of structure.findAllStatements(Statements.Move)) {
|
|
69
|
+
issues.push(...this.analyzeMove(file, m));
|
|
70
|
+
}
|
|
67
71
|
return issues;
|
|
68
72
|
}
|
|
69
73
|
////////////////////
|
|
74
|
+
analyzeMove(file, m) {
|
|
75
|
+
const issues = [];
|
|
76
|
+
const children = m.getChildren();
|
|
77
|
+
const last = children[children.length - 2];
|
|
78
|
+
const lastChildren = last.getChildren();
|
|
79
|
+
if (lastChildren.length === 3
|
|
80
|
+
&& lastChildren[0].getFirstToken().getStr() === "("
|
|
81
|
+
&& lastChildren[2].getFirstToken().getStr() === ")") {
|
|
82
|
+
const issue = issue_1.Issue.atToken(file, last.getFirstToken(), "Too many parentheses", this.getMetadata().key, this.conf.severity);
|
|
83
|
+
issues.push(issue);
|
|
84
|
+
}
|
|
85
|
+
return issues;
|
|
86
|
+
}
|
|
70
87
|
analyze(file, cond) {
|
|
71
88
|
const issues = [];
|
|
72
89
|
let comparator = "";
|