@abaplint/core 2.118.8 → 2.118.9

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.
@@ -118,7 +118,7 @@ class CreateObject {
118
118
  this.validateParameters(cdef, node, input);
119
119
  }
120
120
  static checkInstantiationAllowed(cdef, input) {
121
- var _a, _b;
121
+ var _a, _b, _c, _d;
122
122
  const createVis = cdef.getCreateVisibility();
123
123
  if (createVis === visibility_1.Visibility.Public) {
124
124
  return undefined;
@@ -135,14 +135,23 @@ class CreateObject {
135
135
  input.scope.isLocalFriend(cdef.getName(), enclosingClass)) {
136
136
  return undefined;
137
137
  }
138
+ // subclasses of friends also have friendship
139
+ let enclosingSup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
140
+ while (enclosingSup !== undefined) {
141
+ if (cdef.getFriends().some(f => f.toUpperCase() === enclosingSup.toUpperCase()) ||
142
+ input.scope.isLocalFriend(cdef.getName(), enclosingSup)) {
143
+ return undefined;
144
+ }
145
+ enclosingSup = (_b = input.scope.findClassDefinition(enclosingSup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
146
+ }
138
147
  if (createVis === visibility_1.Visibility.Protected) {
139
148
  // subclasses are also allowed
140
- let sup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
149
+ let sup = (_c = input.scope.findClassDefinition(enclosingClass)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
141
150
  while (sup !== undefined) {
142
151
  if (sup.toUpperCase() === cdef.getName().toUpperCase()) {
143
152
  return undefined;
144
153
  }
145
- sup = (_b = input.scope.findClassDefinition(sup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
154
+ sup = (_d = input.scope.findClassDefinition(sup)) === null || _d === void 0 ? void 0 : _d.getSuperClass();
146
155
  }
147
156
  }
148
157
  return cdef.getName() + " cannot be instantiated, class is defined as " +
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.sh"
77
- return "2.118.8";
77
+ return "2.118.9";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.118.8",
3
+ "version": "2.118.9",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",