@abaplint/core 2.91.17 → 2.91.20

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.20";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -924,14 +924,15 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
924
924
  }
925
925
  const enumName = (_b = high.findExpressionAfterToken("ENUM")) === null || _b === void 0 ? void 0 : _b.concatTokens();
926
926
  const structureName = (_c = high.findExpressionAfterToken("STRUCTURE")) === null || _c === void 0 ? void 0 : _c.concatTokens();
927
- let code = `TYPES ${enumName} TYPE i.
927
+ // all ENUMS are char like?
928
+ let code = `TYPES ${enumName} TYPE string.
928
929
  CONSTANTS: BEGIN OF ${structureName},\n`;
929
930
  let count = 1;
930
931
  for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {
931
932
  const name = (_d = e.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _d === void 0 ? void 0 : _d.concatTokens();
932
933
  let value = (_e = e.findFirstExpression(Expressions.Value)) === null || _e === void 0 ? void 0 : _e.concatTokens();
933
934
  if (value === undefined) {
934
- value = "VALUE " + count++;
935
+ value = "VALUE '" + count++ + "'";
935
936
  }
936
937
  code += ` ${name} TYPE ${enumName} ${value},\n`;
937
938
  }
@@ -1342,7 +1343,7 @@ ${indentation} output = ${topTarget}.`;
1342
1343
  return undefined;
1343
1344
  }
1344
1345
  outlineValue(node, lowFile, highSyntax) {
1345
- var _a;
1346
+ var _a, _b, _c;
1346
1347
  const allSources = node.findAllExpressionsRecursive(Expressions.Source);
1347
1348
  for (const s of allSources) {
1348
1349
  const firstToken = s.getFirstToken();
@@ -1421,6 +1422,36 @@ ${indentation} output = ${topTarget}.`;
1421
1422
  }
1422
1423
  previous = b;
1423
1424
  }
1425
+ if (body === "" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === "OPTIONAL") {
1426
+ const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);
1427
+ const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1428
+ let tableExpression = undefined;
1429
+ let tabName = "";
1430
+ let after = "";
1431
+ for (const c of (fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()) || []) {
1432
+ if (c.get() instanceof Expressions.TableExpression && c instanceof nodes_1.ExpressionNode) {
1433
+ tableExpression = c;
1434
+ }
1435
+ else if (tableExpression === undefined) {
1436
+ tabName += c.concatTokens();
1437
+ }
1438
+ else {
1439
+ after += c.concatTokens();
1440
+ }
1441
+ }
1442
+ let condition = "";
1443
+ if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {
1444
+ condition = "INDEX " + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());
1445
+ }
1446
+ else {
1447
+ condition = "WITH KEY " + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace("[ ", "").replace(" ]", ""));
1448
+ }
1449
+ body +=
1450
+ indentation + `READ TABLE ${tabName} INTO DATA(${rowName}) ${condition}.\n` +
1451
+ indentation + `IF sy-subrc = 0.\n` +
1452
+ indentation + ` ${uniqueName} = ${rowName}${after}.\n` +
1453
+ indentation + `ENDIF.\n`;
1454
+ }
1424
1455
  if (end !== "") {
1425
1456
  indentation = indentation.substring(2);
1426
1457
  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.20",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -45,12 +45,12 @@
45
45
  },
46
46
  "homepage": "https://abaplint.org",
47
47
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.28.6",
48
+ "@microsoft/api-extractor": "^7.28.7",
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.3",
52
52
  "chai": "^4.3.6",
53
- "eslint": "^8.20.0",
53
+ "eslint": "^8.21.0",
54
54
  "mocha": "^10.0.0",
55
55
  "c8": "^7.12.0",
56
56
  "source-map-support": "^0.5.21",