@abaplint/transpiler 2.6.24 → 2.6.26

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.
@@ -21,6 +21,7 @@ class ClassImplementationTranspiler {
21
21
  const scope = traversal.findCurrentScopeByToken(token);
22
22
  return new chunk_1.Chunk().append(ret + ` {
23
23
  static INTERNAL_TYPE = 'CLAS';
24
+ static INTERNAL_NAME = '${traversal.buildInternalName(token.getStr(), def)}';
24
25
  static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];
25
26
  static ATTRIBUTES = {${traversal.buildAttributes(def)}};`, node, traversal);
26
27
  }
@@ -23,6 +23,8 @@ class ClassDefinitionTranspiler {
23
23
  return new chunk_1.Chunk(`
24
24
  class ${className === null || className === void 0 ? void 0 : className.toLowerCase()} {
25
25
  static INTERNAL_TYPE = 'CLAS';
26
+ static IMPLEMENTED_INTERFACES = [];
27
+ static INTERNAL_NAME = 'ABSTRACT_CLASS_INTERNAL_NAME';
26
28
  static ATTRIBUTES = {};
27
29
  async constructor_() {
28
30
  this.me = new abap.types.ABAPObject();
@@ -45,6 +45,7 @@ export declare class Traversal {
45
45
  registerClassOrInterface(def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined): string;
46
46
  setValues(identifier: abaplint.TypedIdentifier, name: string): string;
47
47
  static setValues(identifier: abaplint.TypedIdentifier, name: string): string;
48
+ buildInternalName(name: string, def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined): string;
48
49
  lookupClassOrInterface(name: string | undefined, token: abaplint.Token | undefined, directGlobal?: boolean): string;
49
50
  private buildPrefix;
50
51
  protected traverseStructure(node: abaplint.Nodes.StructureNode): Chunk;
@@ -511,8 +511,21 @@ class Traversal {
511
511
  }
512
512
  return ret;
513
513
  }
514
- lookupClassOrInterface(name, token, directGlobal = false) {
514
+ buildInternalName(name, def) {
515
515
  var _a, _b;
516
+ if (def) {
517
+ if (def.isGlobal() === false) {
518
+ const prefix = this.buildPrefix();
519
+ return `${prefix}-${(_a = def === null || def === void 0 ? void 0 : def.getName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()}`;
520
+ }
521
+ else {
522
+ return (_b = def === null || def === void 0 ? void 0 : def.getName()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
523
+ }
524
+ }
525
+ // assume global
526
+ return name.toUpperCase();
527
+ }
528
+ lookupClassOrInterface(name, token, directGlobal = false) {
516
529
  if (name === undefined || token === undefined) {
517
530
  return "abap.Classes['undefined']";
518
531
  }
@@ -520,24 +533,12 @@ class Traversal {
520
533
  return "abap.Classes[" + name + ".trimEnd()]";
521
534
  }
522
535
  const scope = this.findCurrentScopeByToken(token);
523
- // todo, add explicit type,
524
536
  let def = scope === null || scope === void 0 ? void 0 : scope.findClassDefinition(name);
525
537
  if (def === undefined) {
526
538
  def = scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(name);
527
539
  }
528
- if (def) {
529
- if (def.isGlobal() === false) {
530
- const prefix = this.buildPrefix();
531
- return `abap.Classes['${prefix}-${(_a = def === null || def === void 0 ? void 0 : def.getName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()}']`;
532
- }
533
- else {
534
- return `abap.Classes['${(_b = def === null || def === void 0 ? void 0 : def.getName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()}']`;
535
- }
536
- }
537
- else {
538
- // assume global
539
- return "abap.Classes['" + name.toUpperCase() + "']";
540
- }
540
+ const internalName = this.buildInternalName(name, def);
541
+ return "abap.Classes['" + internalName + "']";
541
542
  }
542
543
  buildPrefix() {
543
544
  return this.obj.getType() + "-" + this.obj.getName();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.6.24",
3
+ "version": "2.6.26",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",