@abaplint/transpiler 2.3.62 → 2.3.64
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.
|
@@ -6,16 +6,20 @@ const chunk_1 = require("../chunk");
|
|
|
6
6
|
class CompareTranspiler {
|
|
7
7
|
transpile(node, traversal) {
|
|
8
8
|
// todo, this is not correct
|
|
9
|
+
var _a, _b;
|
|
9
10
|
const concat = node.concatTokens().toUpperCase();
|
|
10
11
|
let pre = concat.startsWith("NOT ") ? "!" : "";
|
|
11
12
|
const sources = node.findDirectExpressions(core_1.Expressions.Source).concat(node.findDirectExpressions(core_1.Expressions.SourceFieldSymbol));
|
|
12
13
|
if (sources.length === 1) {
|
|
13
14
|
const s0 = traversal.traverse(sources[0]);
|
|
14
|
-
if (
|
|
15
|
-
|
|
15
|
+
if (concat.startsWith("NOT ") && concat.endsWith(" IS NOT INITIAL")) {
|
|
16
|
+
return new chunk_1.Chunk().appendString("abap.compare.initial(").appendChunk(s0).appendString(") === true");
|
|
17
|
+
}
|
|
18
|
+
else if ((concat.startsWith("NOT ") && concat.endsWith(" IS INITIAL"))
|
|
19
|
+
|| concat.endsWith(" IS NOT INITIAL")) {
|
|
16
20
|
return new chunk_1.Chunk().appendString("abap.compare.initial(").appendChunk(s0).appendString(") === false");
|
|
17
21
|
}
|
|
18
|
-
else if (concat.endsWith("IS INITIAL")) {
|
|
22
|
+
else if (concat.endsWith(" IS INITIAL")) {
|
|
19
23
|
return new chunk_1.Chunk().appendString("abap.compare.initial(").appendChunk(s0).appendString(")");
|
|
20
24
|
}
|
|
21
25
|
if ((concat.startsWith("NOT ") && concat.endsWith(" IS BOUND"))
|
|
@@ -44,6 +48,14 @@ class CompareTranspiler {
|
|
|
44
48
|
else if (concat.endsWith(" IS NOT REQUESTED")) {
|
|
45
49
|
return new chunk_1.Chunk().appendString(pre + "INPUT && INPUT." + concat.replace(" IS NOT REQUESTED", "").toLowerCase() + " === undefined");
|
|
46
50
|
}
|
|
51
|
+
if (concat.startsWith("NOT ") || concat.includes(" IS NOT INSTANCE OF ")) {
|
|
52
|
+
const cname = (_a = node.findDirectExpression(core_1.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
53
|
+
return new chunk_1.Chunk().appendString("abap.compare.instance_of(").appendChunk(s0).appendString(`, ${cname}) === false`);
|
|
54
|
+
}
|
|
55
|
+
else if (concat.includes(" IS INSTANCE OF ")) {
|
|
56
|
+
const cname = (_b = node.findDirectExpression(core_1.Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
57
|
+
return new chunk_1.Chunk().appendString("abap.compare.instance_of(").appendChunk(s0).appendString(`, ${cname})`);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
else if (sources.length === 2 && node.findDirectTokenByText("IN")) {
|
|
49
61
|
if (concat.search(" NOT IN ") >= 0) {
|
|
@@ -68,6 +80,8 @@ class CompareTranspiler {
|
|
|
68
80
|
const s2 = traversal.traverse(sources[2]);
|
|
69
81
|
return new chunk_1.Chunk().appendString(pre + "abap.compare.between(").join([s0, s1, s2]).appendString(")");
|
|
70
82
|
}
|
|
83
|
+
console.dir(sources.length);
|
|
84
|
+
console.dir(concat);
|
|
71
85
|
return new chunk_1.Chunk("CompareTodo");
|
|
72
86
|
}
|
|
73
87
|
}
|
|
@@ -3,5 +3,5 @@ import { IStatementTranspiler } from "./_statement_transpiler";
|
|
|
3
3
|
import { Traversal } from "../traversal";
|
|
4
4
|
import { Chunk } from "../chunk";
|
|
5
5
|
export declare class RaiseEventTranspiler implements IStatementTranspiler {
|
|
6
|
-
transpile(
|
|
6
|
+
transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
|
|
7
7
|
}
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RaiseEventTranspiler = void 0;
|
|
4
4
|
const chunk_1 = require("../chunk");
|
|
5
5
|
class RaiseEventTranspiler {
|
|
6
|
-
transpile(
|
|
7
|
-
|
|
6
|
+
transpile(node, traversal) {
|
|
7
|
+
// todo
|
|
8
|
+
return new chunk_1.Chunk().append(`abap.statements.raiseEvent();`, node, traversal);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
exports.RaiseEventTranspiler = RaiseEventTranspiler;
|
|
@@ -3,5 +3,5 @@ import { IStatementTranspiler } from "./_statement_transpiler";
|
|
|
3
3
|
import { Traversal } from "../traversal";
|
|
4
4
|
import { Chunk } from "../chunk";
|
|
5
5
|
export declare class SetHandlerTranspiler implements IStatementTranspiler {
|
|
6
|
-
transpile(
|
|
6
|
+
transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
|
|
7
7
|
}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SetHandlerTranspiler = void 0;
|
|
4
|
+
const abaplint = require("@abaplint/core");
|
|
4
5
|
const chunk_1 = require("../chunk");
|
|
6
|
+
const expressions_1 = require("../expressions");
|
|
5
7
|
class SetHandlerTranspiler {
|
|
6
|
-
transpile(
|
|
7
|
-
|
|
8
|
+
transpile(node, traversal) {
|
|
9
|
+
const methods = [];
|
|
10
|
+
for (const m of node.findDirectExpressions(abaplint.Expressions.MethodSource)) {
|
|
11
|
+
methods.push(new expressions_1.MethodSourceTranspiler().transpile(m, traversal).getCode());
|
|
12
|
+
}
|
|
13
|
+
let f = undefined;
|
|
14
|
+
const forExpression = node.findExpressionAfterToken("FOR");
|
|
15
|
+
if (forExpression) {
|
|
16
|
+
f = new expressions_1.SourceTranspiler().transpile(forExpression, traversal).getCode();
|
|
17
|
+
}
|
|
18
|
+
let activation = undefined;
|
|
19
|
+
const activationExpression = node.findExpressionAfterToken("ACTIVATION");
|
|
20
|
+
if (activationExpression) {
|
|
21
|
+
activation = new expressions_1.SourceTranspiler().transpile(activationExpression, traversal).getCode();
|
|
22
|
+
}
|
|
23
|
+
return new chunk_1.Chunk().append(`abap.statements.setHandler([${methods.join(",")}], ${f}, ${activation});`, node, traversal);
|
|
8
24
|
}
|
|
9
25
|
}
|
|
10
26
|
exports.SetHandlerTranspiler = SetHandlerTranspiler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.64",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"author": "abaplint",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@abaplint/core": "^2.
|
|
31
|
+
"@abaplint/core": "^2.94.0",
|
|
32
32
|
"source-map": "^0.7.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/chai": "^4.3.4",
|
|
36
|
-
"@types/mocha": "^10.0.
|
|
36
|
+
"@types/mocha": "^10.0.1",
|
|
37
37
|
"chai": "^4.3.7",
|
|
38
38
|
"mocha": "^10.1.0",
|
|
39
39
|
"source-map-support": "^0.5.21",
|