@abaplint/transpiler-cli 2.5.15 → 2.5.16

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.
Files changed (2) hide show
  1. package/build/bundle.js +67 -8
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -46138,7 +46138,7 @@ class Registry {
46138
46138
  }
46139
46139
  static abaplintVersion() {
46140
46140
  // magic, see build script "version.sh"
46141
- return "2.95.29";
46141
+ return "2.95.30";
46142
46142
  }
46143
46143
  getDDICReferences() {
46144
46144
  return this.references;
@@ -51140,7 +51140,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51140
51140
  return undefined;
51141
51141
  }
51142
51142
  //////////////////////////////////////////
51143
- downportSQLExtras(low, high, lowFile, _highSyntax) {
51143
+ downportSQLExtras(low, high, lowFile, highSyntax) {
51144
51144
  if (!(low.get() instanceof _statement_1.Unknown)) {
51145
51145
  return undefined;
51146
51146
  }
@@ -51168,7 +51168,18 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51168
51168
  for (const c of candidates.reverse()) {
51169
51169
  if (c.getFirstToken() instanceof tokens_1.WAt
51170
51170
  || c.getFirstToken() instanceof tokens_1.At) {
51171
- addFix(c.getFirstToken());
51171
+ const tokens = c.getAllTokens();
51172
+ if (tokens[1] instanceof tokens_1.ParenLeftW && tokens[tokens.length - 1] instanceof tokens_1.WParenRightW) {
51173
+ const source = c.findDirectExpression(Expressions.Source);
51174
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
51175
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA(${uniqueName}) = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\n`);
51176
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), "@" + uniqueName);
51177
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
51178
+ return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, outline complex @", this.getMetadata().key, this.conf.severity, fix);
51179
+ }
51180
+ else {
51181
+ addFix(c.getFirstToken());
51182
+ }
51172
51183
  }
51173
51184
  }
51174
51185
  for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {
@@ -52925,7 +52936,7 @@ ${indentation} output = ${topTarget}.`;
52925
52936
  code += indent + " " + uniqueName + " = " + c.concatTokens() + ".\n";
52926
52937
  }
52927
52938
  else if (c.get() instanceof Expressions.Throw) {
52928
- code += indent + " " + c.concatTokens().replace("THROW", "RAISE EXCEPTION NEW") + ".\n";
52939
+ code += indent + " " + c.concatTokens().replace(/THROW /i, "RAISE EXCEPTION NEW ") + ".\n";
52929
52940
  }
52930
52941
  else {
52931
52942
  throw "buildCondBody, unexpected expression, " + c.get().constructor.name;
@@ -60963,8 +60974,10 @@ class PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {
60963
60974
  title: "Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE",
60964
60975
  shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,
60965
60976
  extendedInformation: `
60966
- https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type`,
60967
- tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
60977
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type
60978
+
60979
+ From 752 and up`,
60980
+ tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Upport],
60968
60981
  goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,
60969
60982
  badExample: `RAISE EXCEPTION TYPE cx_generation_error
60970
60983
  EXPORTING
@@ -71093,6 +71106,7 @@ exports.ClassDefinitionLoadTranspiler = ClassDefinitionLoadTranspiler;
71093
71106
 
71094
71107
  Object.defineProperty(exports, "__esModule", ({ value: true }));
71095
71108
  exports.ClassImplementationTranspiler = void 0;
71109
+ /* eslint-disable max-len */
71096
71110
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
71097
71111
  const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
71098
71112
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
@@ -71109,9 +71123,38 @@ class ClassImplementationTranspiler {
71109
71123
  else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {
71110
71124
  ret += " extends " + traversal_1.Traversal.escapeNamespace((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
71111
71125
  }
71126
+ const scope = traversal.findCurrentScopeByToken(token);
71112
71127
  return new chunk_1.Chunk().append(ret + ` {
71113
71128
  static INTERNAL_TYPE = 'CLAS';
71114
- static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `"` + e.name.toUpperCase() + `"`).join(",")}];`, node, traversal);
71129
+ static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];`, node, traversal);
71130
+ }
71131
+ findImplementedInterface(traversal, def, scope) {
71132
+ if (def === undefined || scope === undefined) {
71133
+ return [];
71134
+ }
71135
+ const list = def.getImplementing().map(i => i.name.toUpperCase());
71136
+ for (const i of def.getImplementing()) {
71137
+ const idef = traversal.findInterfaceDefinition(i.name, scope);
71138
+ list.push(...this.findImplementedInterface(traversal, idef, scope));
71139
+ }
71140
+ return list;
71141
+ }
71142
+ findImplementedClass(traversal, def, scope) {
71143
+ if (def === undefined || scope === undefined) {
71144
+ return [];
71145
+ }
71146
+ const list = def.getImplementing().map(i => i.name.toUpperCase());
71147
+ for (const i of def.getImplementing()) {
71148
+ const idef = traversal.findInterfaceDefinition(i.name, scope);
71149
+ list.push(...this.findImplementedInterface(traversal, idef, scope));
71150
+ }
71151
+ let sup = def.getSuperClass();
71152
+ while (sup !== undefined) {
71153
+ const sdef = traversal.findClassDefinition(sup, scope);
71154
+ list.push(...this.findImplementedClass(traversal, sdef, scope));
71155
+ sup = sdef === null || sdef === void 0 ? void 0 : sdef.getSuperClass();
71156
+ }
71157
+ return list;
71115
71158
  }
71116
71159
  }
71117
71160
  exports.ClassImplementationTranspiler = ClassImplementationTranspiler;
@@ -73355,6 +73398,23 @@ class MessageTranspiler {
73355
73398
  options.push("number: \"" + str.substr(1, 3) + "\"");
73356
73399
  options.push("type: \"" + str.substr(0, 1).toUpperCase() + "\"");
73357
73400
  }
73401
+ const like = messagesource.findExpressionAfterToken("LIKE");
73402
+ if (like) {
73403
+ options.push("displayLike: " + traversal.traverse(like).getCode());
73404
+ }
73405
+ }
73406
+ else {
73407
+ // exception based
73408
+ const exception = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
73409
+ options.push("exception: " + traversal.traverse(exception).getCode());
73410
+ const type = node.findExpressionAfterToken("TYPE");
73411
+ if (type) {
73412
+ options.push("type: " + traversal.traverse(type).getCode());
73413
+ }
73414
+ const like = node.findExpressionAfterToken("LIKE");
73415
+ if (like) {
73416
+ options.push("displayLike: " + traversal.traverse(like).getCode());
73417
+ }
73358
73418
  }
73359
73419
  const w = [];
73360
73420
  let withs = false;
@@ -76067,7 +76127,6 @@ class InterfaceTranspiler {
76067
76127
  name = traversal_1.Traversal.escapeNamespace(name);
76068
76128
  ret += `class ${name} {\n`;
76069
76129
  ret += `static INTERNAL_TYPE = 'INTF';\n`;
76070
- ret += `static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `"` + e.name.toUpperCase() + `"`).join(",")}];\n`;
76071
76130
  }
76072
76131
  else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
76073
76132
  ret += "}\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.15",
3
+ "version": "2.5.16",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,11 +25,11 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.15",
28
+ "@abaplint/transpiler": "^2.5.16",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@abaplint/core": "^2.95.29",
32
+ "@abaplint/core": "^2.95.30",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.75.0",
35
35
  "webpack-cli": "^5.0.1",