@abaplint/core 2.91.17 → 2.91.18

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.91.17";
71
+ return "2.91.18";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -1342,7 +1342,7 @@ ${indentation} output = ${topTarget}.`;
1342
1342
  return undefined;
1343
1343
  }
1344
1344
  outlineValue(node, lowFile, highSyntax) {
1345
- var _a;
1345
+ var _a, _b, _c;
1346
1346
  const allSources = node.findAllExpressionsRecursive(Expressions.Source);
1347
1347
  for (const s of allSources) {
1348
1348
  const firstToken = s.getFirstToken();
@@ -1421,6 +1421,36 @@ ${indentation} output = ${topTarget}.`;
1421
1421
  }
1422
1422
  previous = b;
1423
1423
  }
1424
+ if (body === "" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === "OPTIONAL") {
1425
+ const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);
1426
+ const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1427
+ let tableExpression = undefined;
1428
+ let tabName = "";
1429
+ let after = "";
1430
+ for (const c of (fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()) || []) {
1431
+ if (c.get() instanceof Expressions.TableExpression && c instanceof nodes_1.ExpressionNode) {
1432
+ tableExpression = c;
1433
+ }
1434
+ else if (tableExpression === undefined) {
1435
+ tabName += c.concatTokens();
1436
+ }
1437
+ else {
1438
+ after += c.concatTokens();
1439
+ }
1440
+ }
1441
+ let condition = "";
1442
+ if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {
1443
+ condition = "INDEX " + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());
1444
+ }
1445
+ else {
1446
+ condition = "WITH KEY " + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace("[ ", "").replace(" ]", ""));
1447
+ }
1448
+ body +=
1449
+ indentation + `READ TABLE ${tabName} INTO DATA(${rowName}) ${condition}.\n` +
1450
+ indentation + `IF sy-subrc = 0.\n` +
1451
+ indentation + ` ${uniqueName} = ${rowName}${after}.\n` +
1452
+ indentation + `ENDIF.\n`;
1453
+ }
1424
1454
  if (end !== "") {
1425
1455
  indentation = indentation.substring(2);
1426
1456
  body += indentation + end;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.91.17",
3
+ "version": "2.91.18",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@microsoft/api-extractor": "^7.28.6",
49
49
  "@types/chai": "^4.3.1",
50
50
  "@types/mocha": "^9.1.1",
51
- "@types/node": "^18.6.1",
51
+ "@types/node": "^18.6.2",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.20.0",
54
54
  "mocha": "^10.0.0",