@abaplint/runtime 2.0.11 → 2.0.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.
|
@@ -4,8 +4,20 @@ exports.substring_after = void 0;
|
|
|
4
4
|
const string_1 = require("../types/string");
|
|
5
5
|
function substring_after(input) {
|
|
6
6
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
let reg = "";
|
|
8
|
+
if (typeof input.regex === "string") {
|
|
9
|
+
reg = input.regex;
|
|
10
|
+
}
|
|
11
|
+
else if (input === null || input === void 0 ? void 0 : input.regex) {
|
|
12
|
+
reg = input.regex.get();
|
|
13
|
+
}
|
|
14
|
+
else if (typeof input.sub === "string") {
|
|
15
|
+
reg = input.sub;
|
|
16
|
+
}
|
|
17
|
+
else if (input === null || input === void 0 ? void 0 : input.sub) {
|
|
18
|
+
reg = input.sub.get();
|
|
19
|
+
}
|
|
20
|
+
const r = new RegExp(reg + "(.*)");
|
|
9
21
|
const res = val.match(r);
|
|
10
22
|
let ret = "";
|
|
11
23
|
if (res && res[1]) {
|
|
@@ -5,22 +5,26 @@ const compare_1 = require("../compare");
|
|
|
5
5
|
// todo, field symbols as input?
|
|
6
6
|
// todo, local classes?
|
|
7
7
|
async function cast(target, source) {
|
|
8
|
+
var _a;
|
|
8
9
|
if ((0, compare_1.initial)(source)) {
|
|
9
10
|
target.clear();
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
|
-
const targetName = target.getQualifiedName();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const targetName = (_a = target.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
14
|
+
if ((targetName === null || targetName === void 0 ? void 0 : targetName.startsWith("IF_")) === false
|
|
15
|
+
&& (targetName === null || targetName === void 0 ? void 0 : targetName.startsWith("ZIF_")) === false) { // todo, interfaces are also classes but not inherited
|
|
16
|
+
// using "instanceof" is probably wrong in some cases,
|
|
17
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
|
|
17
18
|
// @ts-ignore
|
|
18
|
-
if (abap.Classes[
|
|
19
|
+
if (abap.Classes[targetName] && source instanceof abap.Classes[targetName] === false) {
|
|
19
20
|
// @ts-ignore
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (abap.Classes["CX_SY_MOVE_CAST_ERROR"] !== undefined) {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
throw new abap.Classes["CX_SY_MOVE_CAST_ERROR"]();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
throw "Global class CX_SY_MOVE_CAST_ERROR not found";
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
// throw cx_sy_move_cast_error if incompatible
|