@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.
@@ -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
- attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "U", "is_constant": " "}`);
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
- attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "U", "is_constant": "X"}`);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.6.19",
3
+ "version": "2.6.21",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",