@abaplint/transpiler-cli 2.5.46 → 2.5.47

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 +52 -15
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -46211,7 +46211,7 @@ class Registry {
46211
46211
  }
46212
46212
  static abaplintVersion() {
46213
46213
  // magic, see build script "version.sh"
46214
- return "2.95.44";
46214
+ return "2.95.47";
46215
46215
  }
46216
46216
  getDDICReferences() {
46217
46217
  return this.references;
@@ -50994,14 +50994,16 @@ Only one transformation is applied to a statement at a time, so multiple steps m
50994
50994
  // actively editing the files
50995
50995
  continue;
50996
50996
  }
50997
+ if (highSyntax === undefined) {
50998
+ highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
50999
+ }
51000
+ let containsUnknown = false;
50997
51001
  for (let i = 0; i < lowStatements.length; i++) {
50998
51002
  const low = lowStatements[i];
50999
51003
  const high = highStatements[i];
51000
51004
  if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))
51001
51005
  || high.findFirstExpression(Expressions.InlineData)) {
51002
- if (highSyntax === undefined) {
51003
- highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
51004
- }
51006
+ containsUnknown = true;
51005
51007
  try {
51006
51008
  const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);
51007
51009
  if (issue) {
@@ -51019,6 +51021,18 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51019
51021
  }
51020
51022
  }
51021
51023
  }
51024
+ if (ret.length === 0 && containsUnknown) {
51025
+ // this is a hack in order not to change too many unit tests
51026
+ for (let i = 0; i < lowStatements.length; i++) {
51027
+ const high = highStatements[i];
51028
+ if (high.get() instanceof Statements.Data) {
51029
+ const issue = this.anonymousTableType(high, lowFile, highSyntax);
51030
+ if (issue) {
51031
+ ret.push(issue);
51032
+ }
51033
+ }
51034
+ }
51035
+ }
51022
51036
  }
51023
51037
  return ret;
51024
51038
  }
@@ -51049,7 +51063,12 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51049
51063
  if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {
51050
51064
  return undefined;
51051
51065
  }
51052
- let found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
51066
+ // downport XSDBOOL() early, as it is valid 702 syntax
51067
+ let found = this.replaceXsdBool(high, lowFile, highSyntax);
51068
+ if (found) {
51069
+ return found;
51070
+ }
51071
+ found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
51053
51072
  if (found) {
51054
51073
  return found;
51055
51074
  }
@@ -51191,10 +51210,6 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51191
51210
  if (found) {
51192
51211
  return found;
51193
51212
  }
51194
- found = this.replaceXsdBool(high, lowFile, highSyntax);
51195
- if (found) {
51196
- return found;
51197
- }
51198
51213
  found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);
51199
51214
  if (found) {
51200
51215
  return found;
@@ -51432,6 +51447,22 @@ ${indentation}`);
51432
51447
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
51433
51448
  return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline SELECT @DATA", this.getMetadata().key, this.conf.severity, fix);
51434
51449
  }
51450
+ // the anonymous type minght be used in inferred type statements, define it so it can be referred
51451
+ anonymousTableType(high, lowFile, highSyntax) {
51452
+ if (!(high.get() instanceof Statements.Data)) {
51453
+ return undefined;
51454
+ }
51455
+ const tt = high.findFirstExpression(Expressions.TypeTable);
51456
+ if (tt === undefined) {
51457
+ return undefined;
51458
+ }
51459
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
51460
+ const code = `TYPES ${uniqueName} ${tt.concatTokens()}.\n`;
51461
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), code);
51462
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, tt.getFirstToken().getStart(), tt.getLastToken().getEnd(), "TYPE " + uniqueName);
51463
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
51464
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Add type for table definition", this.getMetadata().key, this.conf.severity, fix);
51465
+ }
51435
51466
  downportMessage(high, lowFile, highSyntax) {
51436
51467
  var _a, _b;
51437
51468
  if (!(high.get() instanceof Statements.Message)) {
@@ -52624,7 +52655,12 @@ ${indentation} output = ${topTarget}.`;
52624
52655
  const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
52625
52656
  const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
52626
52657
  if (s) {
52627
- body += indentation + `DATA(${name}) = ${s}.\n`;
52658
+ if (s.toUpperCase().startsWith("VALUE #")) {
52659
+ body += indentation + `DATA(${name}) = ${s.replace("#", type)}.\n`;
52660
+ }
52661
+ else {
52662
+ body += indentation + `DATA(${name}) = ${s}.\n`;
52663
+ }
52628
52664
  }
52629
52665
  else {
52630
52666
  body += indentation + `DATA ${name} TYPE ${t}.\n`;
@@ -52679,6 +52715,7 @@ ${indentation} output = ${topTarget}.`;
52679
52715
  if (firstToken.getStr().toUpperCase() !== "VALUE") {
52680
52716
  continue;
52681
52717
  }
52718
+ const valueBody = s.findDirectExpression(Expressions.ValueBody);
52682
52719
  let type = this.findType(s, lowFile, highSyntax);
52683
52720
  if (type === undefined) {
52684
52721
  if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {
@@ -52691,7 +52728,6 @@ ${indentation} output = ${topTarget}.`;
52691
52728
  else {
52692
52729
  type = "TYPE " + type;
52693
52730
  }
52694
- const valueBody = s.findDirectExpression(Expressions.ValueBody);
52695
52731
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
52696
52732
  let indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
52697
52733
  let body = "";
@@ -52704,6 +52740,11 @@ ${indentation} output = ${topTarget}.`;
52704
52740
  let added = false;
52705
52741
  let data = "";
52706
52742
  let previous = undefined;
52743
+ if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.ValueBodyLine)) !== undefined) {
52744
+ structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
52745
+ const extra = (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For)) ? " " : "";
52746
+ data = indentation + extra + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
52747
+ }
52707
52748
  for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
52708
52749
  if (a.get() instanceof Expressions.FieldAssignment) {
52709
52750
  if (added === false) {
@@ -52730,10 +52771,6 @@ ${indentation} output = ${topTarget}.`;
52730
52771
  if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {
52731
52772
  let skip = false;
52732
52773
  for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {
52733
- if (b.concatTokens() === "(" && added === false) {
52734
- structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
52735
- data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
52736
- }
52737
52774
  if (b.get() instanceof Expressions.FieldAssignment) {
52738
52775
  if (added === false) {
52739
52776
  body += data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.46",
3
+ "version": "2.5.47",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,12 +25,12 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.46",
28
+ "@abaplint/transpiler": "^2.5.47",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@types/node": "^18.15.3",
33
- "@abaplint/core": "^2.95.44",
32
+ "@types/node": "^18.15.5",
33
+ "@abaplint/core": "^2.95.47",
34
34
  "progress": "^2.0.3",
35
35
  "webpack": "^5.76.2",
36
36
  "webpack-cli": "^5.0.1",