@abaplint/transpiler 2.7.61 → 2.7.63

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.
@@ -29,7 +29,7 @@ class SQLCondTranspiler {
29
29
  }
30
30
  }
31
31
  else if (c.findDirectExpression(abaplint.Expressions.SQLIn)) {
32
- ret += this.sqlIn(c, traversal);
32
+ ret += this.sqlIn(c, traversal, traversal.getFilename(), table);
33
33
  }
34
34
  else {
35
35
  ret += this.basicCondition(c, traversal, traversal.getFilename(), table);
@@ -45,15 +45,26 @@ class SQLCondTranspiler {
45
45
  const c = new chunk_1.Chunk();
46
46
  return c.appendString(ret.trim());
47
47
  }
48
- sqlIn(c, _traversal) {
48
+ sqlIn(c, traversal, filename, table) {
49
49
  const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);
50
- const slqin = c.findDirectExpression(abaplint.Expressions.SQLIn);
50
+ const sqlin = c.findDirectExpression(abaplint.Expressions.SQLIn);
51
51
  const source = c.findFirstExpression(abaplint.Expressions.SimpleSource3);
52
- if (fieldName === undefined || slqin === undefined || source === undefined) {
52
+ if (fieldName === undefined || sqlin === undefined || source === undefined) {
53
53
  throw new Error("SQL Condition, transpiler todo, " + c.concatTokens());
54
54
  }
55
- const ret = `" + abap.expandIN("${fieldName.concatTokens()}", ${source.concatTokens()}) + "`;
56
- return ret;
55
+ if (sqlin.getChildren().length === 2) {
56
+ return `" + abap.expandIN("${fieldName.concatTokens()}", ${source.concatTokens()}) + "`;
57
+ }
58
+ else {
59
+ const cond = [];
60
+ for (const s of sqlin.findDirectExpressions(abaplint.Expressions.SQLSource)) {
61
+ const field = new sql_field_name_1.SQLFieldNameTranspiler().transpile(fieldName, traversal).getCode();
62
+ const sourc = this.sqlSource(s, traversal, filename, table);
63
+ cond.push(field + " = " + sourc);
64
+ }
65
+ const ret = "( " + cond.join(" OR ") + " )";
66
+ return ret;
67
+ }
57
68
  }
58
69
  basicCondition(c, traversal, filename, table) {
59
70
  let ret = "";
@@ -3,5 +3,5 @@ import { IStatementTranspiler } from "./_statement_transpiler";
3
3
  import { Traversal } from "../traversal";
4
4
  import { Chunk } from "../chunk";
5
5
  export declare class CallTransactionTranspiler implements IStatementTranspiler {
6
- transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
6
+ transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
7
7
  }
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CallTransactionTranspiler = void 0;
4
4
  const chunk_1 = require("../chunk");
5
5
  class CallTransactionTranspiler {
6
- transpile(_node, _traversal) {
7
- return new chunk_1.Chunk(`throw new Error("CallTransaction, not supported, transpiler");`);
6
+ transpile(node, traversal) {
7
+ const ret = new chunk_1.Chunk();
8
+ ret.append("abap.statements.callTransaction();", node, traversal);
9
+ return ret;
8
10
  }
9
11
  }
10
12
  exports.CallTransactionTranspiler = CallTransactionTranspiler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.7.61",
3
+ "version": "2.7.63",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",