@abaplint/runtime 2.1.88 → 2.1.90
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { String } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function concat(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): String;
|
|
4
|
+
export declare function concat(left: INumeric | ICharacter | string | number | any[], right: INumeric | ICharacter | string | number): String;
|
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.concat = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function concat(left, right) {
|
|
6
|
+
if (Array.isArray(left)) {
|
|
7
|
+
// used in ampersand concatenation
|
|
8
|
+
let res = concat(left[0], left[1]);
|
|
9
|
+
for (let i = 2; i < left.length; i++) {
|
|
10
|
+
res = concat(res, left[i]);
|
|
11
|
+
}
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
6
14
|
let val = "";
|
|
7
15
|
if (typeof left === "string" || typeof left === "number") {
|
|
8
16
|
val += left;
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cast = void 0;
|
|
4
4
|
const compare_1 = require("../compare");
|
|
5
|
+
function throwError() {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
if (abap.Classes["CX_SY_MOVE_CAST_ERROR"] !== undefined) {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
throw new abap.Classes["CX_SY_MOVE_CAST_ERROR"]();
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
throw "Global class CX_SY_MOVE_CAST_ERROR not found";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
5
15
|
// todo, field symbols as input?
|
|
6
16
|
// todo, local classes?
|
|
7
17
|
// check with javascript instanceof?
|
|
@@ -13,30 +23,35 @@ async function cast(target, source) {
|
|
|
13
23
|
return;
|
|
14
24
|
}
|
|
15
25
|
// eslint-disable-next-line prefer-const
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
throw "Global class CX_SY_MOVE_CAST_ERROR not found";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
26
|
+
let checkIntf = true;
|
|
27
|
+
const targetName = (_a = target.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
const targetClass = abap.Classes[targetName];
|
|
30
|
+
/*
|
|
31
|
+
if (targetName?.startsWith("IF_") === false
|
|
32
|
+
&& targetName?.startsWith("ZIF_") === false) { // todo, interfaces are also classes but not inherited
|
|
33
|
+
*/
|
|
34
|
+
if ((targetClass === null || targetClass === void 0 ? void 0 : targetClass.INTERNAL_TYPE) === "CLAS") {
|
|
35
|
+
// using "instanceof" is probably wrong in some cases,
|
|
36
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
|
|
37
|
+
if (source.get() instanceof targetClass === false) {
|
|
38
|
+
throwError();
|
|
34
39
|
}
|
|
35
|
-
target.set(source);
|
|
36
40
|
}
|
|
37
|
-
else {
|
|
38
|
-
|
|
41
|
+
else if (checkIntf === true && (targetClass === null || targetClass === void 0 ? void 0 : targetClass.INTERNAL_TYPE) === "INTF") {
|
|
42
|
+
const list = [...source.get().IMPLEMENTED_INTERFACES];
|
|
43
|
+
let sup = source.get().super;
|
|
44
|
+
while (sup !== undefined) {
|
|
45
|
+
list.push(...sup.get().IMPLEMENTED_INTERFACES);
|
|
46
|
+
sup = sup.get().super;
|
|
47
|
+
}
|
|
48
|
+
// todo: ammend list with interfaces implemented by interfaces
|
|
49
|
+
const isImplemented = list.some(i => i === targetName);
|
|
50
|
+
if (isImplemented === false) {
|
|
51
|
+
throwError();
|
|
52
|
+
}
|
|
39
53
|
}
|
|
54
|
+
target.set(source);
|
|
40
55
|
}
|
|
41
56
|
exports.cast = cast;
|
|
42
57
|
//# sourceMappingURL=cast.js.map
|