@abaplint/transpiler-cli 2.10.30 → 2.10.32

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 -15
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -7858,7 +7858,7 @@ class StringTemplateFormatting extends combi_1.Expression {
7858
7858
  const alphaOptions = (0, combi_1.altPrio)("OUT", "RAW", "IN", _1.Source);
7859
7859
  const alignOptions = (0, combi_1.altPrio)("LEFT", "RIGHT", "CENTER", _1.Source, dynamic_1.Dynamic);
7860
7860
  const dateTimeOptions = (0, combi_1.altPrio)("RAW", "ISO", "USER", "ENVIRONMENT", _1.Source, dynamic_1.Dynamic);
7861
- const timeStampOptions = (0, combi_1.altPrio)("SPACE", "ISO", "USER", "ENVIRONMENT", _1.Source);
7861
+ const timeStampOptions = (0, combi_1.altPrio)("SPACE", "ISO", "USER", "ENVIRONMENT", _1.Source, dynamic_1.Dynamic);
7862
7862
  const numberOptions = (0, combi_1.altPrio)("RAW", "USER", "ENVIRONMENT", _1.Source, dynamic_1.Dynamic);
7863
7863
  const signOptions = (0, combi_1.altPrio)("LEFT", "LEFTPLUS", "LEFTSPACE", "RIGHT", "RIGHTPLUS", "RIGHTSPACE", _1.Source);
7864
7864
  const caseOptions = (0, combi_1.altPrio)("RAW", "UPPER", "LOWER", _1.Source, dynamic_1.Dynamic);
@@ -38726,6 +38726,7 @@ class MethodDefinition extends _identifier_1.Identifier {
38726
38726
  throw new Error("MethodDefinition, expected MethodDef as part of input node");
38727
38727
  }
38728
38728
  super(found.getFirstToken(), input.filename);
38729
+ this.className = input.scope.getName();
38729
38730
  this.redefinition = false;
38730
38731
  if (node.findDirectExpression(Expressions.Redefinition)) {
38731
38732
  this.redefinition = true;
@@ -38778,6 +38779,9 @@ class MethodDefinition extends _identifier_1.Identifier {
38778
38779
  getVisibility() {
38779
38780
  return this.visibility;
38780
38781
  }
38782
+ getClassName() {
38783
+ return this.className;
38784
+ }
38781
38785
  isRedefinition() {
38782
38786
  return this.redefinition;
38783
38787
  }
@@ -52768,7 +52772,7 @@ class Registry {
52768
52772
  }
52769
52773
  static abaplintVersion() {
52770
52774
  // magic, see build script "version.sh"
52771
- return "2.113.107";
52775
+ return "2.113.108";
52772
52776
  }
52773
52777
  getDDICReferences() {
52774
52778
  return this.ddicReferences;
@@ -78266,26 +78270,34 @@ class MethodCallTranspiler {
78266
78270
  }
78267
78271
  let name = nameToken.getStr().toLowerCase();
78268
78272
  if (traversal.isBuiltinMethod(nameToken)) {
78269
- name = "abap.builtin." + name + "(";
78270
- }
78271
- else {
78272
- name = name + "(";
78273
+ name = "abap.builtin." + name;
78273
78274
  }
78274
- const m = traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken));
78275
+ const scope = traversal.findCurrentScopeByToken(nameToken);
78276
+ // it might be aliased?
78277
+ const m = traversal.findMethodReference(nameToken, scope);
78275
78278
  if (m?.name && traversal.isBuiltinMethod(nameToken) === false) {
78276
- name = m.name.toLowerCase() + "(";
78279
+ name = m.name.toLowerCase();
78277
78280
  }
78281
+ name = traversal_1.Traversal.escapeNamespace(name.replace("~", "$"));
78278
78282
  if (feature_flags_1.FEATURE_FLAGS.private === true
78279
78283
  && m?.def.getVisibility() === core_1.Visibility.Private
78280
- && m?.def.isStatic() === false) {
78281
- name = "#" + name;
78284
+ && m.def.isStatic() === false) {
78285
+ const id = scope?.getParent()?.getParent()?.getIdentifier();
78286
+ if (id?.stype === core_1.ScopeType.ClassImplementation
78287
+ && m.def.getClassName().toUpperCase() === id.sname.toUpperCase()) {
78288
+ name = "#" + name;
78289
+ }
78290
+ else {
78291
+ name = `FRIENDS_ACCESS_INSTANCE["${name}"]`;
78292
+ }
78282
78293
  }
78294
+ name = name + "(";
78283
78295
  const step = node.findDirectExpression(core_1.Expressions.MethodCallParam);
78284
78296
  if (step === undefined) {
78285
78297
  throw new Error("MethodCallTranspiler, unexpected node");
78286
78298
  }
78287
78299
  const ret = new chunk_1.Chunk();
78288
- ret.append(traversal_1.Traversal.escapeNamespace(name.replace("~", "$")), nameToken, traversal);
78300
+ ret.append(name, nameToken, traversal);
78289
78301
  ret.appendChunk(new method_call_param_1.MethodCallParamTranspiler(m?.def).transpile(step, traversal));
78290
78302
  ret.appendString(")");
78291
78303
  return ret;
@@ -78582,16 +78594,14 @@ class MethodSourceTranspiler {
78582
78594
  else if (child.get() instanceof core_1.Expressions.Dynamic) {
78583
78595
  const second = child.getChildren()[1];
78584
78596
  const lookupException = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_METHOD'", child.getFirstToken(), true);
78585
- if (second.get() instanceof core_1.Expressions.FieldChain) {
78597
+ if (second.get() instanceof core_1.Expressions.FieldChain && second instanceof core_1.Nodes.ExpressionNode) {
78586
78598
  if (call.endsWith(".")) {
78587
78599
  call = call.substring(0, call.length - 1);
78588
78600
  }
78589
78601
  if (call === "") {
78590
78602
  call = "this";
78591
78603
  }
78592
- call += "[";
78593
- call += traversal.traverse(second).getCode();
78594
- call += ".get().toLowerCase().trimEnd()]";
78604
+ call = `abap.dynamicCallLookup(${call}, ${traversal.traverse(second).getCode()})`;
78595
78605
  }
78596
78606
  else if (second.get() instanceof core_1.Expressions.Constant) {
78597
78607
  if (call === "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.30",
3
+ "version": "2.10.32",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.113.107",
31
- "@abaplint/transpiler": "^2.10.30",
30
+ "@abaplint/core": "^2.113.108",
31
+ "@abaplint/transpiler": "^2.10.32",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^22.13.13",
34
34
  "@types/progress": "^2.0.7",