@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 = (
|
|
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 = (
|
|
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 " +
|
package/build/src/registry.js
CHANGED