@abaplint/transpiler-cli 2.6.30 → 2.6.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.
Files changed (2) hide show
  1. package/build/bundle.js +19 -11
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -72010,8 +72010,8 @@ class ClassImplementationTranspiler {
72010
72010
  return new chunk_1.Chunk().append(ret + ` {
72011
72011
  static INTERNAL_TYPE = 'CLAS';
72012
72012
  static INTERNAL_NAME = '${traversal.buildInternalName(token.getStr(), def)}';
72013
- static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];
72014
- static ATTRIBUTES = {${traversal.buildAttributes(def)}};`, node, traversal);
72013
+ static IMPLEMENTED_INTERFACES = [${this.findImplementedByClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];
72014
+ static ATTRIBUTES = {${traversal.buildAttributes(def, scope).join(",\n")}};`, node, traversal);
72015
72015
  }
72016
72016
  findImplementedInterface(traversal, def, scope) {
72017
72017
  if (def === undefined || scope === undefined) {
@@ -72024,7 +72024,7 @@ static ATTRIBUTES = {${traversal.buildAttributes(def)}};`, node, traversal);
72024
72024
  }
72025
72025
  return list;
72026
72026
  }
72027
- findImplementedClass(traversal, def, scope) {
72027
+ findImplementedByClass(traversal, def, scope) {
72028
72028
  if (def === undefined || scope === undefined) {
72029
72029
  return [];
72030
72030
  }
@@ -72036,7 +72036,7 @@ static ATTRIBUTES = {${traversal.buildAttributes(def)}};`, node, traversal);
72036
72036
  let sup = def.getSuperClass();
72037
72037
  while (sup !== undefined) {
72038
72038
  const sdef = traversal.findClassDefinition(sup, scope);
72039
- list.push(...this.findImplementedClass(traversal, sdef, scope));
72039
+ list.push(...this.findImplementedByClass(traversal, sdef, scope));
72040
72040
  sup = sdef === null || sdef === void 0 ? void 0 : sdef.getSuperClass();
72041
72041
  }
72042
72042
  return list;
@@ -77138,11 +77138,12 @@ class InterfaceTranspiler {
77138
77138
  const def = traversal.getInterfaceDefinition(node.getFirstToken());
77139
77139
  for (const c of node.getChildren()) {
77140
77140
  if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.Interface) {
77141
+ const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
77141
77142
  name = (_a = c.findDirectExpression(abaplint.Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toLowerCase();
77142
77143
  name = traversal_1.Traversal.escapeNamespace(name);
77143
77144
  ret += `class ${name} {\n`;
77144
77145
  ret += `static INTERNAL_TYPE = 'INTF';\n`;
77145
- ret += `static ATTRIBUTES = {${traversal.buildAttributes(def)}};\n`;
77146
+ ret += `static ATTRIBUTES = {${traversal.buildAttributes(def, scope).join(",\n")}};\n`;
77146
77147
  }
77147
77148
  else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
77148
77149
  ret += "}\n";
@@ -77886,10 +77887,13 @@ class Traversal {
77886
77887
  }
77887
77888
  return undefined;
77888
77889
  }
77889
- buildAttributes(def) {
77890
+ buildAttributes(def, scope, prefix = "") {
77890
77891
  var _a, _b;
77891
77892
  const attr = [];
77892
- for (const a of ((_a = def === null || def === void 0 ? void 0 : def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
77893
+ if (def === undefined) {
77894
+ return attr;
77895
+ }
77896
+ for (const a of ((_a = def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
77893
77897
  const type = new transpile_types_1.TranspileTypes().toType(a.getType());
77894
77898
  let runtime = "";
77895
77899
  switch (a.getVisibility()) {
@@ -77902,9 +77906,9 @@ class Traversal {
77902
77906
  default:
77903
77907
  runtime = "U";
77904
77908
  }
77905
- attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " "}`);
77909
+ attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " "}`);
77906
77910
  }
77907
- for (const a of ((_b = def === null || def === void 0 ? void 0 : def.getAttributes()) === null || _b === void 0 ? void 0 : _b.getConstants()) || []) {
77911
+ for (const a of ((_b = def.getAttributes()) === null || _b === void 0 ? void 0 : _b.getConstants()) || []) {
77908
77912
  const type = new transpile_types_1.TranspileTypes().toType(a.getType());
77909
77913
  let runtime = "";
77910
77914
  switch (a.getVisibility()) {
@@ -77917,9 +77921,13 @@ class Traversal {
77917
77921
  default:
77918
77922
  runtime = "U";
77919
77923
  }
77920
- attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X"}`);
77924
+ attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X"}`);
77925
+ }
77926
+ for (const impl of def.getImplementing()) {
77927
+ const idef = this.findInterfaceDefinition(impl.name, scope);
77928
+ attr.push(...this.buildAttributes(idef, scope, impl.name.toUpperCase() + "~"));
77921
77929
  }
77922
- return attr.join(",\n");
77930
+ return attr;
77923
77931
  }
77924
77932
  isBuiltinMethod(token) {
77925
77933
  const scope = this.findCurrentScopeByToken(token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.30",
3
+ "version": "2.6.31",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,7 +25,7 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.6.30",
28
+ "@abaplint/transpiler": "^2.6.31",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",