@abaplint/core 2.97.9 → 2.97.10
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.
package/build/abaplint.d.ts
CHANGED
|
@@ -1286,7 +1286,7 @@ export declare class CurrentScope {
|
|
|
1286
1286
|
findTypePoolConstant(name: string | undefined): TypedIdentifier | undefined;
|
|
1287
1287
|
findTypePoolType(name: string): TypedIdentifier | undefined;
|
|
1288
1288
|
/** Lookup interface in local and global scope */
|
|
1289
|
-
findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
|
|
1289
|
+
findInterfaceDefinition(name: string | undefined): IInterfaceDefinition | undefined;
|
|
1290
1290
|
findFormDefinition(name: string): IFormDefinition | undefined;
|
|
1291
1291
|
findType(name: string | undefined): TypedIdentifier | undefined;
|
|
1292
1292
|
findExtraLikeType(name: string | undefined): TypedIdentifier | undefined;
|
|
@@ -251,6 +251,9 @@ class CurrentScope {
|
|
|
251
251
|
/** Lookup interface in local and global scope */
|
|
252
252
|
findInterfaceDefinition(name) {
|
|
253
253
|
var _a;
|
|
254
|
+
if (name === undefined) {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
254
257
|
const ilocal = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findInterfaceDefinition(name);
|
|
255
258
|
if (ilocal) {
|
|
256
259
|
return ilocal;
|
|
@@ -190,6 +190,14 @@ class TypeUtils {
|
|
|
190
190
|
// todo
|
|
191
191
|
return true;
|
|
192
192
|
}
|
|
193
|
+
structureContainsString(structure) {
|
|
194
|
+
for (const c of structure.getComponents()) {
|
|
195
|
+
if (c.type instanceof basic_1.StringType) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
193
201
|
isAssignableStrict(source, target) {
|
|
194
202
|
var _a;
|
|
195
203
|
/*
|
|
@@ -203,10 +211,8 @@ class TypeUtils {
|
|
|
203
211
|
return source.getLength() === target.getLength();
|
|
204
212
|
}
|
|
205
213
|
else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
214
|
+
if (this.structureContainsString(target)) {
|
|
215
|
+
return false;
|
|
210
216
|
}
|
|
211
217
|
return true;
|
|
212
218
|
}
|
|
@@ -258,12 +264,17 @@ class TypeUtils {
|
|
|
258
264
|
if (source instanceof basic_1.TableType && source.isWithHeader()) {
|
|
259
265
|
return this.isAssignable(source.getRowType(), target);
|
|
260
266
|
}
|
|
261
|
-
else if (source instanceof basic_1.
|
|
262
|
-
|| source instanceof basic_1.VoidType
|
|
267
|
+
else if (source instanceof basic_1.VoidType
|
|
263
268
|
|| source instanceof basic_1.AnyType
|
|
264
269
|
|| source instanceof basic_1.UnknownType) {
|
|
265
270
|
return true;
|
|
266
271
|
}
|
|
272
|
+
else if (source instanceof basic_1.StructureType) {
|
|
273
|
+
if (this.structureContainsString(target) && !this.structureContainsString(source)) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
267
278
|
else if (target.containsVoid() === true) {
|
|
268
279
|
return true;
|
|
269
280
|
}
|
|
@@ -59,6 +59,11 @@ class CreateObject {
|
|
|
59
59
|
if (id instanceof types_1.InterfaceDefinition && type === undefined) {
|
|
60
60
|
throw new Error("Interface reference, cannot be instantiated");
|
|
61
61
|
}
|
|
62
|
+
else if (found instanceof basic_1.ObjectReferenceType
|
|
63
|
+
&& type === undefined
|
|
64
|
+
&& scope.findInterfaceDefinition(found.getQualifiedName())) {
|
|
65
|
+
throw new Error("Interface reference, cannot be instantiated");
|
|
66
|
+
}
|
|
62
67
|
else if (id instanceof types_1.ClassDefinition && cdef === undefined) {
|
|
63
68
|
cdef = id;
|
|
64
69
|
}
|
package/build/src/registry.js
CHANGED