@abaplint/runtime 2.5.14 → 2.5.16
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.
|
@@ -24,7 +24,12 @@ async function cast(target, source) {
|
|
|
24
24
|
targetName = (_a = target.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
25
25
|
}
|
|
26
26
|
// @ts-ignore
|
|
27
|
-
|
|
27
|
+
let targetClass = abap.Classes[targetName];
|
|
28
|
+
if (targetClass === undefined) {
|
|
29
|
+
// todo, for unit testing,
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
targetClass = abap.Classes["PROG-ZFOOBAR-" + targetName];
|
|
32
|
+
}
|
|
28
33
|
if ((targetClass === null || targetClass === void 0 ? void 0 : targetClass.INTERNAL_TYPE) === "CLAS") {
|
|
29
34
|
// using "instanceof" is probably wrong in some cases,
|
|
30
35
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
|
|
@@ -33,27 +38,7 @@ async function cast(target, source) {
|
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
else if (checkIntf === true && (targetClass === null || targetClass === void 0 ? void 0 : targetClass.INTERNAL_TYPE) === "INTF") {
|
|
36
|
-
const list =
|
|
37
|
-
// interfaces implemented in super classes
|
|
38
|
-
let sup = source.get().super;
|
|
39
|
-
while (sup !== undefined) {
|
|
40
|
-
list.push(...sup.get().constructor.IMPLEMENTED_INTERFACES);
|
|
41
|
-
sup = sup.get().super;
|
|
42
|
-
}
|
|
43
|
-
// interfaces implemented by interfaces
|
|
44
|
-
const visit = new Set(list);
|
|
45
|
-
while (visit.size > 0) {
|
|
46
|
-
const intfName = visit.values().next().value;
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
const intf = abap.Classes[intfName];
|
|
49
|
-
for (const i of (intf === null || intf === void 0 ? void 0 : intf.IMPLEMENTED_INTERFACES) || []) {
|
|
50
|
-
if (visit.has(i) === false) {
|
|
51
|
-
visit.add(i);
|
|
52
|
-
list.push(i);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
visit.delete(intfName);
|
|
56
|
-
}
|
|
41
|
+
const list = source.get().constructor.IMPLEMENTED_INTERFACES;
|
|
57
42
|
const isImplemented = list.some(i => i === targetName);
|
|
58
43
|
if (isImplemented === false) {
|
|
59
44
|
(0, throw_error_1.throwError)("CX_SY_MOVE_CAST_ERROR");
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Context } from "../context";
|
|
2
|
+
import { ABAPObject } from "../types";
|
|
2
3
|
import { ICharacter } from "../types/_character";
|
|
3
4
|
export interface IMessageOptions {
|
|
4
5
|
id?: ICharacter | string;
|
|
5
6
|
number?: ICharacter | string;
|
|
6
7
|
type?: ICharacter | string;
|
|
8
|
+
displayLike?: ICharacter | string;
|
|
9
|
+
exception?: ABAPObject;
|
|
7
10
|
with?: (ICharacter | string)[];
|
|
8
11
|
into?: ICharacter;
|
|
9
12
|
}
|
|
@@ -69,11 +69,21 @@ class MessageStatement {
|
|
|
69
69
|
abap.builtin.sy.get().msgno.set(msgnr);
|
|
70
70
|
// @ts-ignore
|
|
71
71
|
abap.builtin.sy.get().msgty.set(msgty);
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
let replaced = "";
|
|
73
|
+
if (options.exception) {
|
|
74
|
+
replaced = await options.exception.get().if_message$get_text();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const text = await findText(this.context, arbgb, msgnr, msgty);
|
|
78
|
+
replaced = replace(text, options.with);
|
|
79
|
+
}
|
|
74
80
|
if (options.into) {
|
|
75
81
|
options.into.set(replaced);
|
|
76
82
|
}
|
|
83
|
+
else {
|
|
84
|
+
// hmm, add option on how/if to write messages to console? or it should be the abap.console() ?
|
|
85
|
+
console.log(replaced);
|
|
86
|
+
}
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
89
|
exports.MessageStatement = MessageStatement;
|