@abaplint/runtime 2.0.65 → 2.0.68
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/initial.js +3 -0
- package/build/src/operators/_parse.js +9 -1
- package/build/src/operators/div.js +4 -1
- package/build/src/statements/create_data.d.ts +1 -0
- package/build/src/statements/create_data.js +6 -0
- package/build/src/types/hex.js +7 -12
- package/build/src/types/integer.js +9 -1
- package/package.json +1 -1
|
@@ -16,6 +16,9 @@ function initial(val) {
|
|
|
16
16
|
else if (val instanceof types_1.Numc) {
|
|
17
17
|
return val.get().match(/^0+$/) !== null;
|
|
18
18
|
}
|
|
19
|
+
else if (val instanceof types_1.Hex) {
|
|
20
|
+
return val.get().match(/^0+$/) !== null;
|
|
21
|
+
}
|
|
19
22
|
else if (val instanceof types_1.Time) {
|
|
20
23
|
return val.get() === "000000";
|
|
21
24
|
}
|
|
@@ -17,7 +17,15 @@ function parse(val) {
|
|
|
17
17
|
if (val.get() === "") {
|
|
18
18
|
return 0;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
let num = parseInt(val.get(), 16);
|
|
21
|
+
// handle two complement,
|
|
22
|
+
if (val instanceof types_1.Hex && val.getLength() >= 4) {
|
|
23
|
+
const maxVal = Math.pow(2, val.get().length / 2 * 8);
|
|
24
|
+
if (num > maxVal / 2 - 1) {
|
|
25
|
+
num = num - maxVal;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return num;
|
|
21
29
|
}
|
|
22
30
|
else if (val instanceof types_1.Time || val instanceof types_1.Date) {
|
|
23
31
|
return val.getNumeric();
|
|
@@ -4,7 +4,10 @@ exports.div = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function div(left, right) {
|
|
7
|
-
|
|
7
|
+
const l = (0, _parse_1.parse)(left);
|
|
8
|
+
const r = (0, _parse_1.parse)(right);
|
|
9
|
+
const ret = new types_1.Integer().set(Math.floor(l / r));
|
|
10
|
+
return ret;
|
|
8
11
|
}
|
|
9
12
|
exports.div = div;
|
|
10
13
|
//# sourceMappingURL=div.js.map
|
|
@@ -56,6 +56,12 @@ function createData(target, options) {
|
|
|
56
56
|
}
|
|
57
57
|
target.assign((0, clone_1.clone)(options.likeLineOf.getRowType()));
|
|
58
58
|
}
|
|
59
|
+
else if (options === null || options === void 0 ? void 0 : options.like) {
|
|
60
|
+
if (options.like instanceof types_1.FieldSymbol) {
|
|
61
|
+
options.like = options.like.getPointer();
|
|
62
|
+
}
|
|
63
|
+
target.assign((0, clone_1.clone)(options.like));
|
|
64
|
+
}
|
|
59
65
|
else {
|
|
60
66
|
target.assign((0, clone_1.clone)(target.getType()));
|
|
61
67
|
}
|
package/build/src/types/hex.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Hex = void 0;
|
|
4
|
-
const operators_1 = require("../operators");
|
|
5
4
|
const float_1 = require("./float");
|
|
6
5
|
const xstring_1 = require("./xstring");
|
|
7
6
|
class Hex {
|
|
@@ -15,26 +14,22 @@ class Hex {
|
|
|
15
14
|
}
|
|
16
15
|
else if (typeof value === "number") {
|
|
17
16
|
if (value < 0) {
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
|
|
17
|
+
const maxVal = Math.pow(2, this.length * 8);
|
|
18
|
+
this.value = Math.round(value + maxVal).toString(16);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.value = Math.round(value).toString(16);
|
|
21
22
|
}
|
|
22
|
-
this.value = Math.round(value).toString(16);
|
|
23
23
|
this.value = this.value.padStart(this.length * 2, "0");
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
let v = value.get();
|
|
27
27
|
if (value instanceof float_1.Float) {
|
|
28
28
|
v = value.getRaw();
|
|
29
|
-
|
|
30
|
-
this.value = "F".repeat(this.length * 2);
|
|
31
|
-
this.set((0, operators_1.minus)(this, Math.abs(v) - 1));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
29
|
+
this.set(v);
|
|
34
30
|
}
|
|
35
31
|
if (typeof v === "number") {
|
|
36
|
-
this.
|
|
37
|
-
this.value = this.value.padStart(this.length * 2, "0");
|
|
32
|
+
this.set(v);
|
|
38
33
|
}
|
|
39
34
|
else {
|
|
40
35
|
this.value = v;
|
|
@@ -32,7 +32,15 @@ class Integer {
|
|
|
32
32
|
this.set(Math.round(value.getRaw()));
|
|
33
33
|
}
|
|
34
34
|
else if (value instanceof hex_1.Hex || value instanceof xstring_1.XString) {
|
|
35
|
-
|
|
35
|
+
let num = parseInt(value.get(), 16);
|
|
36
|
+
// handle two complement,
|
|
37
|
+
if (value instanceof hex_1.Hex && value.getLength() >= 4) {
|
|
38
|
+
const maxVal = Math.pow(2, value.get().length / 2 * 8);
|
|
39
|
+
if (num > maxVal / 2 - 1) {
|
|
40
|
+
num = num - maxVal;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
this.set(num);
|
|
36
44
|
}
|
|
37
45
|
else {
|
|
38
46
|
this.set(value.get());
|