@abaplint/transpiler 2.5.15 → 2.5.17

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.
@@ -4,4 +4,6 @@ import { Traversal } from "../traversal";
4
4
  import { Chunk } from "../chunk";
5
5
  export declare class ClassImplementationTranspiler implements IStatementTranspiler {
6
6
  transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
7
+ private findImplementedInterface;
8
+ private findImplementedClass;
7
9
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClassImplementationTranspiler = void 0;
4
+ /* eslint-disable max-len */
4
5
  const abaplint = require("@abaplint/core");
5
6
  const traversal_1 = require("../traversal");
6
7
  const chunk_1 = require("../chunk");
@@ -17,9 +18,38 @@ class ClassImplementationTranspiler {
17
18
  else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {
18
19
  ret += " extends " + traversal_1.Traversal.escapeNamespace((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
19
20
  }
21
+ const scope = traversal.findCurrentScopeByToken(token);
20
22
  return new chunk_1.Chunk().append(ret + ` {
21
23
  static INTERNAL_TYPE = 'CLAS';
22
- static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `"` + e.name.toUpperCase() + `"`).join(",")}];`, node, traversal);
24
+ static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];`, node, traversal);
25
+ }
26
+ findImplementedInterface(traversal, def, scope) {
27
+ if (def === undefined || scope === undefined) {
28
+ return [];
29
+ }
30
+ const list = def.getImplementing().map(i => i.name.toUpperCase());
31
+ for (const i of def.getImplementing()) {
32
+ const idef = traversal.findInterfaceDefinition(i.name, scope);
33
+ list.push(...this.findImplementedInterface(traversal, idef, scope));
34
+ }
35
+ return list;
36
+ }
37
+ findImplementedClass(traversal, def, scope) {
38
+ if (def === undefined || scope === undefined) {
39
+ return [];
40
+ }
41
+ const list = def.getImplementing().map(i => i.name.toUpperCase());
42
+ for (const i of def.getImplementing()) {
43
+ const idef = traversal.findInterfaceDefinition(i.name, scope);
44
+ list.push(...this.findImplementedInterface(traversal, idef, scope));
45
+ }
46
+ let sup = def.getSuperClass();
47
+ while (sup !== undefined) {
48
+ const sdef = traversal.findClassDefinition(sup, scope);
49
+ list.push(...this.findImplementedClass(traversal, sdef, scope));
50
+ sup = sdef === null || sdef === void 0 ? void 0 : sdef.getSuperClass();
51
+ }
52
+ return list;
23
53
  }
24
54
  }
25
55
  exports.ClassImplementationTranspiler = ClassImplementationTranspiler;
@@ -34,6 +34,23 @@ class MessageTranspiler {
34
34
  options.push("number: \"" + str.substr(1, 3) + "\"");
35
35
  options.push("type: \"" + str.substr(0, 1).toUpperCase() + "\"");
36
36
  }
37
+ const like = messagesource.findExpressionAfterToken("LIKE");
38
+ if (like) {
39
+ options.push("displayLike: " + traversal.traverse(like).getCode());
40
+ }
41
+ }
42
+ else {
43
+ // exception based
44
+ const exception = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
45
+ options.push("exception: " + traversal.traverse(exception).getCode());
46
+ const type = node.findExpressionAfterToken("TYPE");
47
+ if (type) {
48
+ options.push("type: " + traversal.traverse(type).getCode());
49
+ }
50
+ const like = node.findExpressionAfterToken("LIKE");
51
+ if (like) {
52
+ options.push("displayLike: " + traversal.traverse(like).getCode());
53
+ }
37
54
  }
38
55
  const w = [];
39
56
  let withs = false;
@@ -18,7 +18,6 @@ class InterfaceTranspiler {
18
18
  name = traversal_1.Traversal.escapeNamespace(name);
19
19
  ret += `class ${name} {\n`;
20
20
  ret += `static INTERNAL_TYPE = 'INTF';\n`;
21
- ret += `static IMPLEMENTED_INTERFACES = [${def === null || def === void 0 ? void 0 : def.getImplementing().map(e => `"` + e.name.toUpperCase() + `"`).join(",")}];\n`;
22
21
  }
23
22
  else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
24
23
  ret += "}\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.5.15",
3
+ "version": "2.5.17",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@abaplint/core": "^2.95.29",
31
+ "@abaplint/core": "^2.95.31",
32
32
  "source-map": "^0.7.4"
33
33
  },
34
34
  "devDependencies": {