@abaplint/core 2.95.28 → 2.95.30

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.
@@ -22,7 +22,9 @@ class Data {
22
22
  const found = new data_1.Data().runSyntax(c, scope, filename);
23
23
  if (found) {
24
24
  components.push({ name: found.getName(), type: found.getType() });
25
- values[found.getName()] = found.getValue();
25
+ if (found.getValue() !== undefined) {
26
+ values[found.getName()] = found.getValue();
27
+ }
26
28
  }
27
29
  }
28
30
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
@@ -77,7 +79,8 @@ class Data {
77
79
  return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));
78
80
  }
79
81
  else {
80
- return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, values);
82
+ const val = Object.keys(values).length > 0 ? values : undefined;
83
+ return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, val);
81
84
  }
82
85
  }
83
86
  }
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.95.28";
66
+ return "2.95.30";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -406,6 +406,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
406
406
  if (found) {
407
407
  return found;
408
408
  }
409
+ found = this.outlineGetReferenceSimple(high, lowFile);
410
+ if (found) {
411
+ return found;
412
+ }
409
413
  found = this.outlineDataSimple(high, lowFile);
410
414
  if (found) {
411
415
  return found;
@@ -461,7 +465,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
461
465
  return undefined;
462
466
  }
463
467
  //////////////////////////////////////////
464
- downportSQLExtras(low, high, lowFile, _highSyntax) {
468
+ downportSQLExtras(low, high, lowFile, highSyntax) {
465
469
  if (!(low.get() instanceof _statement_1.Unknown)) {
466
470
  return undefined;
467
471
  }
@@ -489,7 +493,18 @@ Only one transformation is applied to a statement at a time, so multiple steps m
489
493
  for (const c of candidates.reverse()) {
490
494
  if (c.getFirstToken() instanceof tokens_1.WAt
491
495
  || c.getFirstToken() instanceof tokens_1.At) {
492
- 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
+ }
493
508
  }
494
509
  }
495
510
  for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {
@@ -827,6 +842,28 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
827
842
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
828
843
  return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
829
844
  }
845
+ outlineGetReferenceSimple(node, lowFile) {
846
+ var _a, _b, _c;
847
+ if (!(node.get() instanceof Statements.GetReference)) {
848
+ return undefined;
849
+ }
850
+ const target = node.findFirstExpression(Expressions.Target);
851
+ if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {
852
+ return undefined;
853
+ }
854
+ const source = node.findFirstExpression(Expressions.Source);
855
+ if (!(((_b = source === null || source === void 0 ? void 0 : source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {
856
+ return undefined;
857
+ }
858
+ const targetName = ((_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "errorError";
859
+ const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
860
+ const firstToken = target.getFirstToken();
861
+ const lastToken = target.getLastToken();
862
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getStart(), `DATA ${targetName} LIKE REF TO ${source.concatTokens()}.\n${indentation}`);
863
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), targetName);
864
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
865
+ return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
866
+ }
830
867
  outlineDataSimple(node, lowFile) {
831
868
  // outlines "DATA(ls_msg) = temp1.", note that this does not need to look at types
832
869
  var _a, _b, _c;
@@ -2224,7 +2261,7 @@ ${indentation} output = ${topTarget}.`;
2224
2261
  code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
2225
2262
  }
2226
2263
  else if (c.get() instanceof Expressions.Throw) {
2227
- code += indent + " " + c.concatTokens().replace("THROW", "RAISE EXCEPTION NEW") + ".\n";
2264
+ code += indent + " " + c.concatTokens().replace(/THROW /i, "RAISE EXCEPTION NEW ") + ".\n";
2228
2265
  }
2229
2266
  else {
2230
2267
  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.28",
3
+ "version": "2.95.30",
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",