@abaplint/core 2.93.26 → 2.93.28

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.
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.26";
66
+ return "2.93.28";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -258,13 +258,31 @@ Only one transformation is applied to a statement at a time, so multiple steps m
258
258
  if (found) {
259
259
  return found;
260
260
  }
261
- found = this.outlineValue(low, high, lowFile, highSyntax);
262
- if (found) {
263
- return found;
261
+ let skipValue = false;
262
+ let skipReduce = false;
263
+ const valueBody = high.findFirstExpression(Expressions.ValueBody);
264
+ const reduceBody = high.findFirstExpression(Expressions.ReduceBody);
265
+ if (valueBody && reduceBody) {
266
+ const valueToken = valueBody.getFirstToken();
267
+ const reduceToken = reduceBody.getFirstToken();
268
+ if (valueToken.getStart().isBefore(reduceToken.getStart())) {
269
+ skipReduce = true;
270
+ }
271
+ else {
272
+ skipValue = true;
273
+ }
264
274
  }
265
- found = this.outlineReduce(low, high, lowFile, highSyntax);
266
- if (found) {
267
- return found;
275
+ if (skipValue !== true) {
276
+ found = this.outlineValue(low, high, lowFile, highSyntax);
277
+ if (found) {
278
+ return found;
279
+ }
280
+ }
281
+ if (skipReduce !== true) {
282
+ found = this.outlineReduce(low, high, lowFile, highSyntax);
283
+ if (found) {
284
+ return found;
285
+ }
268
286
  }
269
287
  found = this.outlineSwitch(low, high, lowFile, highSyntax);
270
288
  if (found) {
@@ -918,8 +936,11 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
918
936
  let code = "";
919
937
  if (sourceRef.findFirstExpression(Expressions.TableExpression)) {
920
938
  const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
921
- code = `DATA(${uniqueName}) = ${sourceRef.concatTokens()}.
922
- GET REFERENCE OF ${uniqueName} INTO ${target.concatTokens()}`;
939
+ code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
940
+ IF sy-subrc <> 0.
941
+ RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
942
+ ENDIF.
943
+ GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
923
944
  }
924
945
  else {
925
946
  code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${target.concatTokens()}`;
@@ -1455,16 +1476,36 @@ ${indentation} output = ${topTarget}.`;
1455
1476
  if (gby !== "") {
1456
1477
  gby = " GROUP BY ( " + gby + " )";
1457
1478
  }
1479
+ const fc = forLoop.findDirectExpression(Expressions.FieldChain);
1480
+ if (fc) {
1481
+ gby = " GROUP BY " + fc.concatTokens();
1482
+ }
1483
+ if (forLoop.findDirectTokenByText("ASCENDING")) {
1484
+ gby += " ASCENDING";
1485
+ }
1486
+ if (forLoop.findDirectTokenByText("DESCENDING")) {
1487
+ gby += " DESCENDING";
1488
+ }
1458
1489
  const groups = forLoop.findExpressionAfterToken("GROUPS");
1459
1490
  if (groups) {
1460
- gby += " INTO DATA(" + groups.concatTokens() + ")";
1491
+ const concat = groups.concatTokens();
1492
+ if (concat.startsWith("<")) {
1493
+ gby += " ASSIGNING FIELD-SYMBOL(" + concat + ")";
1494
+ }
1495
+ else {
1496
+ gby += " INTO DATA(" + concat + ")";
1497
+ }
1461
1498
  }
1462
1499
  let inGroup = "";
1463
1500
  if (forLoop.concatTokens().toUpperCase().includes(" IN GROUP ")) {
1464
1501
  inGroup = "-items";
1465
1502
  }
1503
+ let into = "INTO DATA";
1504
+ if (loopTargetField.startsWith("<")) {
1505
+ into = "ASSIGNING FIELD-SYMBOL";
1506
+ }
1466
1507
  // todo, also backup sy-index / sy-tabix here?
1467
- body += indentation + `LOOP AT ${loopSource}${inGroup} INTO DATA(${loopTargetField})${from}${to}${cond}${gby}.\n`;
1508
+ body += indentation + `LOOP AT ${loopSource}${inGroup} ${into}(${loopTargetField})${from}${to}${cond}${gby}.\n`;
1468
1509
  if (indexInto) {
1469
1510
  body += indentation + " DATA(" + indexInto + ") = sy-tabix.\n";
1470
1511
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.26",
3
+ "version": "2.93.28",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",