@abaplint/core 2.93.21 → 2.93.23
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.
|
@@ -7,7 +7,8 @@ const component_compare_simple_1 = require("./component_compare_simple");
|
|
|
7
7
|
class LoopGroupByComponent extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const groupSize = (0, combi_1.seq)(component_name_1.ComponentName, "=", "GROUP SIZE");
|
|
10
|
-
const
|
|
10
|
+
const groupIndex = (0, combi_1.seq)(component_name_1.ComponentName, "=", "GROUP INDEX");
|
|
11
|
+
const components = (0, combi_1.alt)(component_compare_simple_1.ComponentCompareSimple, groupSize, groupIndex);
|
|
11
12
|
return components;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -7,6 +7,7 @@ const source_1 = require("../expressions/source");
|
|
|
7
7
|
const target_1 = require("../expressions/target");
|
|
8
8
|
const fstarget_1 = require("../expressions/fstarget");
|
|
9
9
|
const basic_1 = require("../../types/basic");
|
|
10
|
+
const inline_data_1 = require("../expressions/inline_data");
|
|
10
11
|
class InsertInternal {
|
|
11
12
|
runSyntax(node, scope, filename) {
|
|
12
13
|
let targetType;
|
|
@@ -16,13 +17,13 @@ class InsertInternal {
|
|
|
16
17
|
if (targetType instanceof basic_1.TableType) {
|
|
17
18
|
targetType = targetType.getRowType();
|
|
18
19
|
}
|
|
20
|
+
let source = node.findDirectExpression(Expressions.SimpleSource4);
|
|
21
|
+
if (source === undefined) {
|
|
22
|
+
source = node.findDirectExpression(Expressions.Source);
|
|
23
|
+
}
|
|
24
|
+
const sourceType = source ? new source_1.Source().runSyntax(source, scope, filename, targetType) : targetType;
|
|
19
25
|
const afterAssigning = node.findExpressionAfterToken("ASSIGNING");
|
|
20
26
|
if ((afterAssigning === null || afterAssigning === void 0 ? void 0 : afterAssigning.get()) instanceof Expressions.FSTarget) {
|
|
21
|
-
let source = node.findDirectExpression(Expressions.SimpleSource4);
|
|
22
|
-
if (source === undefined) {
|
|
23
|
-
source = node.findDirectExpression(Expressions.Source);
|
|
24
|
-
}
|
|
25
|
-
const sourceType = source ? new source_1.Source().runSyntax(source, scope, filename, targetType) : targetType;
|
|
26
27
|
const inlinefs = afterAssigning === null || afterAssigning === void 0 ? void 0 : afterAssigning.findDirectExpression(Expressions.InlineFS);
|
|
27
28
|
if (inlinefs) {
|
|
28
29
|
new inline_fs_1.InlineFS().runSyntax(inlinefs, scope, filename, sourceType);
|
|
@@ -31,6 +32,16 @@ class InsertInternal {
|
|
|
31
32
|
new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
const afterInto = node.findExpressionAfterToken("INTO");
|
|
36
|
+
if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
|
|
37
|
+
const inline = afterInto.findDirectExpression(Expressions.InlineData);
|
|
38
|
+
if (inline) {
|
|
39
|
+
new inline_data_1.InlineData().runSyntax(afterInto, scope, filename, new basic_1.DataReference(sourceType));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
new target_1.Target().runSyntax(afterInto, scope, filename);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
34
45
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
35
46
|
new source_1.Source().runSyntax(s, scope, filename, targetType);
|
|
36
47
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -921,7 +921,7 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
|
921
921
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, simple REF move", this.getMetadata().key, this.conf.severity, fix);
|
|
922
922
|
}
|
|
923
923
|
downportLoopGroup(high, lowFile, highSyntax, highFile) {
|
|
924
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
924
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
925
925
|
if (!(high.get() instanceof Statements.Loop)) {
|
|
926
926
|
return undefined;
|
|
927
927
|
}
|
|
@@ -950,6 +950,7 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
|
950
950
|
let code = `TYPES: BEGIN OF ${groupTargetName}type,\n`;
|
|
951
951
|
let condition = "";
|
|
952
952
|
let groupCountName = undefined;
|
|
953
|
+
let groupIndexName = undefined;
|
|
953
954
|
for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
|
|
954
955
|
const name = c.findFirstExpression(Expressions.ComponentName);
|
|
955
956
|
let type = ((_h = c.findFirstExpression(Expressions.Source)) === null || _h === void 0 ? void 0 : _h.concatTokens()) || "todo";
|
|
@@ -957,6 +958,10 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
|
957
958
|
type = "i";
|
|
958
959
|
groupCountName = name === null || name === void 0 ? void 0 : name.concatTokens();
|
|
959
960
|
}
|
|
961
|
+
else if ((_k = c.concatTokens()) === null || _k === void 0 ? void 0 : _k.toUpperCase().endsWith(" = GROUP INDEX")) {
|
|
962
|
+
type = "i";
|
|
963
|
+
groupIndexName = name === null || name === void 0 ? void 0 : name.concatTokens();
|
|
964
|
+
}
|
|
960
965
|
else {
|
|
961
966
|
condition += c.concatTokens();
|
|
962
967
|
type = type.replace(loopTargetName, loopSourceRowType);
|
|
@@ -976,12 +981,16 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
|
976
981
|
}
|
|
977
982
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
978
983
|
const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
984
|
+
const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
979
985
|
code += ` items LIKE ${loopSourceName},
|
|
980
986
|
END OF ${groupTargetName}type.
|
|
981
987
|
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
982
988
|
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
983
|
-
LOOP AT ${loopSourceName} ${(
|
|
984
|
-
|
|
989
|
+
LOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\n`;
|
|
990
|
+
if (groupIndexName !== undefined) {
|
|
991
|
+
code += `DATA(${uniqueNameIndex}) = sy-tabix.\n`;
|
|
992
|
+
}
|
|
993
|
+
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
985
994
|
IF sy-subrc = 0.\n`;
|
|
986
995
|
if (groupCountName !== undefined) {
|
|
987
996
|
code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\n`;
|
|
@@ -990,7 +999,13 @@ IF sy-subrc = 0.\n`;
|
|
|
990
999
|
ELSE.\n`;
|
|
991
1000
|
code += ` CLEAR ${uniqueName}.\n`;
|
|
992
1001
|
for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
|
|
993
|
-
|
|
1002
|
+
const concat = c.concatTokens();
|
|
1003
|
+
if (concat.endsWith(" GROUP INDEX")) {
|
|
1004
|
+
code += ` ${uniqueName}-${groupIndexName} = ${uniqueNameIndex}.\n`;
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
code += ` ${uniqueName}-${concat.replace("GROUP SIZE", "1")}.\n`;
|
|
1008
|
+
}
|
|
994
1009
|
}
|
|
995
1010
|
if (singleName !== "") {
|
|
996
1011
|
code += ` ${uniqueName}-${singleName} = ${loopTargetName}-${singleName}.\n`;
|
|
@@ -1001,13 +1016,13 @@ ELSE.\n`;
|
|
|
1001
1016
|
ENDLOOP.
|
|
1002
1017
|
LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
1003
1018
|
let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1004
|
-
for (const l of ((
|
|
1019
|
+
for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {
|
|
1005
1020
|
// make sure to find the correct/current loop statement
|
|
1006
1021
|
if (l.findDirectStatement(Statements.Loop) !== high) {
|
|
1007
1022
|
continue;
|
|
1008
1023
|
}
|
|
1009
1024
|
for (const loop of l.findAllStatements(Statements.Loop)) {
|
|
1010
|
-
if ((
|
|
1025
|
+
if ((_o = loop.concatTokens()) === null || _o === void 0 ? void 0 : _o.toUpperCase().startsWith("LOOP AT GROUP ")) {
|
|
1011
1026
|
const subLoopSource = loop.findFirstExpression(Expressions.SimpleSource2);
|
|
1012
1027
|
if (subLoopSource === undefined) {
|
|
1013
1028
|
continue;
|