@abaplint/transpiler-cli 2.10.70 → 2.10.72

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 +36 -8
  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;
@@ -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,37 @@ 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
  }
89798
+ else {
89799
+ continue;
89800
+ }
89789
89801
  const methodName = privateHash + Traversal.escapeNamespace(name.replace("~", "$"));
89790
89802
  ret += `"${name.replace("~", "$")}": this.${methodName}.bind(this),\n`;
89791
89803
  }
89804
+ /*
89805
+ for (const attribute of def.getAttributes()?.getAll() || []) {
89806
+ if (attribute.getMeta().includes(abaplint.IdentifierMeta.Static) === true) {
89807
+ // hmm, is this correct?
89808
+ continue;
89809
+ }
89810
+ let privateHash = "";
89811
+ if (attribute.getVisibility() === abaplint.Visibility.Private) {
89812
+ privateHash = "#";
89813
+ } else {
89814
+ continue;
89815
+ }
89816
+ const attributeName = privateHash + Traversal.escapeNamespace(attribute.getName().toLowerCase());
89817
+ ret += `"${attribute.getName().toLowerCase()}": this.${attributeName},\n`;
89818
+ }
89819
+ */
89792
89820
  ret += "};\n";
89793
89821
  return ret;
89794
89822
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.70",
3
+ "version": "2.10.72",
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.70",
31
+ "@abaplint/transpiler": "^2.10.72",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^22.16.5",
34
34
  "@types/progress": "^2.0.7",