@abaplint/transpiler 2.13.30 → 2.13.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.
@@ -86,7 +86,8 @@ class SQLCondTranspiler {
86
86
  return c.appendString(ret.trim());
87
87
  }
88
88
  sqlIn(c, traversal, filename, table) {
89
- const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);
89
+ const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName)
90
+ || c.findDirectExpression(abaplint.Expressions.SQLAliasField);
90
91
  const sqlin = c.findDirectExpression(abaplint.Expressions.SQLIn);
91
92
  const source = c.findFirstExpression(abaplint.Expressions.SimpleSource3);
92
93
  if (fieldName === undefined || sqlin === undefined || source === undefined) {
@@ -117,7 +118,8 @@ class SQLCondTranspiler {
117
118
  return this.basicConditionNew(c, traversal, filename, table);
118
119
  }
119
120
  let fieldName = undefined;
120
- const fieldNameExpression = c.findDirectExpression(abaplint.Expressions.SQLFieldName);
121
+ const fieldNameExpression = c.findDirectExpression(abaplint.Expressions.SQLFieldName)
122
+ || c.findDirectExpression(abaplint.Expressions.SQLAliasField);
121
123
  if (fieldNameExpression) {
122
124
  fieldName = new sql_field_name_1.SQLFieldNameTranspiler().transpile(fieldNameExpression, traversal).getCode();
123
125
  }
@@ -190,7 +192,8 @@ class SQLCondTranspiler {
190
192
  if (ret !== "") {
191
193
  ret += " ";
192
194
  }
193
- if (child.get() instanceof abaplint.Expressions.SQLFieldName
195
+ if ((child.get() instanceof abaplint.Expressions.SQLFieldName
196
+ || child.get() instanceof abaplint.Expressions.SQLAliasField)
194
197
  && child instanceof abaplint.Nodes.ExpressionNode) {
195
198
  ret += new sql_field_name_1.SQLFieldNameTranspiler().transpile(child, traversal).getCode();
196
199
  }
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SQLFieldAndValueTranspiler = void 0;
37
37
  const abaplint = __importStar(require("@abaplint/core"));
38
38
  const chunk_1 = require("../chunk");
39
+ const sql_field_name_1 = require("./sql_field_name");
39
40
  class SQLFieldAndValueTranspiler {
40
41
  transpile(node, traversal) {
41
42
  const chunk = new chunk_1.Chunk();
@@ -45,12 +46,19 @@ class SQLFieldAndValueTranspiler {
45
46
  if (concat === "=") {
46
47
  chunk.appendString(" = ");
47
48
  }
49
+ else if (n.get() instanceof abaplint.Expressions.SQLFieldName) {
50
+ chunk.appendString(new sql_field_name_1.SQLFieldNameTranspiler().transpile(n, traversal).getCode());
51
+ }
48
52
  else if (n.get() instanceof abaplint.Expressions.SQLSource) {
49
53
  const source = traversal.traverse(n);
50
54
  // todo: value conversion? abap vs db, traversal.isSQLConversion
51
55
  // todo: integers?
52
56
  chunk.appendString("'\" + " + source.getCode() + ".get() + \"'");
53
57
  }
58
+ else if (n instanceof abaplint.Nodes.TokenNode) {
59
+ // operators/keywords, eg. the "+" in "field = field + value"
60
+ chunk.appendString(" " + concat + " ");
61
+ }
54
62
  else {
55
63
  chunk.appendString(traversal.traverse(n).getCode() + " ");
56
64
  }
@@ -46,6 +46,10 @@ class SQLFromTranspiler {
46
46
  // keywords
47
47
  chunk.appendString(c.concatTokens() + " ");
48
48
  }
49
+ else if (c.get() instanceof abaplint.Expressions.SQLFromBody) {
50
+ // newer abaplint versions wrap the sources in a SQLFromBody expression
51
+ chunk.appendChunk(this.transpile(c, traversal));
52
+ }
49
53
  else if (c.get() instanceof abaplint.Expressions.SQLJoin) {
50
54
  chunk.appendChunk(new sql_join_1.SQLJoinTranspiler().transpile(c, traversal));
51
55
  chunk.appendString(" ");
@@ -49,8 +49,15 @@ class SQLJoinTranspiler {
49
49
  else if (c.get() instanceof abaplint.Expressions.SQLCond) {
50
50
  chunk.appendChunk(new sql_cond_1.SQLCondTranspiler().transpile(c, traversal));
51
51
  }
52
- else if (c.get() instanceof abaplint.Expressions.SQLFromSource) {
53
- chunk.appendChunk(new sql_from_source_1.SQLFromSourceTranspiler().transpile(c, traversal));
52
+ else if (c.get() instanceof abaplint.Expressions.SQLJoinSource) {
53
+ // the join source is wrapped in a SQLJoinSource expression
54
+ const source = c.findDirectExpression(abaplint.Expressions.SQLFromSource);
55
+ if (source) {
56
+ chunk.appendChunk(new sql_from_source_1.SQLFromSourceTranspiler().transpile(source, traversal));
57
+ }
58
+ else {
59
+ chunk.appendString(c.concatTokens() + " ");
60
+ }
54
61
  }
55
62
  else {
56
63
  chunk.appendString(c.concatTokens() + " ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.13.30",
3
+ "version": "2.13.32",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.119.31",
32
+ "@abaplint/core": "^2.119.54",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {