@abaplint/transpiler-cli 2.5.13 → 2.5.14

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 +37 -5
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -29930,7 +29930,9 @@ class Data {
29930
29930
  const found = new data_1.Data().runSyntax(c, scope, filename);
29931
29931
  if (found) {
29932
29932
  components.push({ name: found.getName(), type: found.getType() });
29933
- values[found.getName()] = found.getValue();
29933
+ if (found.getValue() !== undefined) {
29934
+ values[found.getName()] = found.getValue();
29935
+ }
29934
29936
  }
29935
29937
  }
29936
29938
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
@@ -29985,7 +29987,8 @@ class Data {
29985
29987
  return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));
29986
29988
  }
29987
29989
  else {
29988
- return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, values);
29990
+ const val = Object.keys(values).length > 0 ? values : undefined;
29991
+ return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, val);
29989
29992
  }
29990
29993
  }
29991
29994
  }
@@ -46135,7 +46138,7 @@ class Registry {
46135
46138
  }
46136
46139
  static abaplintVersion() {
46137
46140
  // magic, see build script "version.sh"
46138
- return "2.95.28";
46141
+ return "2.95.29";
46139
46142
  }
46140
46143
  getDDICReferences() {
46141
46144
  return this.references;
@@ -51078,6 +51081,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51078
51081
  if (found) {
51079
51082
  return found;
51080
51083
  }
51084
+ found = this.outlineGetReferenceSimple(high, lowFile);
51085
+ if (found) {
51086
+ return found;
51087
+ }
51081
51088
  found = this.outlineDataSimple(high, lowFile);
51082
51089
  if (found) {
51083
51090
  return found;
@@ -51499,6 +51506,28 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
51499
51506
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
51500
51507
  return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
51501
51508
  }
51509
+ outlineGetReferenceSimple(node, lowFile) {
51510
+ var _a, _b, _c;
51511
+ if (!(node.get() instanceof Statements.GetReference)) {
51512
+ return undefined;
51513
+ }
51514
+ const target = node.findFirstExpression(Expressions.Target);
51515
+ if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {
51516
+ return undefined;
51517
+ }
51518
+ const source = node.findFirstExpression(Expressions.Source);
51519
+ if (!(((_b = source === null || source === void 0 ? void 0 : source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {
51520
+ return undefined;
51521
+ }
51522
+ const targetName = ((_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "errorError";
51523
+ const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
51524
+ const firstToken = target.getFirstToken();
51525
+ const lastToken = target.getLastToken();
51526
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getStart(), `DATA ${targetName} LIKE REF TO ${source.concatTokens()}.\n${indentation}`);
51527
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), targetName);
51528
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
51529
+ return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
51530
+ }
51502
51531
  outlineDataSimple(node, lowFile) {
51503
51532
  // outlines "DATA(ls_msg) = temp1.", note that this does not need to look at types
51504
51533
  var _a, _b, _c;
@@ -67731,7 +67760,7 @@ class FieldChainTranspiler {
67731
67760
  constructor(addGet = false) {
67732
67761
  this.addGet = addGet;
67733
67762
  }
67734
- transpile(node, traversal, prefix = true, filename) {
67763
+ transpile(node, traversal, prefix = true, filename, wrongScope = false) {
67735
67764
  const ret = new chunk_1.Chunk();
67736
67765
  const extra = [];
67737
67766
  for (const c of node.getChildren()) {
@@ -67746,6 +67775,9 @@ class FieldChainTranspiler {
67746
67775
  else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.ClassName) {
67747
67776
  const name = traversal.lookupClassOrInterface(c.getFirstToken().getStr(), c.getFirstToken());
67748
67777
  ret.append(name + ".", c, traversal);
67778
+ if (wrongScope === true && traversal.reg.getObject("INTF", c.getFirstToken().getStr())) {
67779
+ ret.append(traversal_1.Traversal.escapeNamespace(c.getFirstToken().getStr().toLocaleLowerCase()) + "$", c, traversal);
67780
+ }
67749
67781
  }
67750
67782
  else if (c.get() instanceof core_1.Expressions.AttributeName) {
67751
67783
  const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
@@ -73463,7 +73495,7 @@ class MethodImplementationTranspiler {
73463
73495
  }
73464
73496
  else {
73465
73497
  // note: this can be difficult, the "def" might be from an interface, ie. a different scope than the method
73466
- val = new expressions_1.FieldChainTranspiler().transpile(parameterDefault, traversal, true, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename()).getCode();
73498
+ val = new expressions_1.FieldChainTranspiler().transpile(parameterDefault, traversal, true, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename(), true).getCode();
73467
73499
  if (val.startsWith(parameterDefault.getFirstToken().getStr().toLowerCase()) === true) {
73468
73500
  val = "this." + val;
73469
73501
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.13",
3
+ "version": "2.5.14",
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.13",
28
+ "@abaplint/transpiler": "^2.5.14",
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.28",
32
+ "@abaplint/core": "^2.95.29",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.75.0",
35
35
  "webpack-cli": "^5.0.1",