@abaplint/transpiler-cli 2.10.71 → 2.10.73

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 +35 -9
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -78790,17 +78790,23 @@ class FieldChainTranspiler {
78790
78790
  }
78791
78791
  }
78792
78792
  else if (c.get() instanceof core_1.Expressions.AttributeName) {
78793
- let pprefix = "";
78793
+ const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
78794
+ let name = c.getFirstToken().getStr().toLowerCase();
78794
78795
  if (context instanceof abaplint.BasicTypes.ObjectReferenceType) {
78795
78796
  const cdef = traversal.findClassDefinition(context.getIdentifierName(), scope);
78796
78797
  const attr = cdef?.getAttributes().findByName(c.getFirstToken().getStr());
78797
78798
  if (feature_flags_1.FEATURE_FLAGS.PRIVATE_ATTRIBUTES === true
78798
78799
  && attr?.getVisibility() === abaplint.Visibility.Private) {
78799
- pprefix = "#";
78800
+ const id = scope?.getParent()?.getParent()?.getIdentifier();
78801
+ if (id?.stype === abaplint.ScopeType.ClassImplementation
78802
+ && cdef?.getName().toUpperCase() === id.sname.toUpperCase()) {
78803
+ name = "#" + name;
78804
+ }
78805
+ else {
78806
+ name = `FRIENDS_ACCESS_INSTANCE["${name}"]`;
78807
+ }
78800
78808
  }
78801
78809
  }
78802
- const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
78803
- let name = pprefix + c.getFirstToken().getStr().toLowerCase();
78804
78810
  if (prefix && interfaceName && name.startsWith(interfaceName) === false && interfaceNameAdded === false) {
78805
78811
  name = traversal_1.Traversal.escapeNamespace(name).replace("~", "$");
78806
78812
  name = traversal_1.Traversal.escapeNamespace(interfaceName) + "$" + name;
@@ -80850,7 +80856,7 @@ exports.TargetTranspiler = TargetTranspiler;
80850
80856
  Object.defineProperty(exports, "__esModule", ({ value: true }));
80851
80857
  exports.FEATURE_FLAGS = void 0;
80852
80858
  exports.FEATURE_FLAGS = {
80853
- PRIVATE_ATTRIBUTES: false,
80859
+ PRIVATE_ATTRIBUTES: true,
80854
80860
  };
80855
80861
  //# sourceMappingURL=feature_flags.js.map
80856
80862
 
@@ -89768,6 +89774,9 @@ class Traversal {
89768
89774
  const name = "this." + escaped;
89769
89775
  ret += name + " = " + new transpile_types_1.TranspileTypes().toType(a.getType()) + ";\n";
89770
89776
  ret += this.setValues(a, name);
89777
+ if (escaped?.startsWith("#")) {
89778
+ ret += `this.FRIENDS_ACCESS_INSTANCE["${escaped.replace("#", "")}"] = ${name};\n`;
89779
+ }
89771
89780
  }
89772
89781
  }
89773
89782
  return ret;
@@ -89777,18 +89786,35 @@ class Traversal {
89777
89786
  if (hasSuperClass === true) {
89778
89787
  ret += `"SUPER": sup.FRIENDS_ACCESS_INSTANCE,\n`;
89779
89788
  }
89780
- for (const a of def.getMethodDefinitions()?.getAll() || []) {
89781
- const name = a.getName().toLowerCase();
89782
- if (name === "constructor" || a.isStatic() === true) {
89789
+ for (const method of def.getMethodDefinitions()?.getAll() || []) {
89790
+ const name = method.getName().toLowerCase();
89791
+ if (name === "constructor" || method.isStatic() === true) {
89783
89792
  continue;
89784
89793
  }
89785
89794
  let privateHash = "";
89786
- if (a.getVisibility() === abaplint.Visibility.Private) {
89795
+ if (method.getVisibility() === abaplint.Visibility.Private) {
89787
89796
  privateHash = "#";
89788
89797
  }
89789
89798
  const methodName = privateHash + Traversal.escapeNamespace(name.replace("~", "$"));
89799
+ // NOTE: currently all are needed in the unit test setup
89790
89800
  ret += `"${name.replace("~", "$")}": this.${methodName}.bind(this),\n`;
89791
89801
  }
89802
+ /*
89803
+ for (const attribute of def.getAttributes()?.getAll() || []) {
89804
+ if (attribute.getMeta().includes(abaplint.IdentifierMeta.Static) === true) {
89805
+ // hmm, is this correct?
89806
+ continue;
89807
+ }
89808
+ let privateHash = "";
89809
+ if (attribute.getVisibility() === abaplint.Visibility.Private) {
89810
+ privateHash = "#";
89811
+ } else {
89812
+ continue;
89813
+ }
89814
+ const attributeName = privateHash + Traversal.escapeNamespace(attribute.getName().toLowerCase());
89815
+ ret += `"${attribute.getName().toLowerCase()}": this.${attributeName},\n`;
89816
+ }
89817
+ */
89792
89818
  ret += "};\n";
89793
89819
  return ret;
89794
89820
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.71",
3
+ "version": "2.10.73",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
30
  "@abaplint/core": "^2.113.149",
31
- "@abaplint/transpiler": "^2.10.71",
31
+ "@abaplint/transpiler": "^2.10.73",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^22.16.5",
34
34
  "@types/progress": "^2.0.7",