@abaplint/core 2.113.216 → 2.113.217
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/expressions/association_name.js +1 -1
- package/build/src/abap/5_syntax/expressions/field_chain.js +3 -1
- package/build/src/abap/5_syntax/statements/loop.js +33 -4
- package/build/src/cds/expressions/cds_case.js +1 -1
- package/build/src/cds/expressions/cds_define_custom.js +1 -1
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ exports.AssociationName = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class AssociationName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(
|
|
7
|
+
return (0, combi_1.regex)(/^(\\_[\w]+)+$/);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.AssociationName = AssociationName;
|
|
@@ -50,8 +50,10 @@ class FieldChain {
|
|
|
50
50
|
}
|
|
51
51
|
else if (current.get() instanceof tokens_1.Dash) {
|
|
52
52
|
if (context instanceof basic_1.UnknownType) {
|
|
53
|
+
/*
|
|
53
54
|
const message = "Not a structure, type unknown, FieldChain";
|
|
54
|
-
input.issues.push(
|
|
55
|
+
input.issues.push(syntaxIssue(input, current.getFirstToken(), message));
|
|
56
|
+
*/
|
|
55
57
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
56
58
|
}
|
|
57
59
|
else if (!(context instanceof basic_1.StructureType)
|
|
@@ -12,9 +12,10 @@ const component_cond_1 = require("../expressions/component_cond");
|
|
|
12
12
|
const dynamic_1 = require("../expressions/dynamic");
|
|
13
13
|
const loop_group_by_1 = require("../expressions/loop_group_by");
|
|
14
14
|
const _syntax_input_1 = require("../_syntax_input");
|
|
15
|
+
const version_1 = require("../../../version");
|
|
15
16
|
class Loop {
|
|
16
17
|
runSyntax(node, input) {
|
|
17
|
-
var _a;
|
|
18
|
+
var _a, _b;
|
|
18
19
|
const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
|
|
19
20
|
let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
|
|
20
21
|
const targetType = target ? target_1.Target.runSyntax(target, input) : undefined;
|
|
@@ -64,6 +65,7 @@ class Loop {
|
|
|
64
65
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
65
66
|
}
|
|
66
67
|
const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
|
|
68
|
+
const topType = sourceType; // todo: refactor topType vs sourceType vs rowType
|
|
67
69
|
if (sourceType instanceof basic_1.TableType) {
|
|
68
70
|
rowType = sourceType.getRowType();
|
|
69
71
|
sourceType = rowType;
|
|
@@ -71,6 +73,10 @@ class Loop {
|
|
|
71
73
|
sourceType = new basic_1.DataReference(sourceType);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
76
|
+
const cond = node.findDirectExpression(Expressions.ComponentCond);
|
|
77
|
+
if (cond !== undefined) {
|
|
78
|
+
component_cond_1.ComponentCond.runSyntax(cond, input, rowType);
|
|
79
|
+
}
|
|
74
80
|
if (targetConcat
|
|
75
81
|
&& targetConcat.startsWith("TRANSPORTING ")
|
|
76
82
|
&& node.findDirectTokenByText("WHERE") === undefined) {
|
|
@@ -78,6 +84,32 @@ class Loop {
|
|
|
78
84
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
79
85
|
return;
|
|
80
86
|
}
|
|
87
|
+
if (node.findDirectTokenByText("USING") !== undefined
|
|
88
|
+
&& cond !== undefined
|
|
89
|
+
&& topType instanceof basic_1.TableType) {
|
|
90
|
+
// https://github.com/abap2xlsx/abap2xlsx/issues/1341
|
|
91
|
+
const keyName = node.findExpressionAfterToken("KEY");
|
|
92
|
+
let key = undefined;
|
|
93
|
+
if ((keyName === null || keyName === void 0 ? void 0 : keyName.get()) instanceof Expressions.SimpleName) {
|
|
94
|
+
// it might be dynamic, in that case we cannot check anything
|
|
95
|
+
key = (_b = topType.getOptions().secondary) === null || _b === void 0 ? void 0 : _b.find(k => k.name.toUpperCase() === keyName.getFirstToken().getStr().toUpperCase());
|
|
96
|
+
if (key === undefined) {
|
|
97
|
+
const message = "Key " + (keyName === null || keyName === void 0 ? void 0 : keyName.concatTokens()) + " not found in table type";
|
|
98
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (input.scope.getRegistry().getConfig().getVersion() <= version_1.Version.v740sp02) {
|
|
102
|
+
const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
|
|
103
|
+
for (const keyField of key.keyFields) {
|
|
104
|
+
if (compares.find(c => c === keyField.toUpperCase() + " IS INITIAL") !== undefined) {
|
|
105
|
+
const message = "Loop, key check with IS INITIAL cannot optimized before 7.40 SP02";
|
|
106
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
81
113
|
const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
|
|
82
114
|
if (inline) {
|
|
83
115
|
inline_data_1.InlineData.runSyntax(inline, input, sourceType);
|
|
@@ -98,9 +130,6 @@ class Loop {
|
|
|
98
130
|
fstarget_1.FSTarget.runSyntax(fstarget, input, sourceType);
|
|
99
131
|
}
|
|
100
132
|
}
|
|
101
|
-
for (const t of node.findDirectExpressions(Expressions.ComponentCond)) {
|
|
102
|
-
component_cond_1.ComponentCond.runSyntax(t, input, rowType);
|
|
103
|
-
}
|
|
104
133
|
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
105
134
|
dynamic_1.Dynamic.runSyntax(t, input);
|
|
106
135
|
}
|
|
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
class CDSCase extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
-
const value = (0, combi_1.altPrio)(_1.
|
|
9
|
+
const value = (0, combi_1.altPrio)(_1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, _1.CDSFunction, name);
|
|
10
10
|
const thenValue = (0, combi_1.altPrio)((0, combi_1.seq)("(", value, ")"), value);
|
|
11
11
|
const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", thenValue)));
|
|
12
12
|
const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", thenValue));
|
|
@@ -9,7 +9,7 @@ class CDSDefineCustom extends combi_1.Expression {
|
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const field = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
|
|
11
11
|
const compsiOrAssoci = (0, combi_1.seq)(cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
|
|
12
|
-
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), (0, combi_1.opt)(_1.CDSWithParameters),
|
|
12
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.CDSDefineCustom = CDSDefineCustom;
|
package/build/src/registry.js
CHANGED