@abaplint/runtime 2.7.150 → 2.7.152
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
CHANGED
|
@@ -41,7 +41,10 @@ function eq(left, right) {
|
|
|
41
41
|
else if (left instanceof types_1.Integer) {
|
|
42
42
|
return (0, types_1.toInteger)(right.get(), false) === left.get();
|
|
43
43
|
}
|
|
44
|
-
else if (left instanceof types_1.String
|
|
44
|
+
else if (left instanceof types_1.String
|
|
45
|
+
|| left instanceof types_1.XString
|
|
46
|
+
|| left instanceof types_1.Numc
|
|
47
|
+
|| left instanceof types_1.Hex) {
|
|
45
48
|
return right.getTrimEnd() === left.get();
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -53,16 +56,24 @@ function eq(left, right) {
|
|
|
53
56
|
return right.get() === left.get();
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
else if (right instanceof types_1.Numc
|
|
57
|
-
|
|
59
|
+
else if (right instanceof types_1.Numc) {
|
|
60
|
+
if (left instanceof types_1.Numc && right.getLength() === left.getLength()) {
|
|
61
|
+
return right.get() === left.get();
|
|
62
|
+
}
|
|
63
|
+
else if (left instanceof types_1.Integer) {
|
|
64
|
+
return left.get() === parseInt(right.get(), 10);
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
else if (right instanceof types_1.Integer) {
|
|
60
|
-
if (left instanceof types_1.Integer) {
|
|
68
|
+
if (left instanceof types_1.Integer || left instanceof types_1.Integer8) {
|
|
61
69
|
return right.get() === left.get();
|
|
62
70
|
}
|
|
63
71
|
else if (left instanceof types_1.Character) {
|
|
64
72
|
return (parseInt(left.get(), 10) || 0) === right.get();
|
|
65
73
|
}
|
|
74
|
+
else if (left instanceof types_1.Numc) {
|
|
75
|
+
return right.get() === parseInt(left.get(), 10);
|
|
76
|
+
}
|
|
66
77
|
}
|
|
67
78
|
else if (right instanceof types_1.DataReference && left instanceof types_1.DataReference) {
|
|
68
79
|
return right.getPointer() === left.getPointer();
|
|
@@ -78,6 +89,31 @@ function eq(left, right) {
|
|
|
78
89
|
return false;
|
|
79
90
|
}
|
|
80
91
|
}
|
|
92
|
+
else if (right instanceof types_1.Hex) {
|
|
93
|
+
if (left instanceof types_1.Hex || left instanceof types_1.XString) {
|
|
94
|
+
return right.get() === left.get();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (right instanceof types_1.XString) {
|
|
98
|
+
if (left instanceof types_1.Hex || left instanceof types_1.XString) {
|
|
99
|
+
return right.get() === left.get();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (right instanceof types_1.ABAPObject) {
|
|
103
|
+
if (left instanceof types_1.ABAPObject) {
|
|
104
|
+
return right.get() === left.get();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else if (right instanceof types_1.Date) {
|
|
108
|
+
if (left instanceof types_1.Date) {
|
|
109
|
+
return right.get() === left.get();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (right instanceof types_1.Packed) {
|
|
113
|
+
if (left instanceof types_1.Packed) {
|
|
114
|
+
return right.get() === left.get();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
81
117
|
if (left instanceof types_1.Structure || right instanceof types_1.Structure) {
|
|
82
118
|
if (!(right instanceof types_1.Structure)) {
|
|
83
119
|
return eq(left.getCharacter(), right);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initial = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
+
const REGEX_ZEROS = /^0+$/;
|
|
6
|
+
const REGEX_SPACES = /^ *$/;
|
|
5
7
|
function initial(val) {
|
|
6
8
|
// todo, refactor? add as method in each type instead?
|
|
7
9
|
if (val instanceof types_1.Table || val instanceof types_1.HashedTable) {
|
|
@@ -14,10 +16,10 @@ function initial(val) {
|
|
|
14
16
|
return val.get() === "00000000";
|
|
15
17
|
}
|
|
16
18
|
else if (val instanceof types_1.Numc) {
|
|
17
|
-
return val.get().match(
|
|
19
|
+
return val.get().match(REGEX_ZEROS) !== null;
|
|
18
20
|
}
|
|
19
21
|
else if (val instanceof types_1.Hex) {
|
|
20
|
-
return val.get().match(
|
|
22
|
+
return val.get().match(REGEX_ZEROS) !== null;
|
|
21
23
|
}
|
|
22
24
|
else if (val instanceof types_1.Time) {
|
|
23
25
|
return val.get() === "000000";
|
|
@@ -26,7 +28,7 @@ function initial(val) {
|
|
|
26
28
|
return val.getRaw() === 0;
|
|
27
29
|
}
|
|
28
30
|
else if (val instanceof types_1.Character) {
|
|
29
|
-
return val.get().match(
|
|
31
|
+
return val.get().match(REGEX_SPACES) !== null;
|
|
30
32
|
}
|
|
31
33
|
else if (val instanceof types_1.FieldSymbol && val.getPointer() === undefined) {
|
|
32
34
|
throw new Error("FS not assigned");
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cast = void 0;
|
|
4
|
-
const compare_1 = require("../compare");
|
|
5
4
|
const throw_error_1 = require("../throw_error");
|
|
6
5
|
const types_1 = require("../types");
|
|
7
6
|
// todo, field symbols as input?
|
|
@@ -10,7 +9,7 @@ const types_1 = require("../types");
|
|
|
10
9
|
// handling interfaces?
|
|
11
10
|
async function cast(target, source) {
|
|
12
11
|
var _a;
|
|
13
|
-
if (
|
|
12
|
+
if (source instanceof types_1.ABAPObject && source.get() === undefined) {
|
|
14
13
|
target.clear();
|
|
15
14
|
return;
|
|
16
15
|
}
|
package/build/src/types/table.js
CHANGED
|
@@ -130,7 +130,7 @@ class HashedTable {
|
|
|
130
130
|
}
|
|
131
131
|
buildHashFromSimple(data) {
|
|
132
132
|
let hash = "";
|
|
133
|
-
const
|
|
133
|
+
const ttyp = this.getRowType();
|
|
134
134
|
for (const k of this.options.primaryKey.keyFields) {
|
|
135
135
|
let val = data[k.toLowerCase()];
|
|
136
136
|
if (val instanceof structure_1.Structure) {
|
|
@@ -139,12 +139,17 @@ class HashedTable {
|
|
|
139
139
|
else {
|
|
140
140
|
// convert to correct type, eg Chars have specific length, or rounding,
|
|
141
141
|
if (k === "TABLE_LINE") {
|
|
142
|
+
const rowType = (0, clone_1.clone)(ttyp);
|
|
143
|
+
rowType.set(val.get());
|
|
144
|
+
val = rowType.get();
|
|
145
|
+
}
|
|
146
|
+
else if (ttyp instanceof structure_1.Structure) {
|
|
147
|
+
const rowType = (0, clone_1.clone)(ttyp.get()[k.toLowerCase()]);
|
|
142
148
|
rowType.set(val.get());
|
|
143
149
|
val = rowType.get();
|
|
144
150
|
}
|
|
145
151
|
else {
|
|
146
|
-
|
|
147
|
-
val = rowType.get()[k.toLowerCase()].get();
|
|
152
|
+
throw new Error("HashedTable, buildHashFromSimple, unexpected type");
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
hash += k + ":" + val + "|";
|