@abaplint/transpiler 1.7.1 → 1.7.2

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.
@@ -31,6 +31,7 @@ export declare class Traversal {
31
31
  isInterfaceAttribute(token: abaplint.Token): string | undefined;
32
32
  private findReadOrWriteReference;
33
33
  buildConstructorContents(scope: abaplint.ISpaghettiScopeNode | undefined, def: abaplint.IClassDefinition, inputName: string): string;
34
+ private dataFromInterfaces;
34
35
  determineType(node: abaplint.Nodes.ExpressionNode | abaplint.Nodes.StatementNode, scope: abaplint.ISpaghettiScopeNode | undefined): abaplint.AbstractType | undefined;
35
36
  registerClassOrInterface(def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined): string;
36
37
  lookupClassOrInterface(name: string | undefined, token: abaplint.Token | undefined): string;
@@ -258,30 +258,6 @@ class Traversal {
258
258
  // for now just pass the same input
259
259
  ret += `await super.constructor_(${inputName});\n`;
260
260
  }
261
- /*
262
- for (const n in vars) {
263
- const identifier = vars[n];
264
- if (identifier.getMeta().includes(abaplint.IdentifierMeta.Static) === true) {
265
- continue;
266
- }
267
- const name = n.toLowerCase().replace("~", "$");
268
- if (name === "super") {
269
- continue; // todo, https://github.com/abaplint/transpiler/issues/133
270
- }
271
-
272
- // todo, better handling of variables from interfaces, it should only initialize those that are directly implemented
273
- if (def.getAttributes().findByName(name) === undefined
274
- && name.includes("$") === false
275
- && name !== "me") {
276
- continue;
277
- }
278
-
279
- ret += "this." + name + " = " + new TranspileTypes().toType(identifier.getType()) + ";\n";
280
- if (name === "me") {
281
- ret += "this.me.set(this);\n";
282
- }
283
- }
284
- */
285
261
  ret += "this.me = new abap.types.ABAPObject();\n";
286
262
  ret += "this.me.set(this);\n";
287
263
  for (const a of def.getAttributes().getAll()) {
@@ -293,18 +269,7 @@ class Traversal {
293
269
  }
294
270
  // attributes from directly implemented interfaces(not interfaces implemented in super classes)
295
271
  for (const i of def.getImplementing()) {
296
- let intf = scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(i.name);
297
- if (intf === undefined) {
298
- const iglobal = this.reg.getObject("INTF", i.name);
299
- intf = iglobal === null || iglobal === void 0 ? void 0 : iglobal.getDefinition();
300
- }
301
- for (const a of (intf === null || intf === void 0 ? void 0 : intf.getAttributes().getAll()) || []) {
302
- if (a.getMeta().includes("static" /* Static */) === true) {
303
- continue;
304
- }
305
- const name = i.name.toLowerCase() + "$" + a.getName().toLowerCase();
306
- ret += "this." + name + " = " + new types_1.TranspileTypes().toType(a.getType()) + ";\n";
307
- }
272
+ ret += this.dataFromInterfaces(i.name, scope);
308
273
  }
309
274
  // handle aliases after initialization of carrier variables
310
275
  for (const a of def.getAliases().getAll()) {
@@ -316,6 +281,25 @@ class Traversal {
316
281
  }
317
282
  return ret;
318
283
  }
284
+ dataFromInterfaces(name, scope) {
285
+ let ret = "";
286
+ let intf = scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(name);
287
+ if (intf === undefined) {
288
+ const iglobal = this.reg.getObject("INTF", name);
289
+ intf = iglobal === null || iglobal === void 0 ? void 0 : iglobal.getDefinition();
290
+ }
291
+ for (const a of (intf === null || intf === void 0 ? void 0 : intf.getAttributes().getAll()) || []) {
292
+ if (a.getMeta().includes("static" /* Static */) === true) {
293
+ continue;
294
+ }
295
+ const n = name.toLowerCase() + "$" + a.getName().toLowerCase();
296
+ ret += "this." + n + " = " + new types_1.TranspileTypes().toType(a.getType()) + ";\n";
297
+ }
298
+ for (const i of (intf === null || intf === void 0 ? void 0 : intf.getImplementing()) || []) {
299
+ ret += this.dataFromInterfaces(i.name, scope);
300
+ }
301
+ return ret;
302
+ }
319
303
  determineType(node, scope) {
320
304
  var _a;
321
305
  if (scope === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",