@abaplint/core 2.86.4 → 2.86.5

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.
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.86.4";
71
+ return "2.86.5";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -894,15 +894,19 @@ ${indentation} output = ${topTarget}.`;
894
894
  return undefined;
895
895
  }
896
896
  outlineFor(forLoop, indentation, lowFile, highSyntax) {
897
- var _a, _b, _c, _d;
897
+ var _a, _b, _c, _d, _e;
898
898
  let body = "";
899
899
  let end = "";
900
900
  const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
901
901
  const loopTargetField = (_b = forLoop.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
902
+ let cond = ((_c = forLoop.findDirectExpression(Expressions.ComponentCond)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
903
+ if (cond !== "") {
904
+ cond = " WHERE " + cond;
905
+ }
902
906
  if (forLoop.findDirectTokenByText("UNTIL")
903
907
  || forLoop.findDirectTokenByText("WHILE")) {
904
908
  const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);
905
- const field = (_c = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _c === void 0 ? void 0 : _c.concatTokens();
909
+ const field = (_d = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _d === void 0 ? void 0 : _d.concatTokens();
906
910
  body += indentation + "DATA " + field + " TYPE i.\n";
907
911
  const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];
908
912
  if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {
@@ -915,12 +919,12 @@ ${indentation} output = ${topTarget}.`;
915
919
  end += indentation + "ENDWHILE";
916
920
  }
917
921
  else if (loopTargetField) {
918
- body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField}).\n`;
922
+ body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${cond}.\n`;
919
923
  end = "ENDLOOP";
920
924
  }
921
925
  else if (loopTargetField === undefined) {
922
- const loopTargetFieldSymbol = (_d = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _d === void 0 ? void 0 : _d.concatTokens();
923
- body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\n`;
926
+ const loopTargetFieldSymbol = (_e = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens();
927
+ body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\n`;
924
928
  end = "ENDLOOP";
925
929
  }
926
930
  const l = forLoop.findDirectExpression(Expressions.Let);
@@ -1023,12 +1027,12 @@ ${indentation} output = ${topTarget}.`;
1023
1027
  name = init.getFirstToken().getStr();
1024
1028
  body += indentation + `DATA(${name}) = ${(_a = reduceBody.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()}.\n`;
1025
1029
  }
1026
- const forLoop = reduceBody.findDirectExpression(Expressions.For);
1027
- if (forLoop === undefined) {
1028
- continue;
1030
+ let end = "";
1031
+ for (const forLoop of (reduceBody === null || reduceBody === void 0 ? void 0 : reduceBody.findDirectExpressions(Expressions.For)) || []) {
1032
+ const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);
1033
+ body += outlineFor.body;
1034
+ end = outlineFor.end + `.\n` + end;
1029
1035
  }
1030
- const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);
1031
- body += outlineFor.body;
1032
1036
  const next = reduceBody.findDirectExpression(Expressions.ReduceNext);
1033
1037
  if (next === undefined) {
1034
1038
  continue;
@@ -1048,7 +1052,7 @@ ${indentation} output = ${topTarget}.`;
1048
1052
  body += concat;
1049
1053
  }
1050
1054
  }
1051
- body += indentation + outlineFor.end + `.\n`;
1055
+ body += indentation + end;
1052
1056
  body += indentation + `${uniqueName} = ${name}.\n`;
1053
1057
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1054
1058
  body +
@@ -1348,6 +1352,10 @@ ${indentation} output = ${topTarget}.`;
1348
1352
  if (i.getFirstToken().getStr().toUpperCase() !== "CONV") {
1349
1353
  continue;
1350
1354
  }
1355
+ const end = i.findDirectTokenByText(")");
1356
+ if (end === undefined) {
1357
+ continue;
1358
+ }
1351
1359
  const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();
1352
1360
  if (body === undefined) {
1353
1361
  continue;
@@ -1359,7 +1367,7 @@ ${indentation} output = ${topTarget}.`;
1359
1367
  indent + `${uniqueName} = ${body}.\n` +
1360
1368
  indent;
1361
1369
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
1362
- const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
1370
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);
1363
1371
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1364
1372
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CONV", this.getMetadata().key, this.conf.severity, fix);
1365
1373
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.86.4",
3
+ "version": "2.86.5",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",