@abaplint/transpiler 2.11.50 → 2.11.52
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.
|
@@ -90,6 +90,20 @@ for await (const unique1 of abap.statements.loop(${source})) {
|
|
|
90
90
|
VAL`);
|
|
91
91
|
post = ";\n}\nreturn VAL;\n})()";
|
|
92
92
|
}
|
|
93
|
+
else if (child instanceof core_1.Nodes.TokenNode && child.getFirstToken().getStr().toUpperCase() === "DEFAULT") {
|
|
94
|
+
// note: this is last in the body, so its okay to prepend and postpend
|
|
95
|
+
const sources = body.findDirectExpressions(core_1.Expressions.Source);
|
|
96
|
+
const deflt = traversal.traverse(sources[1]).getCode();
|
|
97
|
+
const pre = `(await (async () => { try { return `;
|
|
98
|
+
ret = new chunk_1.Chunk().appendString(pre + ret.getCode());
|
|
99
|
+
post += `; } catch (error) { if (abap.isLineNotFound(error)) { return ${deflt}; } throw error; } })())`;
|
|
100
|
+
}
|
|
101
|
+
else if (child instanceof core_1.Nodes.TokenNode && child.getFirstToken().getStr().toUpperCase() === "OPTIONAL") {
|
|
102
|
+
// note: this is last in the body, so its okay to prepend and postpend
|
|
103
|
+
const pre = `(await (async () => { try { return `;
|
|
104
|
+
ret = new chunk_1.Chunk().appendString(pre + ret.getCode());
|
|
105
|
+
post += `; } catch (error) { if (abap.isLineNotFound(error)) { return ${transpile_types_1.TranspileTypes.toType(context)}; } throw error; } })())`;
|
|
106
|
+
}
|
|
93
107
|
else {
|
|
94
108
|
throw new Error("ValueBodyTranspiler, unknown " + child.get().constructor.name + " \"" + child.concatTokens()) + "\"";
|
|
95
109
|
}
|
|
@@ -15,14 +15,11 @@ class GetReferenceTranspiler {
|
|
|
15
15
|
}
|
|
16
16
|
const source = traversal.traverse(s);
|
|
17
17
|
const target = traversal.traverse(t);
|
|
18
|
-
if (s.getFirstToken().getStr().startsWith("<")) {
|
|
19
|
-
// its a field symbol
|
|
20
|
-
source.appendString(".getPointer()");
|
|
21
|
-
}
|
|
22
18
|
return new chunk_1.Chunk()
|
|
23
|
-
.
|
|
24
|
-
.appendString(".assign(")
|
|
19
|
+
.appendString("abap.statements.getReference(")
|
|
25
20
|
.appendChunk(source)
|
|
21
|
+
.appendString(", ")
|
|
22
|
+
.appendChunk(target)
|
|
26
23
|
.append(");", node.getLastToken(), traversal);
|
|
27
24
|
}
|
|
28
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.52",
|
|
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.113.
|
|
32
|
+
"@abaplint/core": "^2.113.186",
|
|
33
33
|
"source-map": "^0.7.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|