@abaplint/cli 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.
Files changed (2) hide show
  1. package/build/cli.js +13 -6
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -39053,7 +39053,7 @@ class CreateObject {
39053
39053
  this.validateParameters(cdef, node, input);
39054
39054
  }
39055
39055
  static checkInstantiationAllowed(cdef, input) {
39056
- var _a, _b, _c, _d;
39056
+ var _a, _b, _c;
39057
39057
  const createVis = cdef.getCreateVisibility();
39058
39058
  if (createVis === visibility_1.Visibility.Public) {
39059
39059
  return undefined;
@@ -39070,23 +39070,30 @@ class CreateObject {
39070
39070
  input.scope.isLocalFriend(cdef.getName(), enclosingClass)) {
39071
39071
  return undefined;
39072
39072
  }
39073
+ const enclosingDefinition = input.scope.findClassDefinition(enclosingClass);
39074
+ if (enclosingDefinition !== undefined) {
39075
+ const implementedInterfaces = new _object_oriented_1.ObjectOriented(input.scope).findInterfaces(enclosingDefinition);
39076
+ if (cdef.getFriends().some(friend => implementedInterfaces.some(implemented => implemented.name.toUpperCase() === friend.toUpperCase()))) {
39077
+ return undefined;
39078
+ }
39079
+ }
39073
39080
  // subclasses of friends also have friendship
39074
- let enclosingSup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
39081
+ let enclosingSup = enclosingDefinition === null || enclosingDefinition === void 0 ? void 0 : enclosingDefinition.getSuperClass();
39075
39082
  while (enclosingSup !== undefined) {
39076
39083
  if (cdef.getFriends().some(f => f.toUpperCase() === enclosingSup.toUpperCase()) ||
39077
39084
  input.scope.isLocalFriend(cdef.getName(), enclosingSup)) {
39078
39085
  return undefined;
39079
39086
  }
39080
- enclosingSup = (_b = input.scope.findClassDefinition(enclosingSup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
39087
+ enclosingSup = (_a = input.scope.findClassDefinition(enclosingSup)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
39081
39088
  }
39082
39089
  if (createVis === visibility_1.Visibility.Protected) {
39083
39090
  // subclasses are also allowed
39084
- let sup = (_c = input.scope.findClassDefinition(enclosingClass)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
39091
+ let sup = (_b = input.scope.findClassDefinition(enclosingClass)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
39085
39092
  while (sup !== undefined) {
39086
39093
  if (sup.toUpperCase() === cdef.getName().toUpperCase()) {
39087
39094
  return undefined;
39088
39095
  }
39089
- sup = (_d = input.scope.findClassDefinition(sup)) === null || _d === void 0 ? void 0 : _d.getSuperClass();
39096
+ sup = (_c = input.scope.findClassDefinition(sup)) === null || _c === void 0 ? void 0 : _c.getSuperClass();
39090
39097
  }
39091
39098
  }
39092
39099
  return cdef.getName() + " cannot be instantiated, class is defined as " +
@@ -69661,7 +69668,7 @@ class Registry {
69661
69668
  }
69662
69669
  static abaplintVersion() {
69663
69670
  // magic, see build script "version.js"
69664
- return "2.120.21";
69671
+ return "2.120.22";
69665
69672
  }
69666
69673
  getDDICReferences() {
69667
69674
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.21",
3
+ "version": "2.120.22",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.21",
42
+ "@abaplint/core": "^2.120.22",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",