@abaplint/core 2.101.32 → 2.101.33

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.
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.32";
68
+ return "2.101.33";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -392,6 +392,10 @@ Make sure to test the downported code, it might not always be completely correct
392
392
  if (found) {
393
393
  return found;
394
394
  }
395
+ found = this.downportSelectExistence(low, high, lowFile, highSyntax);
396
+ if (found) {
397
+ return found;
398
+ }
395
399
  found = this.downportSQLExtras(low, high, lowFile, highSyntax);
396
400
  if (found) {
397
401
  return found;
@@ -521,6 +525,7 @@ Make sure to test the downported code, it might not always be completely correct
521
525
  return undefined;
522
526
  }
523
527
  //////////////////////////////////////////
528
+ /** removes @'s */
524
529
  downportSQLExtras(low, high, lowFile, highSyntax) {
525
530
  if (!(low.get() instanceof _statement_1.Unknown)) {
526
531
  return undefined;
@@ -593,6 +598,35 @@ Make sure to test the downported code, it might not always be completely correct
593
598
  }
594
599
  return undefined;
595
600
  }
601
+ downportSelectExistence(low, high, lowFile, highSyntax) {
602
+ var _a, _b, _c, _d;
603
+ if (!(low.get() instanceof _statement_1.Unknown)) {
604
+ return undefined;
605
+ }
606
+ else if (!(high.get() instanceof Statements.Select)) {
607
+ return undefined;
608
+ }
609
+ const fieldList = high.findFirstExpression(Expressions.SQLFieldList);
610
+ if ((fieldList === null || fieldList === void 0 ? void 0 : fieldList.concatTokens().toUpperCase()) !== "@ABAP_TRUE") {
611
+ return undefined;
612
+ }
613
+ const fieldName = (_b = (_a = high.findFirstExpression(Expressions.SQLCond)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
614
+ if (fieldName === undefined) {
615
+ return undefined;
616
+ }
617
+ const into = high.findFirstExpression(Expressions.SQLIntoStructure);
618
+ if (into === undefined) {
619
+ return undefined;
620
+ }
621
+ const intoName = (_d = (_c = into.findFirstExpression(Expressions.SQLTarget)) === null || _c === void 0 ? void 0 : _c.findFirstExpression(Expressions.Target)) === null || _d === void 0 ? void 0 : _d.concatTokens();
622
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
623
+ const fix1 = edit_helper_1.EditHelper.replaceRange(lowFile, fieldList.getFirstToken().getStart(), fieldList.getLastToken().getEnd(), fieldName);
624
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, into === null || into === void 0 ? void 0 : into.getFirstToken().getStart(), into === null || into === void 0 ? void 0 : into.getLastToken().getEnd(), `INTO @DATA(${uniqueName})`);
625
+ let fix = edit_helper_1.EditHelper.merge(fix2, fix1);
626
+ const fix3 = edit_helper_1.EditHelper.insertAt(lowFile, high.getLastToken().getEnd(), `\nCLEAR ${intoName}.\nIF sy-subrc = 0.\n ${intoName} = abap_true\nENDIF.`);
627
+ fix = edit_helper_1.EditHelper.merge(fix, fix3);
628
+ return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, refactor existence check", this.getMetadata().key, this.conf.severity, fix);
629
+ }
596
630
  downportSelectInline(low, high, lowFile, highSyntax) {
597
631
  if (!(low.get() instanceof _statement_1.Unknown)) {
598
632
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.101.32",
3
+ "version": "2.101.33",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,7 +53,7 @@
53
53
  "@microsoft/api-extractor": "^7.36.1",
54
54
  "@types/chai": "^4.3.5",
55
55
  "@types/mocha": "^10.0.1",
56
- "@types/node": "^20.4.0",
56
+ "@types/node": "^20.4.1",
57
57
  "chai": "^4.3.7",
58
58
  "eslint": "^8.44.0",
59
59
  "mocha": "^10.2.0",