@abaplint/core 2.120.21 → 2.120.22

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.
@@ -151,7 +151,7 @@ class CreateObject {
151
151
  this.validateParameters(cdef, node, input);
152
152
  }
153
153
  static checkInstantiationAllowed(cdef, input) {
154
- var _a, _b, _c, _d;
154
+ var _a, _b, _c;
155
155
  const createVis = cdef.getCreateVisibility();
156
156
  if (createVis === visibility_1.Visibility.Public) {
157
157
  return undefined;
@@ -168,23 +168,30 @@ class CreateObject {
168
168
  input.scope.isLocalFriend(cdef.getName(), enclosingClass)) {
169
169
  return undefined;
170
170
  }
171
+ const enclosingDefinition = input.scope.findClassDefinition(enclosingClass);
172
+ if (enclosingDefinition !== undefined) {
173
+ const implementedInterfaces = new _object_oriented_1.ObjectOriented(input.scope).findInterfaces(enclosingDefinition);
174
+ if (cdef.getFriends().some(friend => implementedInterfaces.some(implemented => implemented.name.toUpperCase() === friend.toUpperCase()))) {
175
+ return undefined;
176
+ }
177
+ }
171
178
  // subclasses of friends also have friendship
172
- let enclosingSup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
179
+ let enclosingSup = enclosingDefinition === null || enclosingDefinition === void 0 ? void 0 : enclosingDefinition.getSuperClass();
173
180
  while (enclosingSup !== undefined) {
174
181
  if (cdef.getFriends().some(f => f.toUpperCase() === enclosingSup.toUpperCase()) ||
175
182
  input.scope.isLocalFriend(cdef.getName(), enclosingSup)) {
176
183
  return undefined;
177
184
  }
178
- enclosingSup = (_b = input.scope.findClassDefinition(enclosingSup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
185
+ enclosingSup = (_a = input.scope.findClassDefinition(enclosingSup)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
179
186
  }
180
187
  if (createVis === visibility_1.Visibility.Protected) {
181
188
  // subclasses are also allowed
182
- let sup = (_c = input.scope.findClassDefinition(enclosingClass)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
189
+ let sup = (_b = input.scope.findClassDefinition(enclosingClass)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
183
190
  while (sup !== undefined) {
184
191
  if (sup.toUpperCase() === cdef.getName().toUpperCase()) {
185
192
  return undefined;
186
193
  }
187
- sup = (_d = input.scope.findClassDefinition(sup)) === null || _d === void 0 ? void 0 : _d.getSuperClass();
194
+ sup = (_c = input.scope.findClassDefinition(sup)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
188
195
  }
189
196
  }
190
197
  return cdef.getName() + " cannot be instantiated, class is defined as " +
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.21";
78
+ return "2.120.22";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.21",
3
+ "version": "2.120.22",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",