@abaplint/transpiler 2.5.65 → 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.
|
@@ -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) {
|
|
@@ -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 "";
|