@abaplint/core 2.95.29 → 2.95.31

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.95.29";
66
+ return "2.95.31";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -465,7 +465,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
465
465
  return undefined;
466
466
  }
467
467
  //////////////////////////////////////////
468
- downportSQLExtras(low, high, lowFile, _highSyntax) {
468
+ downportSQLExtras(low, high, lowFile, highSyntax) {
469
469
  if (!(low.get() instanceof _statement_1.Unknown)) {
470
470
  return undefined;
471
471
  }
@@ -493,7 +493,18 @@ Only one transformation is applied to a statement at a time, so multiple steps m
493
493
  for (const c of candidates.reverse()) {
494
494
  if (c.getFirstToken() instanceof tokens_1.WAt
495
495
  || c.getFirstToken() instanceof tokens_1.At) {
496
- addFix(c.getFirstToken());
496
+ const tokens = c.getAllTokens();
497
+ if (tokens[1] instanceof tokens_1.ParenLeftW && tokens[tokens.length - 1] instanceof tokens_1.WParenRightW) {
498
+ const source = c.findDirectExpression(Expressions.Source);
499
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
500
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA(${uniqueName}) = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\n`);
501
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), "@" + uniqueName);
502
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
503
+ return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, outline complex @", this.getMetadata().key, this.conf.severity, fix);
504
+ }
505
+ else {
506
+ addFix(c.getFirstToken());
507
+ }
497
508
  }
498
509
  }
499
510
  for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {
@@ -2205,9 +2216,10 @@ ${indentation} output = ${topTarget}.`;
2205
2216
  }
2206
2217
  const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
2207
2218
  const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);
2219
+ const last = i.findDirectTokenByText(")");
2208
2220
  const abap = `DATA ${uniqueName} ${type}.\n` + bodyCode;
2209
2221
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
2210
- const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
2222
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), last.getEnd(), uniqueName);
2211
2223
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2212
2224
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport COND", this.getMetadata().key, this.conf.severity, fix);
2213
2225
  }
@@ -2250,7 +2262,7 @@ ${indentation} output = ${topTarget}.`;
2250
2262
  code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
2251
2263
  }
2252
2264
  else if (c.get() instanceof Expressions.Throw) {
2253
- code += indent + " " + c.concatTokens().replace("THROW", "RAISE EXCEPTION NEW") + ".\n";
2265
+ code += indent + " " + c.concatTokens().replace(/THROW /i, "RAISE EXCEPTION NEW ") + ".\n";
2254
2266
  }
2255
2267
  else {
2256
2268
  throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
@@ -21,8 +21,10 @@ class PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {
21
21
  title: "Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE",
22
22
  shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,
23
23
  extendedInformation: `
24
- https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type`,
25
- tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
24
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type
25
+
26
+ From 752 and up`,
27
+ tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Upport],
26
28
  goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,
27
29
  badExample: `RAISE EXCEPTION TYPE cx_generation_error
28
30
  EXPORTING
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.95.29",
3
+ "version": "2.95.31",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@microsoft/api-extractor": "^7.34.4",
51
51
  "@types/chai": "^4.3.4",
52
52
  "@types/mocha": "^10.0.1",
53
- "@types/node": "^18.14.5",
53
+ "@types/node": "^18.14.6",
54
54
  "chai": "^4.3.7",
55
55
  "eslint": "^8.35.0",
56
56
  "mocha": "^10.2.0",