@abaplint/transpiler 2.10.43 → 2.10.45
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.
|
@@ -22,7 +22,7 @@ class ClassImplementationTranspiler {
|
|
|
22
22
|
static INTERNAL_TYPE = 'CLAS';
|
|
23
23
|
static INTERNAL_NAME = '${traversal.buildInternalName(token.getStr(), def)}';
|
|
24
24
|
static IMPLEMENTED_INTERFACES = [${this.findImplementedByClass(traversal, def, scope).map(e => `"` + e.toUpperCase() + `"`).join(",")}];
|
|
25
|
-
static ATTRIBUTES = {${traversal.buildAttributes(def, scope).join(",\n")}};
|
|
25
|
+
static ATTRIBUTES = {${Array.from(traversal.buildAttributes(def, scope)).join(",\n")}};
|
|
26
26
|
static METHODS = {${traversal.buildMethods(def, scope).join(",\n")}};`, node, traversal);
|
|
27
27
|
}
|
|
28
28
|
findImplementedInterface(traversal, def, scope) {
|
|
@@ -18,7 +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 = {${traversal.buildAttributes(def, scope).join(",\n")}};\n`;
|
|
21
|
+
ret += `static ATTRIBUTES = {${Array.from(traversal.buildAttributes(def, scope)).join(",\n")}};\n`;
|
|
22
22
|
ret += `static METHODS = {${traversal.buildMethods(def, scope).join(",\n")}};\n`;
|
|
23
23
|
}
|
|
24
24
|
else if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.EndInterface) {
|
package/build/src/traversal.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class Traversal {
|
|
|
28
28
|
private isStaticClassAttribute;
|
|
29
29
|
buildMethods(def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined, _scope: abaplint.ISpaghettiScopeNode | undefined): string[];
|
|
30
30
|
private mapVisibility;
|
|
31
|
-
buildAttributes(def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined, scope: abaplint.ISpaghettiScopeNode | undefined, prefix?: string): string
|
|
31
|
+
buildAttributes(def: abaplint.IClassDefinition | abaplint.IInterfaceDefinition | undefined, scope: abaplint.ISpaghettiScopeNode | undefined, prefix?: string): Set<string>;
|
|
32
32
|
isBuiltinMethod(token: abaplint.Token): boolean;
|
|
33
33
|
isSQLConversion(token: abaplint.Token): string | undefined;
|
|
34
34
|
findMethodReference(token: abaplint.Token, scope: ISpaghettiScopeNode | undefined): undefined | {
|
package/build/src/traversal.js
CHANGED
|
@@ -226,7 +226,8 @@ class Traversal {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
buildAttributes(def, scope, prefix = "") {
|
|
229
|
-
|
|
229
|
+
// using a Set to avoid duplicates from nested identical interfaces
|
|
230
|
+
const attr = new Set();
|
|
230
231
|
if (def === undefined) {
|
|
231
232
|
return attr;
|
|
232
233
|
}
|
|
@@ -234,7 +235,7 @@ class Traversal {
|
|
|
234
235
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
235
236
|
const runtime = this.mapVisibility(a.getVisibility());
|
|
236
237
|
const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
|
|
237
|
-
attr.
|
|
238
|
+
attr.add(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
|
|
238
239
|
}
|
|
239
240
|
for (const a of def.getAttributes()?.getConstants() || []) {
|
|
240
241
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
@@ -249,11 +250,11 @@ class Traversal {
|
|
|
249
250
|
default:
|
|
250
251
|
runtime = "U";
|
|
251
252
|
}
|
|
252
|
-
attr.
|
|
253
|
+
attr.add(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X", "is_class": "X"}`);
|
|
253
254
|
}
|
|
254
255
|
for (const impl of def.getImplementing()) {
|
|
255
256
|
const idef = this.findInterfaceDefinition(impl.name, scope);
|
|
256
|
-
|
|
257
|
+
this.buildAttributes(idef, scope, impl.name.toUpperCase() + "~").forEach(a => attr.add(a));
|
|
257
258
|
}
|
|
258
259
|
return attr;
|
|
259
260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.45",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "abaplint",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@abaplint/core": "^2.113.
|
|
32
|
+
"@abaplint/core": "^2.113.110",
|
|
33
33
|
"source-map": "^0.7.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|