@abaplint/transpiler 2.6.35 → 2.6.37
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
|
}
|
package/build/src/traversal.js
CHANGED
|
@@ -188,7 +188,8 @@ class Traversal {
|
|
|
188
188
|
default:
|
|
189
189
|
runtime = "U";
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
|
|
192
|
+
attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
|
|
192
193
|
}
|
|
193
194
|
for (const a of ((_b = def.getAttributes()) === null || _b === void 0 ? void 0 : _b.getConstants()) || []) {
|
|
194
195
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
@@ -203,7 +204,7 @@ class Traversal {
|
|
|
203
204
|
default:
|
|
204
205
|
runtime = "U";
|
|
205
206
|
}
|
|
206
|
-
attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X"}`);
|
|
207
|
+
attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X", "is_class": "X"}`);
|
|
207
208
|
}
|
|
208
209
|
for (const impl of def.getImplementing()) {
|
|
209
210
|
const idef = this.findInterfaceDefinition(impl.name, scope);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.37",
|
|
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.
|
|
31
|
+
"@abaplint/core": "^2.98.3",
|
|
32
32
|
"source-map": "^0.7.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|