@abaplint/core 2.91.23 → 2.91.26

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.
@@ -1866,6 +1866,8 @@ declare namespace Expressions {
1866
1866
  Language,
1867
1867
  Length,
1868
1868
  Let,
1869
+ LoopGroupByComponent,
1870
+ LoopGroupByTarget,
1869
1871
  LoopGroupBy,
1870
1872
  MacroName,
1871
1873
  MessageClass_2 as MessageClass,
@@ -1936,6 +1938,7 @@ declare namespace Expressions {
1936
1938
  SQLFieldListLoop,
1937
1939
  SQLFieldList,
1938
1940
  SQLFieldName,
1941
+ SQLField,
1939
1942
  SQLForAllEntries,
1940
1943
  SQLFromSource,
1941
1944
  SQLFrom,
@@ -3548,6 +3551,14 @@ declare class LoopGroupBy extends Expression {
3548
3551
  getRunnable(): IStatementRunnable;
3549
3552
  }
3550
3553
 
3554
+ declare class LoopGroupByComponent extends Expression {
3555
+ getRunnable(): IStatementRunnable;
3556
+ }
3557
+
3558
+ declare class LoopGroupByTarget extends Expression {
3559
+ getRunnable(): IStatementRunnable;
3560
+ }
3561
+
3551
3562
  declare class MacroName extends Expression {
3552
3563
  getRunnable(): IStatementRunnable;
3553
3564
  }
@@ -4938,6 +4949,10 @@ declare class SQLCond extends Expression {
4938
4949
  getRunnable(): IStatementRunnable;
4939
4950
  }
4940
4951
 
4952
+ declare class SQLField extends Expression {
4953
+ getRunnable(): IStatementRunnable;
4954
+ }
4955
+
4941
4956
  declare class SQLFieldList extends Expression {
4942
4957
  getRunnable(): IStatementRunnable;
4943
4958
  }
@@ -96,6 +96,8 @@ __exportStar(require("./interface_name"), exports);
96
96
  __exportStar(require("./language"), exports);
97
97
  __exportStar(require("./length"), exports);
98
98
  __exportStar(require("./let"), exports);
99
+ __exportStar(require("./loop_group_by_component"), exports);
100
+ __exportStar(require("./loop_group_by_target"), exports);
99
101
  __exportStar(require("./loop_group_by"), exports);
100
102
  __exportStar(require("./macro_name"), exports);
101
103
  __exportStar(require("./message_class"), exports);
@@ -166,6 +168,7 @@ __exportStar(require("./sql_cond"), exports);
166
168
  __exportStar(require("./sql_field_list_loop"), exports);
167
169
  __exportStar(require("./sql_field_list"), exports);
168
170
  __exportStar(require("./sql_field_name"), exports);
171
+ __exportStar(require("./sql_field"), exports);
169
172
  __exportStar(require("./sql_for_all_entries"), exports);
170
173
  __exportStar(require("./sql_from_source"), exports);
171
174
  __exportStar(require("./sql_from"), exports);
@@ -3,18 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoopGroupBy = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const tokens_1 = require("../../1_lexer/tokens");
6
- const component_name_1 = require("./component_name");
7
- const component_compare_1 = require("./component_compare");
8
- const target_1 = require("./target");
9
- const fstarget_1 = require("./fstarget");
10
6
  const source_1 = require("./source");
7
+ const loop_group_by_target_1 = require("./loop_group_by_target");
8
+ const loop_group_by_component_1 = require("./loop_group_by_component");
11
9
  class LoopGroupBy extends combi_1.Expression {
12
10
  getRunnable() {
13
- const into = (0, combi_1.seq)((0, combi_1.opt)("REFERENCE"), "INTO", target_1.Target);
14
- const assigning = (0, combi_1.seq)("ASSIGNING", fstarget_1.FSTarget);
15
- const groupSize = (0, combi_1.seq)(component_name_1.ComponentName, "=", "GROUP SIZE");
16
- const components = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.plus)((0, combi_1.alt)(component_compare_1.ComponentCompare, groupSize)), (0, combi_1.tok)(tokens_1.WParenRightW));
17
- const ret = (0, combi_1.seq)((0, combi_1.alt)(source_1.Source, components), (0, combi_1.optPrio)("ASCENDING"), (0, combi_1.optPrio)("WITHOUT MEMBERS"), (0, combi_1.optPrio)((0, combi_1.alt)(into, assigning)));
11
+ const components = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.plus)(loop_group_by_component_1.LoopGroupByComponent), (0, combi_1.tok)(tokens_1.WParenRightW));
12
+ const ret = (0, combi_1.seq)((0, combi_1.alt)(source_1.Source, components), (0, combi_1.optPrio)("ASCENDING"), (0, combi_1.optPrio)("WITHOUT MEMBERS"), loop_group_by_target_1.LoopGroupByTarget);
18
13
  return ret;
19
14
  }
20
15
  }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoopGroupByComponent = void 0;
4
+ const combi_1 = require("../combi");
5
+ const component_name_1 = require("./component_name");
6
+ const component_compare_simple_1 = require("./component_compare_simple");
7
+ class LoopGroupByComponent extends combi_1.Expression {
8
+ getRunnable() {
9
+ const groupSize = (0, combi_1.seq)(component_name_1.ComponentName, "=", "GROUP SIZE");
10
+ const components = (0, combi_1.alt)(component_compare_simple_1.ComponentCompareSimple, groupSize);
11
+ return components;
12
+ }
13
+ }
14
+ exports.LoopGroupByComponent = LoopGroupByComponent;
15
+ //# sourceMappingURL=loop_group_by_component.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoopGroupByTarget = void 0;
4
+ const combi_1 = require("../combi");
5
+ const target_1 = require("./target");
6
+ const fstarget_1 = require("./fstarget");
7
+ class LoopGroupByTarget extends combi_1.Expression {
8
+ getRunnable() {
9
+ const into = (0, combi_1.seq)((0, combi_1.opt)("REFERENCE"), "INTO", target_1.Target);
10
+ const assigning = (0, combi_1.seq)("ASSIGNING", fstarget_1.FSTarget);
11
+ return (0, combi_1.optPrio)((0, combi_1.alt)(into, assigning));
12
+ }
13
+ }
14
+ exports.LoopGroupByTarget = LoopGroupByTarget;
15
+ //# sourceMappingURL=loop_group_by_target.js.map
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLField = void 0;
4
+ const combi_1 = require("../combi");
5
+ const _1 = require(".");
6
+ const version_1 = require("../../../version");
7
+ const tokens_1 = require("../../1_lexer/tokens");
8
+ const sql_function_1 = require("./sql_function");
9
+ const simple_field_chain_1 = require("./simple_field_chain");
10
+ const sql_path_1 = require("./sql_path");
11
+ class SQLField extends combi_1.Expression {
12
+ getRunnable() {
13
+ const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), simple_field_chain_1.SimpleFieldChain));
14
+ const as = (0, combi_1.seq)("AS", _1.SQLAsName);
15
+ const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant);
16
+ const sub = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW))));
17
+ const arith = (0, combi_1.ver)(version_1.Version.v740sp05, sub);
18
+ return (0, combi_1.seq)(field, (0, combi_1.optPrio)(arith), (0, combi_1.optPrio)(as));
19
+ }
20
+ }
21
+ exports.SQLField = SQLField;
22
+ //# sourceMappingURL=sql_field.js.map
@@ -4,19 +4,10 @@ exports.SQLFieldList = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
- const tokens_1 = require("../../1_lexer/tokens");
8
- const sql_function_1 = require("./sql_function");
9
- const simple_field_chain_1 = require("./simple_field_chain");
10
- const sql_path_1 = require("./sql_path");
11
7
  class SQLFieldList extends combi_1.Expression {
12
8
  getRunnable() {
13
9
  const comma = (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v740sp05, ","));
14
- const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), simple_field_chain_1.SimpleFieldChain));
15
- const as = (0, combi_1.seq)("AS", _1.SQLAsName);
16
- const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant);
17
- const sub = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW))));
18
- const arith = (0, combi_1.ver)(version_1.Version.v740sp05, sub);
19
- return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.plusPrio)((0, combi_1.seq)(field, (0, combi_1.optPrio)(arith), (0, combi_1.optPrio)(as), comma)));
10
+ return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.plusPrio)((0, combi_1.seq)(_1.SQLField, comma)));
20
11
  }
21
12
  }
22
13
  exports.SQLFieldList = SQLFieldList;
@@ -4,14 +4,13 @@ exports.SQLFieldListLoop = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
- const sql_function_1 = require("./sql_function");
8
7
  const sql_path_1 = require("./sql_path");
9
8
  // loop must include one field from the database table
10
9
  class SQLFieldListLoop extends combi_1.Expression {
11
10
  getRunnable() {
12
11
  const comma = (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v740sp05, ","));
13
12
  const as = (0, combi_1.seq)("AS", _1.SQLAsName);
14
- const someField = (0, combi_1.seq)((0, combi_1.alt)(_1.SQLFieldName, sql_path_1.SQLPath, _1.SQLAggregation, sql_function_1.SQLFunction, _1.SQLCase), (0, combi_1.optPrio)(as), comma);
13
+ const someField = (0, combi_1.seq)(_1.SQLField, comma);
15
14
  const fieldList = (0, combi_1.seq)((0, combi_1.star)(someField), (0, combi_1.alt)(_1.SQLFieldName, sql_path_1.SQLPath), (0, combi_1.optPrio)(as), comma, (0, combi_1.star)(someField));
16
15
  const fields = (0, combi_1.alt)("*", _1.Dynamic, fieldList);
17
16
  return fields;
@@ -24,6 +24,7 @@ class BasicTypes {
24
24
  }
25
25
  lookupQualifiedName(name) {
26
26
  var _a;
27
+ // argh, todo, rewrite this entire method
27
28
  if (name === undefined) {
28
29
  return undefined;
29
30
  }
@@ -43,6 +44,21 @@ class BasicTypes {
43
44
  }
44
45
  }
45
46
  }
47
+ else if (name.includes("-")) {
48
+ const split = name.split("-");
49
+ const typeName = split[0];
50
+ const fieldName = split[1];
51
+ const type = this.scope.findType(typeName);
52
+ if (type) {
53
+ const stru = type.getType();
54
+ if (stru instanceof basic_1.StructureType) {
55
+ const f = stru.getComponentByName(fieldName);
56
+ if (f) {
57
+ return new _typed_identifier_1.TypedIdentifier(type.getToken(), type.getFilename(), f);
58
+ }
59
+ }
60
+ }
61
+ }
46
62
  const lookup = this.scope.getDDIC().lookupNoVoid(name);
47
63
  const id = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.object) === null || _a === void 0 ? void 0 : _a.getIdentifier();
48
64
  if (id && (lookup === null || lookup === void 0 ? void 0 : lookup.type)) {
@@ -193,7 +209,7 @@ class BasicTypes {
193
209
  }
194
210
  return undefined;
195
211
  }
196
- simpleType(node, noQualifiedName) {
212
+ simpleType(node, qualifiedNamePrefix) {
197
213
  let nameExpr = node.findFirstExpression(Expressions.NamespaceSimpleName);
198
214
  if (nameExpr === undefined) {
199
215
  nameExpr = node.findFirstExpression(Expressions.DefinitionName);
@@ -211,15 +227,15 @@ class BasicTypes {
211
227
  qualifiedName = name.getStr();
212
228
  }
213
229
  else {
214
- qualifiedName = name.getStr();
230
+ qualifiedName = (qualifiedNamePrefix || "") + name.getStr();
215
231
  if (this.scope.getType() === _scope_type_1.ScopeType.ClassDefinition
216
232
  || this.scope.getType() === _scope_type_1.ScopeType.Interface) {
217
233
  qualifiedName = this.scope.getName() + "=>" + qualifiedName;
218
234
  }
219
235
  }
220
236
  }
221
- if (noQualifiedName === true) {
222
- qualifiedName = undefined;
237
+ else if (qualifiedNamePrefix) {
238
+ qualifiedName = qualifiedNamePrefix + qualifiedName;
223
239
  }
224
240
  const found = this.parseType(node, qualifiedName);
225
241
  if (found) {
@@ -10,10 +10,8 @@ const target_1 = require("./target");
10
10
  class LoopGroupBy {
11
11
  runSyntax(node, scope, filename) {
12
12
  const components = [];
13
- for (const c of node.findDirectExpressions(Expressions.ComponentCompare)) {
14
- for (const f of c.findDirectExpressions(Expressions.ComponentChainSimple)) {
15
- components.push({ name: f.getFirstToken().getStr(), type: new basic_1.VoidType("todoGroupBy") });
16
- }
13
+ for (const c of node.findDirectExpressions(Expressions.LoopGroupByComponent)) {
14
+ components.push({ name: c.getFirstToken().getStr(), type: new basic_1.VoidType("todoGroupBy") });
17
15
  }
18
16
  if (components.length === 0) {
19
17
  return;
@@ -32,8 +30,10 @@ class LoopGroupBy {
32
30
  if (inlinefs) {
33
31
  new inline_fs_1.InlineFS().runSyntax(inlinefs, scope, filename, sourceType);
34
32
  }
35
- for (const t of node.findDirectExpressions(Expressions.ComponentCompare)) {
36
- new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
33
+ for (const c of node.findDirectExpressions(Expressions.LoopGroupByComponent)) {
34
+ for (const t of c.findDirectExpressions(Expressions.ComponentCompareSimple)) {
35
+ new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
36
+ }
37
37
  }
38
38
  }
39
39
  }
@@ -7,7 +7,7 @@ const Expressions = require("../../2_statements/expressions");
7
7
  const basic_1 = require("../../types/basic");
8
8
  const _scope_type_1 = require("../_scope_type");
9
9
  class TypeTable {
10
- runSyntax(node, scope, filename) {
10
+ runSyntax(node, scope, filename, qualifiedNamePrefix) {
11
11
  // todo, input is currently the statement, but should be the expression?
12
12
  let nameExpr = node.findFirstExpression(Expressions.DefinitionName);
13
13
  if (nameExpr === undefined) {
@@ -17,9 +17,9 @@ class TypeTable {
17
17
  return undefined;
18
18
  }
19
19
  const name = nameExpr.getFirstToken();
20
- let qualifiedName = "";
20
+ let qualifiedName = qualifiedNamePrefix || "";
21
21
  if (node.getFirstToken().getStr().toUpperCase() === "TYPES") {
22
- qualifiedName = name.getStr();
22
+ qualifiedName = qualifiedName + name.getStr();
23
23
  if (scope.getType() === _scope_type_1.ScopeType.ClassDefinition
24
24
  || scope.getType() === _scope_type_1.ScopeType.Interface) {
25
25
  qualifiedName = scope.getName() + "=>" + qualifiedName;
@@ -6,6 +6,7 @@ const source_1 = require("../expressions/source");
6
6
  const target_1 = require("../expressions/target");
7
7
  const basic_1 = require("../../types/basic");
8
8
  const fstarget_1 = require("../expressions/fstarget");
9
+ const inline_data_1 = require("../expressions/inline_data");
9
10
  class Append {
10
11
  runSyntax(node, scope, filename) {
11
12
  let targetType = undefined;
@@ -21,6 +22,14 @@ class Append {
21
22
  const rowType = targetType instanceof basic_1.TableType ? targetType.getRowType() : targetType;
22
23
  new fstarget_1.FSTarget().runSyntax(fsTarget, scope, filename, rowType);
23
24
  }
25
+ const dataTarget = node.findExpressionAfterToken("INTO");
26
+ if (dataTarget && node.concatTokens().toUpperCase().includes(" REFERENCE INTO DATA(")) {
27
+ if (!(targetType instanceof basic_1.TableType) && !(targetType instanceof basic_1.VoidType)) {
28
+ throw new Error("APPEND to non table type");
29
+ }
30
+ const rowType = targetType instanceof basic_1.TableType ? targetType.getRowType() : targetType;
31
+ new inline_data_1.InlineData().runSyntax(dataTarget, scope, filename, new basic_1.DataReference(rowType));
32
+ }
24
33
  let source = node.findDirectExpression(Expressions.Source);
25
34
  if (source === undefined) {
26
35
  source = node.findDirectExpression(Expressions.SimpleSource4);
@@ -7,12 +7,12 @@ const basic_1 = require("../../types/basic");
7
7
  const Expressions = require("../../2_statements/expressions");
8
8
  const type_table_1 = require("../expressions/type_table");
9
9
  class Type {
10
- runSyntax(node, scope, filename, noQualifiedName) {
10
+ runSyntax(node, scope, filename, qualifiedNamePrefix) {
11
11
  const tt = node.findFirstExpression(Expressions.TypeTable);
12
12
  if (tt) {
13
- return new type_table_1.TypeTable().runSyntax(node, scope, filename);
13
+ return new type_table_1.TypeTable().runSyntax(node, scope, filename, qualifiedNamePrefix);
14
14
  }
15
- const found = new basic_types_1.BasicTypes(filename, scope).simpleType(node, noQualifiedName);
15
+ const found = new basic_types_1.BasicTypes(filename, scope).simpleType(node, qualifiedNamePrefix);
16
16
  if (found) {
17
17
  return found;
18
18
  }
@@ -20,7 +20,7 @@ class Types {
20
20
  const ctyp = c.get();
21
21
  if (c instanceof nodes_1.StatementNode) {
22
22
  if (ctyp instanceof Statements.Type) {
23
- const found = new type_1.Type().runSyntax(c, scope, filename, true);
23
+ const found = new type_1.Type().runSyntax(c, scope, filename, name.getStr() + "-");
24
24
  if (found) {
25
25
  components.push({ name: found.getName(), type: found.getType() });
26
26
  }
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.91.23";
71
+ return "2.91.26";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -208,6 +208,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
208
208
  if (found) {
209
209
  return found;
210
210
  }
211
+ found = this.downportLoopGroup(high, lowFile, highSyntax, highFile);
212
+ if (found) {
213
+ return found;
214
+ }
211
215
  found = this.callFunctionParameterSimple(high, lowFile, highSyntax);
212
216
  if (found) {
213
217
  return found;
@@ -421,7 +425,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
421
425
  return undefined;
422
426
  }
423
427
  let fieldDefinition = "";
424
- const fields = fieldList.findDirectExpressions(Expressions.SQLFieldName);
428
+ const fields = fieldList.findAllExpressions(Expressions.SQLFieldName);
425
429
  const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "error";
426
430
  if (fields.length === 1) {
427
431
  fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;
@@ -477,7 +481,7 @@ ${indentation}`);
477
481
  return undefined;
478
482
  }
479
483
  let fieldDefinitions = "";
480
- for (const f of fieldList.findDirectExpressions(Expressions.SQLFieldName)) {
484
+ for (const f of fieldList.findAllExpressions(Expressions.SQLFieldName)) {
481
485
  let fieldName = f.concatTokens();
482
486
  if (fieldName.includes("~")) {
483
487
  const split = fieldName.split("~");
@@ -860,6 +864,67 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
860
864
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);
861
865
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, simple REF move", this.getMetadata().key, this.conf.severity, fix);
862
866
  }
867
+ downportLoopGroup(high, lowFile, highSyntax, highFile) {
868
+ var _a, _b, _c, _d, _e, _f, _g, _h;
869
+ if (!(high.get() instanceof Statements.Loop)) {
870
+ return undefined;
871
+ }
872
+ const group = high.findDirectExpression(Expressions.LoopGroupBy);
873
+ if (group === undefined) {
874
+ return undefined;
875
+ }
876
+ const groupTargetName = ((_a = group.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "nameNotFound";
877
+ const loopSourceName = ((_b = high.findFirstExpression(Expressions.SimpleSource2)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "nameNotFound";
878
+ const loopTargetName = ((_c = high.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "nameNotFound";
879
+ const groupTarget = ((_d = group.findDirectExpression(Expressions.LoopGroupByTarget)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || "";
880
+ let loopSourceRowType = "typeNotFound";
881
+ const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
882
+ if (spag !== undefined) {
883
+ const found = spag.findVariable(loopSourceName);
884
+ const tt = found === null || found === void 0 ? void 0 : found.getType();
885
+ if (tt instanceof basic_1.TableType) {
886
+ loopSourceRowType = tt.getRowType().getQualifiedName() || "typeNotFound";
887
+ }
888
+ }
889
+ let code = `TYPES: BEGIN OF ${groupTargetName}#type,\n`;
890
+ for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
891
+ const name = c.findFirstExpression(Expressions.ComponentName);
892
+ let type = ((_e = c.findFirstExpression(Expressions.Source)) === null || _e === void 0 ? void 0 : _e.concatTokens()) || "todo";
893
+ if ((_f = c.concatTokens()) === null || _f === void 0 ? void 0 : _f.toUpperCase().endsWith(" = GROUP SIZE")) {
894
+ type = "i";
895
+ }
896
+ else {
897
+ type = type.replace(loopTargetName, loopSourceRowType);
898
+ type = type.replace("->", "-");
899
+ }
900
+ code += ` ${name === null || name === void 0 ? void 0 : name.concatTokens()} TYPE ${type},\n`;
901
+ }
902
+ code += ` items LIKE ${loopSourceName},
903
+ END OF ${groupTargetName}#type.
904
+ DATA ${groupTargetName}#tab TYPE STANDARD TABLE OF ${groupTargetName}#type WITH DEFAULT KEY.
905
+ * todo, aggregation code here
906
+ LOOP AT ${groupTargetName}#tab ${groupTarget}.`;
907
+ let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
908
+ for (const l of ((_g = highFile.getStructure()) === null || _g === void 0 ? void 0 : _g.findAllStructures(Structures.Loop)) || []) {
909
+ // make sure to find the correct/current loop statement
910
+ if (l.findDirectStatement(Statements.Loop) !== high) {
911
+ continue;
912
+ }
913
+ for (const loop of l.findAllStatements(Statements.Loop)) {
914
+ if ((_h = loop.concatTokens()) === null || _h === void 0 ? void 0 : _h.toUpperCase().startsWith("LOOP AT GROUP ")) {
915
+ const subLoopSource = loop.findFirstExpression(Expressions.SimpleSource2);
916
+ if (subLoopSource === undefined) {
917
+ continue;
918
+ }
919
+ const subLoopSourceName = (subLoopSource === null || subLoopSource === void 0 ? void 0 : subLoopSource.concatTokens()) || "nameNotFound";
920
+ const subCode = `LOOP AT ${subLoopSourceName}->items`;
921
+ const subFix = edit_helper_1.EditHelper.replaceRange(lowFile, loop.getFirstToken().getStart(), subLoopSource.getLastToken().getEnd(), subCode);
922
+ fix = edit_helper_1.EditHelper.merge(subFix, fix);
923
+ }
924
+ }
925
+ }
926
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, LOOP GROUP", this.getMetadata().key, this.conf.severity, fix);
927
+ }
863
928
  downportRef(high, lowFile, highSyntax) {
864
929
  let found = undefined;
865
930
  for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {
@@ -60,8 +60,8 @@ If the target is a sorted/hashed table, no issue is reported`,
60
60
  continue;
61
61
  }
62
62
  // skip COUNT(*)
63
- const list = s.findFirstExpression(Expressions.SQLFieldList);
64
- if ((list === null || list === void 0 ? void 0 : list.getChildren().length) === 1 && ((_a = list.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {
63
+ const list = s.findAllExpressions(Expressions.SQLField);
64
+ if (list.length === 1 && ((_a = list[0].getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {
65
65
  continue;
66
66
  }
67
67
  else if (s.findFirstExpression(Expressions.SQLOrderBy)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.91.23",
3
+ "version": "2.91.26",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",