@abaplint/core 2.97.10 → 2.97.12
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.
|
@@ -199,16 +199,24 @@ class TypeUtils {
|
|
|
199
199
|
return false;
|
|
200
200
|
}
|
|
201
201
|
isAssignableStrict(source, target) {
|
|
202
|
-
var _a;
|
|
202
|
+
var _a, _b;
|
|
203
203
|
/*
|
|
204
204
|
console.dir(source);
|
|
205
205
|
console.dir(target);
|
|
206
206
|
*/
|
|
207
|
-
if (source instanceof basic_1.CharacterType
|
|
208
|
-
if (
|
|
209
|
-
|
|
207
|
+
if (source instanceof basic_1.CharacterType) {
|
|
208
|
+
if (target instanceof basic_1.CharacterType) {
|
|
209
|
+
if (((_a = source.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) === true) {
|
|
210
|
+
return source.getLength() <= target.getLength();
|
|
211
|
+
}
|
|
212
|
+
return source.getLength() === target.getLength();
|
|
213
|
+
}
|
|
214
|
+
else if (target instanceof basic_1.IntegerType) {
|
|
215
|
+
if (((_b = source.getAbstractTypeData()) === null || _b === void 0 ? void 0 : _b.derivedFromConstant) === true) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
210
219
|
}
|
|
211
|
-
return source.getLength() === target.getLength();
|
|
212
220
|
}
|
|
213
221
|
else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
|
|
214
222
|
if (this.structureContainsString(target)) {
|
|
@@ -216,6 +224,19 @@ class TypeUtils {
|
|
|
216
224
|
}
|
|
217
225
|
return true;
|
|
218
226
|
}
|
|
227
|
+
else if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
|
|
228
|
+
const sourceComponents = source.getComponents();
|
|
229
|
+
const targetComponents = target.getComponents();
|
|
230
|
+
if (sourceComponents.length !== targetComponents.length) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
for (let i = 0; i < sourceComponents.length; i++) {
|
|
234
|
+
if (this.isAssignableStrict(sourceComponents[i].type, targetComponents[i].type) === false) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
219
240
|
return this.isAssignable(source, target);
|
|
220
241
|
}
|
|
221
242
|
isAssignable(source, target) {
|
|
@@ -233,7 +254,31 @@ class TypeUtils {
|
|
|
233
254
|
return true;
|
|
234
255
|
}
|
|
235
256
|
else if (source instanceof basic_1.TableType) {
|
|
236
|
-
|
|
257
|
+
const targetRowType = target.getRowType();
|
|
258
|
+
const sourceRowType = source.getRowType();
|
|
259
|
+
if (targetRowType instanceof basic_1.VoidType || targetRowType instanceof basic_1.AnyType || targetRowType instanceof basic_1.UnknownType) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
else if (sourceRowType instanceof basic_1.VoidType || sourceRowType instanceof basic_1.AnyType || sourceRowType instanceof basic_1.UnknownType) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
if (targetRowType instanceof basic_1.StructureType && this.structureContainsString(targetRowType)) {
|
|
266
|
+
if (!(sourceRowType instanceof basic_1.StructureType)) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
else if (!(this.structureContainsString(sourceRowType))) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (sourceRowType instanceof basic_1.StructureType && this.structureContainsString(sourceRowType)) {
|
|
274
|
+
if (!(targetRowType instanceof basic_1.StructureType)) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
else if (!(this.structureContainsString(targetRowType))) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return true;
|
|
237
282
|
}
|
|
238
283
|
return false;
|
|
239
284
|
}
|
package/build/src/registry.js
CHANGED