@abaplint/transpiler 2.5.57 → 2.5.59

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.
@@ -25,11 +25,14 @@ class ReadTableTranspiler {
25
25
  if (keyName && node.findDirectTokenByText("COMPONENTS")) {
26
26
  extra.push("keyName: \"" + keyName.concatTokens() + "\"");
27
27
  }
28
- const withTableKey = node.findTokenSequencePosition("WITH", "TABLE");
29
28
  const binary = node.findTokenSequencePosition("BINARY", "SEARCH");
30
- if (binary || withTableKey) {
29
+ if (binary) {
31
30
  extra.push("binarySearch: true");
32
31
  }
32
+ const withTableKey = node.findTokenSequencePosition("WITH", "TABLE");
33
+ if (withTableKey) {
34
+ extra.push("withTableKey: true");
35
+ }
33
36
  const rt = node.findDirectExpression(abaplint.Expressions.ReadTableTarget);
34
37
  const target = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.Target);
35
38
  const fs = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.FSTarget);
@@ -48,9 +51,12 @@ class ReadTableTranspiler {
48
51
  }
49
52
  const compare = node.findDirectExpression(abaplint.Expressions.ComponentCompareSimple);
50
53
  if (compare) {
51
- const conds = [];
52
- const blah = [];
54
+ const withKey = [];
55
+ const withKeyValue = [];
56
+ const withKeySimple = [];
53
57
  const count = compare.getChildren().length / 3;
58
+ let skipSimple = false;
59
+ let usesTableLine = false;
54
60
  for (let i = 0; i < count; i++) {
55
61
  const left = compare.getChildren()[i * 3];
56
62
  const source = compare.getChildren()[(i * 3) + 2];
@@ -64,23 +70,36 @@ class ReadTableTranspiler {
64
70
  else {
65
71
  field = traversal.traverse(left).getCode();
66
72
  }
73
+ if (field.includes(".")) {
74
+ skipSimple = true;
75
+ }
76
+ if (field === "table_line") {
77
+ skipSimple = true;
78
+ usesTableLine = true;
79
+ }
67
80
  if (s.includes("await")) {
68
81
  const id = unique_identifier_1.UniqueIdentifier.get();
69
82
  prefix += "const " + id + " = " + s + ";\n";
70
- conds.push("abap.compare.eq(i." + field + ", " + id + ")");
71
- blah.push(`{key: (i) => {return i.${field}}, value: ${id}}`);
83
+ withKey.push("abap.compare.eq(i." + field + ", " + id + ")");
84
+ withKeyValue.push(`{key: (i) => {return i.${field}}, value: ${id}}`);
85
+ withKeySimple.push(`"${field}": ${id}`);
72
86
  }
73
87
  else {
74
- conds.push("abap.compare.eq(i." + field + ", " + s + ")");
75
- blah.push(`{key: (i) => {return i.${field}}, value: ${s}}`);
88
+ withKey.push("abap.compare.eq(i." + field + ", " + s + ")");
89
+ withKeyValue.push(`{key: (i) => {return i.${field}}, value: ${s}}`);
90
+ withKeySimple.push(`"${field}": ${s}`);
76
91
  }
77
92
  }
78
- extra.push("withKey: (i) => {return " + conds.join(" && ") + ";}");
79
- extra.push(`withKeyValue: [${blah.join(",")}]`);
93
+ extra.push("withKey: (i) => {return " + withKey.join(" && ") + ";}");
94
+ extra.push(`withKeyValue: [${withKeyValue.join(",")}]`);
95
+ extra.push(`usesTableLine: ${usesTableLine}`);
96
+ if (skipSimple !== true) {
97
+ extra.push(`withKeySimple: {${withKeySimple.join(",")}}`);
98
+ }
80
99
  }
81
100
  let concat = "";
82
101
  if (extra.length > 0) {
83
- concat = ",{" + extra.join(",") + "}";
102
+ concat = ",{" + extra.join(",\n ") + "}";
84
103
  }
85
104
  return new chunk_1.Chunk()
86
105
  .append(prefix + "abap.statements.readTable(", node, traversal)
@@ -34,6 +34,7 @@ class TranspileTypes {
34
34
  if (type.getQualifiedName() !== undefined) {
35
35
  extra += ", \"" + type.getQualifiedName() + "\"";
36
36
  }
37
+ return "abap.types.TableFactory.construct(" + extra + ")";
37
38
  }
38
39
  else if (type instanceof abaplint.BasicTypes.IntegerType) {
39
40
  resolved = "Integer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.5.57",
3
+ "version": "2.5.59",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@abaplint/core": "^2.95.49",
31
+ "@abaplint/core": "^2.95.50",
32
32
  "source-map": "^0.7.4"
33
33
  },
34
34
  "devDependencies": {