@abaplint/transpiler 2.5.64 → 2.5.66
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 +1 -0
- package/build/src/expressions/index.js +1 -0
- package/build/src/expressions/sql_into_structure.d.ts +7 -0
- package/build/src/expressions/sql_into_structure.js +23 -0
- package/build/src/statements/class_implementation.js +2 -1
- package/build/src/statements/select.js +5 -1
- package/build/src/structures/class_definition.js +1 -0
- package/build/src/structures/interface.d.ts +1 -0
- package/build/src/structures/interface.js +13 -0
- package/package.json +1 -1
|
@@ -45,6 +45,7 @@ export * from "./sql_from_source";
|
|
|
45
45
|
export * from "./sql_from";
|
|
46
46
|
export * from "./sql_join";
|
|
47
47
|
export * from "./sql_source_simple";
|
|
48
|
+
export * from "./sql_into_structure";
|
|
48
49
|
export * from "./sql_source";
|
|
49
50
|
export * from "./sql_target";
|
|
50
51
|
export * from "./string_template_source";
|
|
@@ -61,6 +61,7 @@ __exportStar(require("./sql_from_source"), exports);
|
|
|
61
61
|
__exportStar(require("./sql_from"), exports);
|
|
62
62
|
__exportStar(require("./sql_join"), exports);
|
|
63
63
|
__exportStar(require("./sql_source_simple"), exports);
|
|
64
|
+
__exportStar(require("./sql_into_structure"), exports);
|
|
64
65
|
__exportStar(require("./sql_source"), exports);
|
|
65
66
|
__exportStar(require("./sql_target"), exports);
|
|
66
67
|
__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 SQLIntoStructureTranspiler implements IExpressionTranspiler {
|
|
6
|
+
transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLIntoStructureTranspiler = void 0;
|
|
4
|
+
const abaplint = require("@abaplint/core");
|
|
5
|
+
const chunk_1 = require("../chunk");
|
|
6
|
+
class SQLIntoStructureTranspiler {
|
|
7
|
+
transpile(node, traversal) {
|
|
8
|
+
const targets = node.findDirectExpressions(abaplint.Expressions.SQLTarget);
|
|
9
|
+
const transpiled = targets.map(t => traversal.traverse(t));
|
|
10
|
+
if (targets.length === 1) {
|
|
11
|
+
return transpiled[0];
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const chunk = new chunk_1.Chunk();
|
|
15
|
+
chunk.appendString("[");
|
|
16
|
+
chunk.appendString(transpiled.map(t => t.getCode()).join(","));
|
|
17
|
+
chunk.appendString("]");
|
|
18
|
+
return chunk;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SQLIntoStructureTranspiler = SQLIntoStructureTranspiler;
|
|
23
|
+
//# sourceMappingURL=sql_into_structure.js.map
|
|
@@ -21,7 +21,8 @@ class ClassImplementationTranspiler {
|
|
|
21
21
|
const scope = traversal.findCurrentScopeByToken(token);
|
|
22
22
|
return new chunk_1.Chunk().append(ret + ` {
|
|
23
23
|
static INTERNAL_TYPE = 'CLAS';
|
|
24
|
-
static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}]
|
|
24
|
+
static IMPLEMENTED_INTERFACES = [${this.findImplementedClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];
|
|
25
|
+
static ATTRIBUTES = {};`, node, traversal);
|
|
25
26
|
}
|
|
26
27
|
findImplementedInterface(traversal, def, scope) {
|
|
27
28
|
if (def === undefined || scope === undefined) {
|
|
@@ -9,6 +9,7 @@ const sql_from_1 = require("../expressions/sql_from");
|
|
|
9
9
|
function escapeRegExp(string) {
|
|
10
10
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
11
11
|
}
|
|
12
|
+
// TODO: currently SELECT into are always handled as CORRESPONDING
|
|
12
13
|
class SelectTranspiler {
|
|
13
14
|
transpile(node, traversal, targetOverride) {
|
|
14
15
|
var _a;
|
|
@@ -16,9 +17,12 @@ class SelectTranspiler {
|
|
|
16
17
|
if (targetOverride) {
|
|
17
18
|
target = targetOverride;
|
|
18
19
|
}
|
|
19
|
-
else if (node.findFirstExpression(abaplint.Expressions.
|
|
20
|
+
else if (node.findFirstExpression(abaplint.Expressions.SQLIntoTable)) {
|
|
20
21
|
target = traversal.traverse(node.findFirstExpression(abaplint.Expressions.Target)).getCode();
|
|
21
22
|
}
|
|
23
|
+
else if (node.findFirstExpression(abaplint.Expressions.SQLIntoStructure)) {
|
|
24
|
+
target = traversal.traverse(node.findFirstExpression(abaplint.Expressions.SQLIntoStructure)).getCode();
|
|
25
|
+
}
|
|
22
26
|
let select = "SELECT ";
|
|
23
27
|
const fieldList = node.findFirstExpression(abaplint.Expressions.SQLFieldList)
|
|
24
28
|
|| node.findFirstExpression(abaplint.Expressions.SQLFieldListLoop);
|
|
@@ -23,6 +23,7 @@ class ClassDefinitionTranspiler {
|
|
|
23
23
|
return new chunk_1.Chunk(`
|
|
24
24
|
class ${className === null || className === void 0 ? void 0 : className.toLowerCase()} {
|
|
25
25
|
static INTERNAL_TYPE = 'CLAS';
|
|
26
|
+
static ATTRIBUTES = {};
|
|
26
27
|
async constructor_() {
|
|
27
28
|
this.me = new abap.types.ABAPObject();
|
|
28
29
|
this.me.set(this);
|
|
@@ -4,6 +4,7 @@ import { Traversal } from "../traversal";
|
|
|
4
4
|
import { Chunk } from "../chunk";
|
|
5
5
|
export declare class InterfaceTranspiler implements IStructureTranspiler {
|
|
6
6
|
transpile(node: abaplint.Nodes.StructureNode, traversal: Traversal): Chunk;
|
|
7
|
+
private buildAttributes;
|
|
7
8
|
private buildTypes;
|
|
8
9
|
private buildConstants;
|
|
9
10
|
}
|
|
@@ -18,6 +18,7 @@ class InterfaceTranspiler {
|
|
|
18
18
|
name = traversal_1.Traversal.escapeNamespace(name);
|
|
19
19
|
ret += `class ${name} {\n`;
|
|
20
20
|
ret += `static INTERNAL_TYPE = 'INTF';\n`;
|
|
21
|
+
ret += `static ATTRIBUTES = {${this.buildAttributes(def)}};\n`;
|
|
21
22
|
}
|
|
22
23
|
else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
|
|
23
24
|
ret += "}\n";
|
|
@@ -28,6 +29,18 @@ class InterfaceTranspiler {
|
|
|
28
29
|
ret += this.buildTypes(def);
|
|
29
30
|
return new chunk_1.Chunk(ret);
|
|
30
31
|
}
|
|
32
|
+
buildAttributes(idef) {
|
|
33
|
+
const attr = [];
|
|
34
|
+
for (const a of (idef === null || idef === void 0 ? void 0 : idef.getAttributes().getAll()) || []) {
|
|
35
|
+
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
36
|
+
attr.push(`"${a.getName().toUpperCase()}": {"type": ${type}, "visibility": "U", "is_constant": " "}`);
|
|
37
|
+
}
|
|
38
|
+
for (const a of (idef === null || idef === void 0 ? void 0 : idef.getAttributes().getConstants()) || []) {
|
|
39
|
+
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
40
|
+
attr.push(`"${a.getName().toUpperCase()}": {"type": ${type}, "visibility": "U", "is_constant": "X"}`);
|
|
41
|
+
}
|
|
42
|
+
return attr.join(",\n");
|
|
43
|
+
}
|
|
31
44
|
buildTypes(idef) {
|
|
32
45
|
if (idef === undefined) {
|
|
33
46
|
return "";
|