@abaplint/transpiler-cli 2.5.27 → 2.5.29

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 +25 -21
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -21639,6 +21639,7 @@ const structure_type_1 = __webpack_require__(/*! ../../types/basic/structure_typ
21639
21639
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
21640
21640
  const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
21641
21641
  const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
21642
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
21642
21643
  class ComponentChain {
21643
21644
  runSyntax(context, node, scope, filename) {
21644
21645
  const children = node.getChildren();
@@ -21684,22 +21685,22 @@ class ComponentChain {
21684
21685
  }
21685
21686
  else if (context instanceof basic_1.ObjectReferenceType) {
21686
21687
  const id = context.getIdentifier();
21687
- if (id instanceof types_1.InterfaceDefinition || id instanceof types_1.ClassDefinition) {
21688
- const found = id.getAttributes().findByName(name);
21689
- context = found === null || found === void 0 ? void 0 : found.getType();
21690
- if (context === undefined) {
21691
- throw new Error("Attribute \"" + name + "\" not found");
21692
- }
21693
- else {
21694
- const extra = {
21695
- ooName: id.getName(),
21696
- ooType: id instanceof types_1.ClassDefinition ? "CLAS" : "INTF"
21697
- };
21698
- scope.addReference(child.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, filename, extra);
21699
- }
21688
+ const def = scope.findObjectDefinition(id.getName());
21689
+ if (def === undefined) {
21690
+ throw new Error(id.getName() + " not found in scope");
21691
+ }
21692
+ const helper = new _object_oriented_1.ObjectOriented(scope);
21693
+ const found = helper.searchAttributeName(def, name);
21694
+ context = found === null || found === void 0 ? void 0 : found.getType();
21695
+ if (context === undefined) {
21696
+ throw new Error("Attribute \"" + name + "\" not found");
21700
21697
  }
21701
21698
  else {
21702
- throw new Error("ComponentChain, unexpected type2");
21699
+ const extra = {
21700
+ ooName: id.getName(),
21701
+ ooType: id instanceof types_1.ClassDefinition ? "CLAS" : "INTF"
21702
+ };
21703
+ scope.addReference(child.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, filename, extra);
21703
21704
  }
21704
21705
  }
21705
21706
  else {
@@ -46209,7 +46210,7 @@ class Registry {
46209
46210
  }
46210
46211
  static abaplintVersion() {
46211
46212
  // magic, see build script "version.sh"
46212
- return "2.95.36";
46213
+ return "2.95.38";
46213
46214
  }
46214
46215
  getDDICReferences() {
46215
46216
  return this.references;
@@ -75891,7 +75892,7 @@ class ClassImplementationTranspiler {
75891
75892
  return false;
75892
75893
  }
75893
75894
  /** Finds static attributes + constants including those from interfaces (from superclass is ingored) */
75894
- findStaticAttributes(cdef, scope) {
75895
+ findStaticAttributes(cdef, scope, traversal) {
75895
75896
  const ret = [];
75896
75897
  ret.push(...cdef.getAttributes().getStatic().map(a => { return { identifier: a, prefix: "" }; }));
75897
75898
  ret.push(...cdef.getAttributes().getConstants().map(a => { return { identifier: a, prefix: "" }; }));
@@ -75901,14 +75902,17 @@ class ClassImplementationTranspiler {
75901
75902
  if (i === undefined) {
75902
75903
  break;
75903
75904
  }
75904
- const intf = scope.findInterfaceDefinition(i.name);
75905
+ const intf = traversal.findInterfaceDefinition(i.name, scope);
75905
75906
  if (intf === undefined) {
75906
75907
  continue;
75907
75908
  }
75908
- // todo, constants from interface?
75909
75909
  implementing.push(...intf.getImplementing());
75910
- ret.push(...intf.getAttributes().getStatic().map(a => { return { identifier: a, prefix: intf.getName().toLowerCase() + "$" }; }));
75911
- ret.push(...intf.getAttributes().getConstants().map(a => { return { identifier: a, prefix: intf.getName().toLowerCase() + "$" }; }));
75910
+ ret.push(...intf.getAttributes().getStatic().map(a => {
75911
+ return { identifier: a, prefix: intf.getName().toLowerCase() + "$" };
75912
+ }));
75913
+ ret.push(...intf.getAttributes().getConstants().map(a => {
75914
+ return { identifier: a, prefix: intf.getName().toLowerCase() + "$" };
75915
+ }));
75912
75916
  }
75913
75917
  return ret;
75914
75918
  }
@@ -75942,7 +75946,7 @@ class ClassImplementationTranspiler {
75942
75946
  }
75943
75947
  let ret = "";
75944
75948
  const clasName = node.getFirstToken().getStr().toLowerCase();
75945
- const staticAttributes = this.findStaticAttributes(cdef, scope);
75949
+ const staticAttributes = this.findStaticAttributes(cdef, scope, traversal);
75946
75950
  for (const attr of staticAttributes) {
75947
75951
  const name = traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(attr.prefix) + traversal_1.Traversal.escapeNamespace(attr.identifier.getName().toLowerCase());
75948
75952
  ret += name + " = " + new transpile_types_1.TranspileTypes().toType(attr.identifier.getType()) + ";\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.27",
3
+ "version": "2.5.29",
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.27",
28
+ "@abaplint/transpiler": "^2.5.29",
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.36",
32
+ "@abaplint/core": "^2.95.38",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.76.0",
35
35
  "webpack-cli": "^5.0.1",