@abaplint/core 2.120.20 → 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.
@@ -1264,6 +1264,7 @@ declare class ClassDefinition_3 extends Identifier implements IClassDefinition {
1264
1264
  private checkInterfaceVisibility;
1265
1265
  private checkMethodsFromSuperClasses;
1266
1266
  private checkMethodNameConflicts;
1267
+ private checkEventNameConflicts;
1267
1268
  private findFriends;
1268
1269
  private addReference;
1269
1270
  private parse;
@@ -23,11 +23,12 @@ class ModifyEntities {
23
23
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
24
24
  const end = (0, combi_1.optPrio)((0, combi_1.per)(failed, result, mapped, reported));
25
25
  const entities = (0, combi_1.seq)((0, combi_1.optPrio)("AUGMENTING"), "ENTITIES OF", expressions_1.NamespaceSimpleName, (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.plusPrio)((0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(operation))));
26
+ const dynamic = (0, combi_1.seq)("ENTITIES", (0, combi_1.optPrio)((0, combi_1.altPrio)("IN LOCAL MODE", (0, combi_1.seq)((0, combi_1.opt)("FORWARDING"), "PRIVILEGED"))), "OPERATIONS", expressions_1.Source);
26
27
  const create2 = (0, combi_1.seq)("CREATE", fieldsWith, (0, combi_1.opt)((0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, fieldsWith)));
27
28
  const create3 = (0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, fieldsWith);
28
29
  const create4 = (0, combi_1.seq)("CREATE FROM", expressions_1.Source, (0, combi_1.plus)((0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, "FROM", expressions_1.Source)));
29
30
  const entity = (0, combi_1.seq)("ENTITY", (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.alt)(execute, create, updateFields, deleteFrom, updateSetFields, updateFrom, create2, create3, create4));
30
- return (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, entity), end), { also: combi_1.AlsoIn.OpenABAP });
31
+ return (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, dynamic, entity), end), { also: combi_1.AlsoIn.OpenABAP });
31
32
  }
32
33
  }
33
34
  exports.ModifyEntities = ModifyEntities;
@@ -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 " +
@@ -98,6 +98,7 @@ class ClassDefinition extends _identifier_1.Identifier {
98
98
  this.checkInterfaceVisibility(input, node);
99
99
  this.checkMethodsFromSuperClasses(input);
100
100
  this.checkMethodNameConflicts(input);
101
+ this.checkEventNameConflicts(input);
101
102
  this.checkClassNameLength(input);
102
103
  this.checkMethodNameLength(input);
103
104
  this.checkClassConstructorStatic(input);
@@ -237,6 +238,15 @@ class ClassDefinition extends _identifier_1.Identifier {
237
238
  }
238
239
  }
239
240
  }
241
+ checkEventNameConflicts(input) {
242
+ for (const e of this.events) {
243
+ if (this.attributes.findByName(e.getName()) !== undefined
244
+ || this.types.getByName(e.getName()) !== undefined
245
+ || this.methodDefs.getByName(e.getName()) !== undefined) {
246
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, e.getToken(), `"${e.getName()}" already defined`));
247
+ }
248
+ }
249
+ }
240
250
  findFriends(def, input) {
241
251
  var _a;
242
252
  const result = [];
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.20";
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.20",
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",