@abaplint/transpiler 2.7.17 → 2.7.19
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.
- package/build/src/expressions/index.d.ts +4 -1
- package/build/src/expressions/index.js +4 -1
- package/build/src/expressions/sql_arithmetic_operator.d.ts +7 -0
- package/build/src/expressions/sql_arithmetic_operator.js +14 -0
- package/build/src/expressions/sql_field_and_value.d.ts +7 -0
- package/build/src/expressions/sql_field_and_value.js +30 -0
- package/build/src/handlers/handle_msag.d.ts +5 -0
- package/build/src/handlers/handle_msag.js +31 -0
- package/build/src/index.js +4 -0
- package/build/src/statements/update_database.js +1 -4
- package/build/src/unit_test.js +1 -0
- package/package.json +1 -1
|
@@ -40,12 +40,15 @@ export * from "./source_field_symbol";
|
|
|
40
40
|
export * from "./source_field";
|
|
41
41
|
export * from "./source";
|
|
42
42
|
export * from "./sql_cond";
|
|
43
|
+
export * from "./sql_field_and_value";
|
|
43
44
|
export * from "./sql_field";
|
|
45
|
+
export * from "./sql_field_name";
|
|
46
|
+
export * from "./sql_arithmetic_operator";
|
|
44
47
|
export * from "./sql_from_source";
|
|
45
48
|
export * from "./sql_from";
|
|
49
|
+
export * from "./sql_into_structure";
|
|
46
50
|
export * from "./sql_join";
|
|
47
51
|
export * from "./sql_source_simple";
|
|
48
|
-
export * from "./sql_into_structure";
|
|
49
52
|
export * from "./sql_source";
|
|
50
53
|
export * from "./sql_target";
|
|
51
54
|
export * from "./string_template_source";
|
|
@@ -56,12 +56,15 @@ __exportStar(require("./source_field_symbol"), exports);
|
|
|
56
56
|
__exportStar(require("./source_field"), exports);
|
|
57
57
|
__exportStar(require("./source"), exports);
|
|
58
58
|
__exportStar(require("./sql_cond"), exports);
|
|
59
|
+
__exportStar(require("./sql_field_and_value"), exports);
|
|
59
60
|
__exportStar(require("./sql_field"), exports);
|
|
61
|
+
__exportStar(require("./sql_field_name"), exports);
|
|
62
|
+
__exportStar(require("./sql_arithmetic_operator"), exports);
|
|
60
63
|
__exportStar(require("./sql_from_source"), exports);
|
|
61
64
|
__exportStar(require("./sql_from"), exports);
|
|
65
|
+
__exportStar(require("./sql_into_structure"), exports);
|
|
62
66
|
__exportStar(require("./sql_join"), exports);
|
|
63
67
|
__exportStar(require("./sql_source_simple"), exports);
|
|
64
|
-
__exportStar(require("./sql_into_structure"), exports);
|
|
65
68
|
__exportStar(require("./sql_source"), exports);
|
|
66
69
|
__exportStar(require("./sql_target"), exports);
|
|
67
70
|
__exportStar(require("./string_template_source"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Nodes } from "@abaplint/core";
|
|
2
|
+
import { IExpressionTranspiler } from "./_expression_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class SQLArithmeticOperatorTranspiler implements IExpressionTranspiler {
|
|
6
|
+
transpile(node: Nodes.ExpressionNode, _traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLArithmeticOperatorTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class SQLArithmeticOperatorTranspiler {
|
|
6
|
+
transpile(node, _traversal) {
|
|
7
|
+
const chunk = new chunk_1.Chunk();
|
|
8
|
+
const concat = node.concatTokens();
|
|
9
|
+
chunk.appendString(concat);
|
|
10
|
+
return chunk;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SQLArithmeticOperatorTranspiler = SQLArithmeticOperatorTranspiler;
|
|
14
|
+
//# sourceMappingURL=sql_arithmetic_operator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Nodes } from "@abaplint/core";
|
|
2
|
+
import { IExpressionTranspiler } from "./_expression_transpiler";
|
|
3
|
+
import { Traversal } from "../traversal";
|
|
4
|
+
import { Chunk } from "../chunk";
|
|
5
|
+
export declare class SQLFieldAndValueTranspiler implements IExpressionTranspiler {
|
|
6
|
+
transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLFieldAndValueTranspiler = void 0;
|
|
4
|
+
const abaplint = require("@abaplint/core");
|
|
5
|
+
const chunk_1 = require("../chunk");
|
|
6
|
+
class SQLFieldAndValueTranspiler {
|
|
7
|
+
transpile(node, traversal) {
|
|
8
|
+
const chunk = new chunk_1.Chunk();
|
|
9
|
+
chunk.appendString("\"");
|
|
10
|
+
for (const n of node.getChildren()) {
|
|
11
|
+
const concat = n.concatTokens();
|
|
12
|
+
if (concat === "=") {
|
|
13
|
+
chunk.appendString(" = ");
|
|
14
|
+
}
|
|
15
|
+
else if (n.get() instanceof abaplint.Expressions.SQLSource) {
|
|
16
|
+
const source = traversal.traverse(n);
|
|
17
|
+
// todo: value conversion? abap vs db, traversal.isSQLConversion
|
|
18
|
+
// todo: integers?
|
|
19
|
+
chunk.appendString("'\" + " + source.getCode() + ".get() + \"'");
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
chunk.appendString(traversal.traverse(n).getCode() + " ");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
chunk.appendString("\"");
|
|
26
|
+
return chunk;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.SQLFieldAndValueTranspiler = SQLFieldAndValueTranspiler;
|
|
30
|
+
//# sourceMappingURL=sql_field_and_value.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HandleMSAG = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class HandleMSAG {
|
|
6
|
+
runObject(obj, _reg) {
|
|
7
|
+
var _a;
|
|
8
|
+
const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
|
|
9
|
+
if (filename === undefined) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const chunk = new chunk_1.Chunk().appendString(`abap.MSAG["${obj.getName().toUpperCase()}"] = {\n`);
|
|
13
|
+
for (const m of obj.getMessages()) {
|
|
14
|
+
chunk.appendString(` "${m.getNumber()}": "${m.getMessage().replace(/"/g, `\\"`)}",\n`);
|
|
15
|
+
}
|
|
16
|
+
chunk.appendString(`};`);
|
|
17
|
+
const output = {
|
|
18
|
+
object: {
|
|
19
|
+
name: obj.getName(),
|
|
20
|
+
type: obj.getType(),
|
|
21
|
+
},
|
|
22
|
+
filename: filename,
|
|
23
|
+
chunk: chunk,
|
|
24
|
+
requires: [],
|
|
25
|
+
exports: [],
|
|
26
|
+
};
|
|
27
|
+
return [output];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.HandleMSAG = HandleMSAG;
|
|
31
|
+
//# sourceMappingURL=handle_msag.js.map
|
package/build/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const handle_enqu_1 = require("./handlers/handle_enqu");
|
|
|
16
16
|
const handle_type_pool_1 = require("./handlers/handle_type_pool");
|
|
17
17
|
const handle_w3mi_1 = require("./handlers/handle_w3mi");
|
|
18
18
|
const handle_smim_1 = require("./handlers/handle_smim");
|
|
19
|
+
const handle_msag_1 = require("./handlers/handle_msag");
|
|
19
20
|
class Transpiler {
|
|
20
21
|
constructor(options) {
|
|
21
22
|
this.options = options;
|
|
@@ -77,6 +78,9 @@ class Transpiler {
|
|
|
77
78
|
else if (obj instanceof abaplint.Objects.WebMIME) {
|
|
78
79
|
output.objects.push(...new handle_w3mi_1.HandleW3MI().runObject(obj, reg));
|
|
79
80
|
}
|
|
81
|
+
else if (obj instanceof abaplint.Objects.MessageClass) {
|
|
82
|
+
output.objects.push(...new handle_msag_1.HandleMSAG().runObject(obj, reg));
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
85
|
return output;
|
|
82
86
|
}
|
|
@@ -6,7 +6,6 @@ const chunk_1 = require("../chunk");
|
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
7
|
class UpdateDatabaseTranspiler {
|
|
8
8
|
transpile(node, traversal) {
|
|
9
|
-
var _a;
|
|
10
9
|
const dbtab = node.findFirstExpression(abaplint.Expressions.DatabaseTable);
|
|
11
10
|
if (dbtab === undefined) {
|
|
12
11
|
throw new Error("internal error, UpdateDatabaseTranspiler");
|
|
@@ -22,9 +21,7 @@ class UpdateDatabaseTranspiler {
|
|
|
22
21
|
if (sets.length > 0) {
|
|
23
22
|
const s = [];
|
|
24
23
|
for (const set of sets) {
|
|
25
|
-
|
|
26
|
-
const source = traversal.traverse(set.findDirectExpression(abaplint.Expressions.SQLSource));
|
|
27
|
-
s.push("\"\\\"" + name + "\\\" = '\" + " + source.getCode() + ".get() + \"'\"");
|
|
24
|
+
s.push(new expressions_1.SQLFieldAndValueTranspiler().transpile(set, traversal).getCode());
|
|
28
25
|
}
|
|
29
26
|
options.push(`"set": [${s.join(",")}]`);
|
|
30
27
|
}
|
package/build/src/unit_test.js
CHANGED
|
@@ -315,6 +315,7 @@ run().then(() => {
|
|
|
315
315
|
if (obj instanceof abaplint.Objects.Table
|
|
316
316
|
|| obj instanceof abaplint.Objects.DataElement
|
|
317
317
|
|| obj instanceof abaplint.Objects.LockObject
|
|
318
|
+
|| obj instanceof abaplint.Objects.MessageClass
|
|
318
319
|
|| obj instanceof abaplint.Objects.MIMEObject
|
|
319
320
|
|| obj instanceof abaplint.Objects.WebMIME
|
|
320
321
|
|| obj instanceof abaplint.Objects.TypePool
|