@abaplint/transpiler-cli 2.7.13 → 2.7.15

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 +87 -42
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -42089,7 +42089,14 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
42089
42089
  }
42090
42090
  findFieldNames(tree) {
42091
42091
  var _a, _b;
42092
- for (const e of tree.findAllExpressions(expressions_1.CDSElement)) {
42092
+ let expr = tree.findFirstExpression(expressions_1.CDSSelect);
42093
+ if (expr === undefined) {
42094
+ expr = tree.findFirstExpression(expressions_1.CDSAnnotate);
42095
+ }
42096
+ if (expr === undefined) {
42097
+ expr = tree.findFirstExpression(expressions_1.CDSDefineProjection);
42098
+ }
42099
+ for (const e of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressions(expressions_1.CDSElement)) || []) {
42093
42100
  let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
42094
42101
  if (found === undefined) {
42095
42102
  const list = e.findDirectExpressions(expressions_1.CDSName);
@@ -47086,7 +47093,7 @@ class Registry {
47086
47093
  }
47087
47094
  static abaplintVersion() {
47088
47095
  // magic, see build script "version.sh"
47089
- return "2.101.6";
47096
+ return "2.101.7";
47090
47097
  }
47091
47098
  getDDICReferences() {
47092
47099
  return this.ddicReferences;
@@ -51819,7 +51826,9 @@ Current rules:
51819
51826
  * ENUMs, but does not nessesarily give the correct type and value
51820
51827
  * MESSAGE with non simple source
51821
51828
 
51822
- Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,
51829
+ Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.
51830
+
51831
+ Make sure to test the downported code, it might not always be completely correct.`,
51823
51832
  tags: [_irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
51824
51833
  };
51825
51834
  }
@@ -69569,20 +69578,45 @@ exports.ConstantTranspiler = ConstantTranspiler;
69569
69578
 
69570
69579
  Object.defineProperty(exports, "__esModule", ({ value: true }));
69571
69580
  exports.DatabaseTableTranspiler = void 0;
69572
- const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
69581
+ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
69573
69582
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
69574
69583
  class DatabaseTableTranspiler {
69584
+ constructor(prefix = true) {
69585
+ this.prefix = prefix;
69586
+ }
69575
69587
  transpile(node, traversal) {
69576
- const ret = new chunk_1.Chunk();
69577
- const dyn = node.findDirectExpression(core_1.Expressions.Dynamic);
69588
+ const chunk = new chunk_1.Chunk();
69589
+ const concat = node.concatTokens();
69590
+ let val = "";
69591
+ if (this.prefix === true) {
69592
+ val = `" + abap.dbo.schemaPrefix + "\\"" + abap.dbo.tablePrefix + "`;
69593
+ }
69594
+ else {
69595
+ val = "\"";
69596
+ }
69597
+ const dyn = node.findDirectExpression(abaplint.Expressions.Dynamic);
69578
69598
  if (dyn) {
69579
- const sub = dyn.getChildren()[1];
69580
- return traversal.traverse(sub);
69599
+ if (concat.startsWith("('")) {
69600
+ val += concat.substring(2, concat.length - 2).toLowerCase();
69601
+ }
69602
+ else {
69603
+ const foo = traversal.traverse(dyn.findDirectExpression(abaplint.Expressions.FieldChain));
69604
+ if (this.prefix === false) {
69605
+ return foo;
69606
+ }
69607
+ val += "\" + " + foo.getCode() + ".get() + \"";
69608
+ }
69581
69609
  }
69582
69610
  else {
69583
- ret.appendString('"' + node.concatTokens() + '"');
69611
+ val += concat.toLowerCase();
69584
69612
  }
69585
- return ret;
69613
+ if (this.prefix === true) {
69614
+ val += "\\\"";
69615
+ }
69616
+ else {
69617
+ val += "\"";
69618
+ }
69619
+ return chunk.appendString(val);
69586
69620
  }
69587
69621
  }
69588
69622
  exports.DatabaseTableTranspiler = DatabaseTableTranspiler;
@@ -70047,9 +70081,14 @@ class MethodCallBodyTranspiler {
70047
70081
  let pt = false;
70048
70082
  for (const c of node.getChildren()) {
70049
70083
  if (c instanceof core_1.Nodes.TokenNode) {
70050
- // PARAMETER-TABLE
70051
- pt = true;
70052
- continue;
70084
+ if (c.concatTokens().toUpperCase() === "PARAMETER") {
70085
+ // PARAMETER-TABLE
70086
+ pt = true;
70087
+ }
70088
+ else if (c.concatTokens().toUpperCase() === "EXCEPTION") {
70089
+ // todo: handle EXCEPTION-TABLE, for now just produce valid javascript
70090
+ return ret;
70091
+ }
70053
70092
  }
70054
70093
  else if (c.get() instanceof abaplint.Expressions.MethodCallParam) {
70055
70094
  ret.appendChunk(new method_call_param_1.MethodCallParamTranspiler(this.m).transpile(c, traversal));
@@ -71008,21 +71047,8 @@ class SQLFromTranspiler {
71008
71047
  chunk.appendChunk(new sql_from_source_1.SQLFromSourceTranspiler().transpile(c, traversal));
71009
71048
  }
71010
71049
  else {
71011
- if (c.findFirstExpression(abaplint.Expressions.Dynamic)) {
71012
- let concat = c.concatTokens();
71013
- if (concat.startsWith("'")) {
71014
- // no escaping needed, guess its not possible to have table names with single or double quote part of name
71015
- concat = "\\\"" + concat.substring(1, concat.length - 1) + "\\\"";
71016
- }
71017
- chunk.appendString(concat + " ");
71018
- }
71019
- else if (c.concatTokens().includes("/")) {
71020
- chunk.appendString("\\\"" + c.concatTokens() + "\\\" ");
71021
- }
71022
- else {
71023
- const concat = c.concatTokens();
71024
- chunk.appendString(concat + " ");
71025
- }
71050
+ const concat = c.concatTokens();
71051
+ chunk.appendString(concat + " ");
71026
71052
  }
71027
71053
  }
71028
71054
  return chunk;
@@ -71045,23 +71071,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
71045
71071
  exports.SQLFromSourceTranspiler = void 0;
71046
71072
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
71047
71073
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
71074
+ const database_table_1 = __webpack_require__(/*! ./database_table */ "./node_modules/@abaplint/transpiler/build/src/expressions/database_table.js");
71048
71075
  class SQLFromSourceTranspiler {
71049
- transpile(node, _traversal) {
71076
+ transpile(node, traversal) {
71050
71077
  const chunk = new chunk_1.Chunk();
71051
71078
  for (const c of node.getChildren()) {
71079
+ const concat = c.concatTokens();
71052
71080
  if (c instanceof abaplint.Nodes.TokenNode) {
71053
71081
  // keywords
71054
- chunk.appendString(c.concatTokens() + " ");
71082
+ chunk.appendString(concat + " ");
71055
71083
  }
71056
- else if (c.get() instanceof abaplint.Expressions.DatabaseTable && c.concatTokens().includes("/")) {
71057
- chunk.appendString("\\\"" + c.concatTokens() + "\\\" ");
71058
- }
71059
- else if (c.get() instanceof abaplint.Expressions.DatabaseTable && c.concatTokens().startsWith("('")) {
71060
- const concat = c.concatTokens();
71061
- chunk.appendString("\\\"" + concat.substring(2, concat.length - 2).toLowerCase() + "\\\" ");
71084
+ else if (c.get() instanceof abaplint.Expressions.DatabaseTable) {
71085
+ chunk.appendChunk(new database_table_1.DatabaseTableTranspiler().transpile(c, traversal));
71086
+ chunk.appendString(" ");
71062
71087
  }
71063
71088
  else {
71064
- chunk.appendString(c.concatTokens() + " ");
71089
+ chunk.appendString(concat + " ");
71065
71090
  }
71066
71091
  }
71067
71092
  return chunk;
@@ -73784,9 +73809,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
73784
73809
  exports.DeleteDatabaseTranspiler = void 0;
73785
73810
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
73786
73811
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
73812
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
73787
73813
  class DeleteDatabaseTranspiler {
73788
73814
  transpile(node, traversal) {
73789
- const table = traversal.traverse(node.findFirstExpression(abaplint.Expressions.DatabaseTable));
73815
+ const dbtab = node.findFirstExpression(abaplint.Expressions.DatabaseTable);
73816
+ if (dbtab === undefined) {
73817
+ throw new Error("internal error, InsertDatabaseTranspiler");
73818
+ }
73819
+ const table = new expressions_1.DatabaseTableTranspiler(false).transpile(dbtab, traversal);
73790
73820
  const options = [];
73791
73821
  const tab = node.findExpressionAfterToken("TABLE");
73792
73822
  if (tab) {
@@ -75127,9 +75157,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
75127
75157
  exports.InsertDatabaseTranspiler = void 0;
75128
75158
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
75129
75159
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
75160
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
75130
75161
  class InsertDatabaseTranspiler {
75131
75162
  transpile(node, traversal) {
75132
- const table = traversal.traverse(node.findFirstExpression(abaplint.Expressions.DatabaseTable));
75163
+ const dbtab = node.findFirstExpression(abaplint.Expressions.DatabaseTable);
75164
+ if (dbtab === undefined) {
75165
+ throw new Error("internal error, InsertDatabaseTranspiler");
75166
+ }
75167
+ const table = new expressions_1.DatabaseTableTranspiler(false).transpile(dbtab, traversal);
75133
75168
  const options = [];
75134
75169
  const values = node.findExpressionAfterToken("VALUES");
75135
75170
  if (values) {
@@ -75146,7 +75181,7 @@ class InsertDatabaseTranspiler {
75146
75181
  const tvalues = traversal.traverse(fromTable);
75147
75182
  options.push(`"table": ` + tvalues.getCode());
75148
75183
  }
75149
- return new chunk_1.Chunk(`await abap.statements.insertDatabase(${table.getCode().toLowerCase()}, {${options.join(", ")}});`);
75184
+ return new chunk_1.Chunk(`await abap.statements.insertDatabase(${table.getCode()}, {${options.join(", ")}});`);
75150
75185
  }
75151
75186
  }
75152
75187
  exports.InsertDatabaseTranspiler = InsertDatabaseTranspiler;
@@ -75760,9 +75795,14 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
75760
75795
  exports.ModifyDatabaseTranspiler = void 0;
75761
75796
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
75762
75797
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
75798
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
75763
75799
  class ModifyDatabaseTranspiler {
75764
75800
  transpile(node, traversal) {
75765
- const table = traversal.traverse(node.findFirstExpression(abaplint.Expressions.DatabaseTable));
75801
+ const dbtab = node.findFirstExpression(abaplint.Expressions.DatabaseTable);
75802
+ if (dbtab === undefined) {
75803
+ throw new Error("internal error, ModifyDatabaseTranspiler");
75804
+ }
75805
+ const table = new expressions_1.DatabaseTableTranspiler(false).transpile(dbtab, traversal);
75766
75806
  const options = [];
75767
75807
  const tab = node.findExpressionAfterToken("TABLE");
75768
75808
  if (tab) {
@@ -77476,10 +77516,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
77476
77516
  exports.UpdateDatabaseTranspiler = void 0;
77477
77517
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
77478
77518
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
77519
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
77479
77520
  class UpdateDatabaseTranspiler {
77480
77521
  transpile(node, traversal) {
77481
77522
  var _a;
77482
- const table = traversal.traverse(node.findFirstExpression(abaplint.Expressions.DatabaseTable));
77523
+ const dbtab = node.findFirstExpression(abaplint.Expressions.DatabaseTable);
77524
+ if (dbtab === undefined) {
77525
+ throw new Error("internal error, UpdateDatabaseTranspiler");
77526
+ }
77527
+ const table = new expressions_1.DatabaseTableTranspiler(false).transpile(dbtab, traversal);
77483
77528
  const options = [];
77484
77529
  const cond = node.findFirstExpression(abaplint.Expressions.SQLCond);
77485
77530
  if (cond) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.13",
3
+ "version": "2.7.15",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.13",
29
+ "@abaplint/transpiler": "^2.7.15",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
- "@types/node": "^20.2.4",
34
- "@abaplint/core": "^2.101.6",
33
+ "@types/node": "^20.2.5",
34
+ "@abaplint/core": "^2.101.7",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.84.1",
37
37
  "webpack-cli": "^5.1.1",