@abaplint/transpiler 2.6.36 → 2.6.38
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.
|
@@ -4,5 +4,8 @@ import { Traversal } from "../traversal";
|
|
|
4
4
|
import { Chunk } from "../chunk";
|
|
5
5
|
export declare class CallTranspiler implements IStatementTranspiler {
|
|
6
6
|
transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
|
|
7
|
-
|
|
7
|
+
static buildExceptions(node: abaplint.Nodes.ExpressionNode): {
|
|
8
|
+
pre: string;
|
|
9
|
+
post: string;
|
|
10
|
+
};
|
|
8
11
|
}
|
|
@@ -19,7 +19,7 @@ class CallTranspiler {
|
|
|
19
19
|
post += ";";
|
|
20
20
|
const exceptions = node.findFirstExpression(abaplint.Expressions.ParameterListExceptions);
|
|
21
21
|
if (exceptions) {
|
|
22
|
-
const build =
|
|
22
|
+
const build = CallTranspiler.buildExceptions(exceptions);
|
|
23
23
|
pre = build.pre + pre;
|
|
24
24
|
post += build.post;
|
|
25
25
|
}
|
|
@@ -53,7 +53,7 @@ class CallTranspiler {
|
|
|
53
53
|
}
|
|
54
54
|
const exceptions = node.findFirstExpression(abaplint.Expressions.ParameterListExceptions);
|
|
55
55
|
if (exceptions) {
|
|
56
|
-
const build =
|
|
56
|
+
const build = CallTranspiler.buildExceptions(exceptions);
|
|
57
57
|
pre = build.pre + pre;
|
|
58
58
|
post += build.post;
|
|
59
59
|
}
|
|
@@ -69,7 +69,7 @@ class CallTranspiler {
|
|
|
69
69
|
}
|
|
70
70
|
throw new Error("CallTranspiler, todo");
|
|
71
71
|
}
|
|
72
|
-
buildExceptions(node) {
|
|
72
|
+
static buildExceptions(node) {
|
|
73
73
|
var _a;
|
|
74
74
|
let pre = "";
|
|
75
75
|
let post = "";
|
|
@@ -4,6 +4,7 @@ exports.CallFunctionTranspiler = void 0;
|
|
|
4
4
|
const abaplint = require("@abaplint/core");
|
|
5
5
|
const chunk_1 = require("../chunk");
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
|
+
const call_1 = require("./call");
|
|
7
8
|
class CallFunctionTranspiler {
|
|
8
9
|
transpile(node, traversal) {
|
|
9
10
|
var _a, _b;
|
|
@@ -26,6 +27,10 @@ class CallFunctionTranspiler {
|
|
|
26
27
|
param = traversal.traverse(fmp).getCode();
|
|
27
28
|
}
|
|
28
29
|
const ret = new chunk_1.Chunk();
|
|
30
|
+
const exceptions = node.findFirstExpression(abaplint.Expressions.ParameterListExceptions);
|
|
31
|
+
if (exceptions) {
|
|
32
|
+
ret.appendString("try {\n");
|
|
33
|
+
}
|
|
29
34
|
const dest = (_b = node.findDirectExpression(abaplint.Expressions.Destination)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(abaplint.Expressions.Source);
|
|
30
35
|
if (dest) {
|
|
31
36
|
const s = new expressions_1.SourceTranspiler(true).transpile(dest, traversal);
|
|
@@ -35,6 +40,10 @@ class CallFunctionTranspiler {
|
|
|
35
40
|
else {
|
|
36
41
|
ret.appendString(`await abap.FunctionModules[${fmname}](${param});`);
|
|
37
42
|
}
|
|
43
|
+
if (exceptions) {
|
|
44
|
+
const build = call_1.CallTranspiler.buildExceptions(exceptions);
|
|
45
|
+
ret.appendString(build.post);
|
|
46
|
+
}
|
|
38
47
|
return ret;
|
|
39
48
|
}
|
|
40
49
|
}
|
|
@@ -23,6 +23,13 @@ class RaiseTranspiler {
|
|
|
23
23
|
if (parameters) {
|
|
24
24
|
p = traversal.traverse(parameters).getCode();
|
|
25
25
|
}
|
|
26
|
+
const extra = `"INTERNAL_FILENAME": "${traversal.getFilename()}","INTERNAL_LINE": ${node.getStart().getRow()}`;
|
|
27
|
+
if (p === "") {
|
|
28
|
+
p = "{" + extra + "}";
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
p = p.substring(0, p.length - 1) + "," + extra + "}";
|
|
32
|
+
}
|
|
26
33
|
const look = traversal.lookupClassOrInterface(classNameToken === null || classNameToken === void 0 ? void 0 : classNameToken.getStr(), classNameToken);
|
|
27
34
|
return new chunk_1.Chunk().append(`throw await (new ${look}()).constructor_(${p});`, node, traversal);
|
|
28
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.38",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"source-map": "^0.7.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/chai": "^4.3.
|
|
35
|
+
"@types/chai": "^4.3.5",
|
|
36
36
|
"@types/mocha": "^10.0.1",
|
|
37
37
|
"chai": "^4.3.7",
|
|
38
38
|
"mocha": "^10.2.0",
|