@abaplint/runtime 1.8.5 → 1.8.6
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.
- package/build/src/compare/eq.js +23 -3
- package/package.json +1 -1
package/build/src/compare/eq.js
CHANGED
|
@@ -2,16 +2,36 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.eq = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function compareTables(left, right) {
|
|
6
|
+
const leftArray = left.array();
|
|
7
|
+
const rightArray = right.array();
|
|
8
|
+
if (leftArray.length !== rightArray.length) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
for (let i = 0; i < leftArray.length; i++) {
|
|
12
|
+
const rowCompare = eq(leftArray[i], rightArray[i]);
|
|
13
|
+
if (rowCompare === false) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
8
16
|
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
function eq(left, right) {
|
|
9
20
|
if (right instanceof types_1.FieldSymbol) {
|
|
10
21
|
return eq(left, right.getPointer());
|
|
11
22
|
}
|
|
12
23
|
else if (left instanceof types_1.FieldSymbol) {
|
|
13
24
|
return eq(left.getPointer(), right);
|
|
14
25
|
}
|
|
26
|
+
if (left instanceof types_1.Table || right instanceof types_1.Table) {
|
|
27
|
+
if (left instanceof types_1.Table && right instanceof types_1.Table) {
|
|
28
|
+
return compareTables(left, right);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// this happens in dynamic/ANY typed scenarios?
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
15
35
|
if (left instanceof types_1.Structure || right instanceof types_1.Structure) {
|
|
16
36
|
if (!(right instanceof types_1.Structure)) {
|
|
17
37
|
return false;
|