@abaplint/runtime 2.5.43 → 2.5.44
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.
|
@@ -13,7 +13,6 @@ const compare_1 = require("../compare");
|
|
|
13
13
|
const loop_1 = require("./loop");
|
|
14
14
|
async function deleteInternal(target, options) {
|
|
15
15
|
var _a, e_1, _b, _c;
|
|
16
|
-
let prev = undefined;
|
|
17
16
|
let index = 0;
|
|
18
17
|
if (target instanceof types_1.FieldSymbol) {
|
|
19
18
|
target = target.getPointer();
|
|
@@ -48,6 +47,29 @@ async function deleteInternal(target, options) {
|
|
|
48
47
|
}
|
|
49
48
|
return;
|
|
50
49
|
}
|
|
50
|
+
if ((options === null || options === void 0 ? void 0 : options.adjacent) === true) {
|
|
51
|
+
const array = target.array();
|
|
52
|
+
for (let index = array.length - 1; index > 0; index--) {
|
|
53
|
+
const prev = array[index - 1];
|
|
54
|
+
const i = array[index];
|
|
55
|
+
if (options === null || options === void 0 ? void 0 : options.comparing) {
|
|
56
|
+
let match = false;
|
|
57
|
+
for (const compareField of options.comparing) {
|
|
58
|
+
match = (0, compare_1.eq)(prev.get()[compareField], i.get()[compareField]);
|
|
59
|
+
if (!match) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (match) {
|
|
64
|
+
target.deleteIndex(index);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if ((0, compare_1.eq)(prev, i) === true) {
|
|
68
|
+
target.deleteIndex(index);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
51
73
|
try {
|
|
52
74
|
for (var _d = true, _e = __asyncValues((0, loop_1.loop)(target)), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
53
75
|
_c = _f.value;
|
|
@@ -62,23 +84,6 @@ async function deleteInternal(target, options) {
|
|
|
62
84
|
target.deleteIndex(index);
|
|
63
85
|
}
|
|
64
86
|
}
|
|
65
|
-
else if ((options === null || options === void 0 ? void 0 : options.adjacent) === true && prev !== undefined) {
|
|
66
|
-
if (options === null || options === void 0 ? void 0 : options.comparing) {
|
|
67
|
-
let match = false;
|
|
68
|
-
for (const compareField of options.comparing) {
|
|
69
|
-
match = (0, compare_1.eq)(prev.get()[compareField], i.get()[compareField]);
|
|
70
|
-
if (!match) {
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (match) {
|
|
75
|
-
target.deleteIndex(index);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else if ((0, compare_1.eq)(prev, i) === true) {
|
|
79
|
-
target.deleteIndex(index);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
87
|
else if ((options === null || options === void 0 ? void 0 : options.index) && options.index.get() === index) {
|
|
83
88
|
target.deleteIndex(options.index.get() - 1);
|
|
84
89
|
}
|
|
@@ -88,7 +93,6 @@ async function deleteInternal(target, options) {
|
|
|
88
93
|
else if ((options === null || options === void 0 ? void 0 : options.from) && options.from.get() <= index + 1) {
|
|
89
94
|
target.deleteIndex(index);
|
|
90
95
|
}
|
|
91
|
-
prev = i;
|
|
92
96
|
}
|
|
93
97
|
finally {
|
|
94
98
|
_d = true;
|