@abaplint/transpiler 1.8.24 → 1.8.27
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.
|
@@ -30,11 +30,11 @@ class DataTranspiler {
|
|
|
30
30
|
}
|
|
31
31
|
if (int) {
|
|
32
32
|
const escaped = new constant_1.ConstantTranspiler().escape(int.getFirstToken().getStr());
|
|
33
|
-
value = "\n" + found.getName() + ".set(" + escaped + ");";
|
|
33
|
+
value = "\n" + found.getName().toLowerCase() + ".set(" + escaped + ");";
|
|
34
34
|
}
|
|
35
35
|
else if (val.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {
|
|
36
36
|
const s = new expressions_1.FieldChainTranspiler().transpile(val.getChildren()[1], traversal).getCode();
|
|
37
|
-
value = "\n" + found.getName() + ".set(" + s + ");";
|
|
37
|
+
value = "\n" + found.getName().toLowerCase() + ".set(" + s + ");";
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
const ret = new chunk_1.Chunk()
|
|
@@ -50,10 +50,10 @@ class ReadTableTranspiler {
|
|
|
50
50
|
if (s.includes("await")) {
|
|
51
51
|
const id = unique_identifier_1.UniqueIdentifier.get();
|
|
52
52
|
prefix += "const " + id + " = " + s + ";\n";
|
|
53
|
-
conds.push("abap.compare.eq(i." + components[i].concatTokens() + ", " + id + ")");
|
|
53
|
+
conds.push("abap.compare.eq(i." + components[i].concatTokens().toLowerCase() + ", " + id + ")");
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
conds.push("abap.compare.eq(i." + components[i].concatTokens() + ", " + s + ")");
|
|
56
|
+
conds.push("abap.compare.eq(i." + components[i].concatTokens().toLowerCase() + ", " + s + ")");
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
extra.push("withKey: (i) => {return " + conds.join(" && ") + ";}");
|
|
@@ -6,23 +6,28 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
const chunk_1 = require("../chunk");
|
|
7
7
|
class ReplaceTranspiler {
|
|
8
8
|
transpile(node, traversal) {
|
|
9
|
-
const sources =
|
|
10
|
-
for (const s of node.findDirectExpressions(abaplint.Expressions.Source)) {
|
|
11
|
-
sources.push(new expressions_1.SourceTranspiler().transpile(s, traversal).getCode());
|
|
12
|
-
}
|
|
9
|
+
const sources = node.findDirectExpressions(abaplint.Expressions.Source);
|
|
13
10
|
const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Target)).getCode();
|
|
14
11
|
const concat = node.concatTokens().toUpperCase();
|
|
15
12
|
const all = concat.startsWith("REPLACE ALL");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const extra = [];
|
|
14
|
+
const w = node.findExpressionAfterToken("WITH");
|
|
15
|
+
if (w) {
|
|
16
|
+
extra.push("with: " + new expressions_1.SourceTranspiler().transpile(w, traversal).getCode());
|
|
17
|
+
}
|
|
18
|
+
const o = node.findExpressionAfterToken("OF");
|
|
19
|
+
if (o && o.get() instanceof abaplint.Expressions.Source) {
|
|
20
|
+
extra.push("of: " + new expressions_1.SourceTranspiler().transpile(o, traversal).getCode());
|
|
21
|
+
}
|
|
22
|
+
const r = node.findDirectExpression(abaplint.Expressions.FindType);
|
|
23
|
+
const type = r === null || r === void 0 ? void 0 : r.concatTokens().toUpperCase();
|
|
24
|
+
if (type === "REGEX") {
|
|
25
|
+
extra.push("regex: " + new expressions_1.SourceTranspiler().transpile(sources[0], traversal).getCode());
|
|
21
26
|
}
|
|
22
27
|
return new chunk_1.Chunk()
|
|
23
|
-
.append("abap.statements.replace(", node, traversal)
|
|
24
|
-
.appendString(target + ", " + all + ", " +
|
|
25
|
-
.append(");", node.getLastToken(), traversal);
|
|
28
|
+
.append("abap.statements.replace({target:", node, traversal)
|
|
29
|
+
.appendString(target + ", all:" + all + ", " + extra.join(","))
|
|
30
|
+
.append("});", node.getLastToken(), traversal);
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
exports.ReplaceTranspiler = ReplaceTranspiler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.27",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abaplint/core": "^2.85.
|
|
30
|
+
"@abaplint/core": "^2.85.54",
|
|
31
31
|
"source-map": "^0.7.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
"chai": "^4.3.6",
|
|
37
37
|
"mocha": "^9.2.2",
|
|
38
38
|
"source-map-support": "^0.5.21",
|
|
39
|
-
"typescript": "^4.6.
|
|
39
|
+
"typescript": "^4.6.3"
|
|
40
40
|
}
|
|
41
41
|
}
|