@abaplint/transpiler 2.1.87 → 2.1.88

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.
@@ -40,6 +40,12 @@ class CompareOperatorTranspiler {
40
40
  return new chunk_1.Chunk().append("na", node, traversal);
41
41
  case "NP":
42
42
  return new chunk_1.Chunk().append("np", node, traversal);
43
+ case "O":
44
+ return new chunk_1.Chunk().append("o", node, traversal);
45
+ case "Z":
46
+ return new chunk_1.Chunk().append("z", node, traversal);
47
+ case "M":
48
+ return new chunk_1.Chunk().append("m", node, traversal);
43
49
  default:
44
50
  return new chunk_1.Chunk().append("compareoperatortodo" + op, node, traversal);
45
51
  }
@@ -6,4 +6,6 @@ export declare class SQLCondTranspiler implements IExpressionTranspiler {
6
6
  transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk;
7
7
  private sqlIn;
8
8
  private basicCondition;
9
+ private sqlSource;
10
+ private basicConditionNew;
9
11
  }
@@ -55,15 +55,29 @@ class SQLCondTranspiler {
55
55
  basicCondition(c, traversal) {
56
56
  let ret = "";
57
57
  if (c.getChildren().length !== 3) {
58
- throw new Error("SQL Condition, transpiler todo, " + c.concatTokens() + ", " + c.getChildren().length);
58
+ return this.basicConditionNew(c, traversal);
59
+ // throw new Error("SQL Condition, transpiler todo1, " + c.concatTokens() + ", " + c.getChildren().length);
59
60
  }
60
61
  const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName);
61
62
  const operator = c.findDirectExpression(abaplint.Expressions.SQLCompareOperator);
62
63
  const source = c.findDirectExpression(abaplint.Expressions.SQLSource);
63
64
  if (fieldName === undefined || operator === undefined || source === undefined) {
64
- throw new Error("SQL Condition, transpiler todo, " + c.concatTokens());
65
+ throw new Error("SQL Condition, transpiler todo2, " + c.concatTokens());
65
66
  }
66
67
  ret += fieldName.concatTokens() + " " + operator.concatTokens() + " ";
68
+ ret += this.sqlSource(source, traversal);
69
+ /*
70
+ const simple = source.findDirectExpression(abaplint.Expressions.SimpleSource3);
71
+ if (simple && simple.findDirectExpression(abaplint.Expressions.Constant) === undefined) {
72
+ ret += "'\" + " + new SimpleSource3Transpiler(true).transpile(simple, traversal).getCode() + " + \"'";
73
+ } else {
74
+ ret += source.concatTokens();
75
+ }
76
+ */
77
+ return ret;
78
+ }
79
+ sqlSource(source, traversal) {
80
+ let ret = "";
67
81
  const simple = source.findDirectExpression(abaplint.Expressions.SimpleSource3);
68
82
  if (simple && simple.findDirectExpression(abaplint.Expressions.Constant) === undefined) {
69
83
  ret += "'\" + " + new simple_source3_1.SimpleSource3Transpiler(true).transpile(simple, traversal).getCode() + " + \"'";
@@ -73,6 +87,25 @@ class SQLCondTranspiler {
73
87
  }
74
88
  return ret;
75
89
  }
90
+ basicConditionNew(node, traversal) {
91
+ let ret = "";
92
+ for (const child of node.getChildren()) {
93
+ if (ret !== "") {
94
+ ret += " ";
95
+ }
96
+ if (child.get() instanceof abaplint.Expressions.SQLFieldName) {
97
+ ret += child.concatTokens();
98
+ }
99
+ else if (child.get() instanceof abaplint.Expressions.SQLSource
100
+ && child instanceof abaplint.Nodes.ExpressionNode) {
101
+ ret += this.sqlSource(child, traversal);
102
+ }
103
+ else {
104
+ ret += child.concatTokens();
105
+ }
106
+ }
107
+ return ret;
108
+ }
76
109
  }
77
110
  exports.SQLCondTranspiler = SQLCondTranspiler;
78
111
  //# sourceMappingURL=sql_cond.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.1.87",
3
+ "version": "2.1.88",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",