@abaplint/transpiler 2.6.19 → 2.6.21
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/traversal.js +24 -3
- package/package.json +1 -1
package/build/src/traversal.js
CHANGED
|
@@ -172,14 +172,35 @@ class Traversal {
|
|
|
172
172
|
buildAttributes(def) {
|
|
173
173
|
var _a, _b;
|
|
174
174
|
const attr = [];
|
|
175
|
-
// TODO: visibility is wrong for classes
|
|
176
175
|
for (const a of ((_a = def === null || def === void 0 ? void 0 : def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
|
|
177
176
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
178
|
-
|
|
177
|
+
let runtime = "";
|
|
178
|
+
switch (a.getVisibility()) {
|
|
179
|
+
case abaplint.Visibility.Private:
|
|
180
|
+
runtime = "I";
|
|
181
|
+
break;
|
|
182
|
+
case abaplint.Visibility.Protected:
|
|
183
|
+
runtime = "O";
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
runtime = "U";
|
|
187
|
+
}
|
|
188
|
+
attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " "}`);
|
|
179
189
|
}
|
|
180
190
|
for (const a of ((_b = def === null || def === void 0 ? void 0 : def.getAttributes()) === null || _b === void 0 ? void 0 : _b.getConstants()) || []) {
|
|
181
191
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
182
|
-
|
|
192
|
+
let runtime = "";
|
|
193
|
+
switch (a.getVisibility()) {
|
|
194
|
+
case abaplint.Visibility.Private:
|
|
195
|
+
runtime = "I";
|
|
196
|
+
break;
|
|
197
|
+
case abaplint.Visibility.Protected:
|
|
198
|
+
runtime = "O";
|
|
199
|
+
break;
|
|
200
|
+
default:
|
|
201
|
+
runtime = "U";
|
|
202
|
+
}
|
|
203
|
+
attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X"}`);
|
|
183
204
|
}
|
|
184
205
|
return attr.join(",\n");
|
|
185
206
|
}
|