@abaplint/runtime 2.7.136 → 2.7.138
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/builtin/sy.js
CHANGED
|
@@ -24,7 +24,7 @@ exports.sy = new types_1.Structure({
|
|
|
24
24
|
tabix: new types_1.Integer(),
|
|
25
25
|
tfill: new types_1.Integer(),
|
|
26
26
|
timlo: new types_1.Time(),
|
|
27
|
-
tzone: new types_1.Integer(),
|
|
27
|
+
tzone: new types_1.Integer(), // 0 = UTC
|
|
28
28
|
uname: new types_1.Character(12).set("USERNAME"),
|
|
29
29
|
uzeit: new types_1.Time(),
|
|
30
30
|
dbsys: new types_1.Character(10),
|
package/build/src/compare/eq.js
CHANGED
|
@@ -39,7 +39,7 @@ function eq(left, right) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else if (left instanceof types_1.Integer) {
|
|
42
|
-
return (
|
|
42
|
+
return (0, types_1.toInteger)(right.get(), false) === left.get();
|
|
43
43
|
}
|
|
44
44
|
else if (left instanceof types_1.String) {
|
|
45
45
|
return right.getTrimEnd() === left.get();
|
|
@@ -6,23 +6,29 @@ const _parse_1 = require("./_parse");
|
|
|
6
6
|
const string_1 = require("../types/string");
|
|
7
7
|
function multiply(left, right) {
|
|
8
8
|
if (left instanceof types_1.Integer && right instanceof types_1.Integer) {
|
|
9
|
-
|
|
9
|
+
const val = left.get() * right.get();
|
|
10
|
+
return new types_1.Integer().set(val);
|
|
10
11
|
}
|
|
11
12
|
else if (typeof left === "number" && typeof right === "number"
|
|
12
13
|
&& Number.isInteger(left) && Number.isInteger(right)) {
|
|
13
|
-
|
|
14
|
+
const val = left * right;
|
|
15
|
+
return new types_1.Integer().set(val);
|
|
14
16
|
}
|
|
15
17
|
else if (typeof left === "number" && Number.isInteger(left) && right instanceof types_1.Integer) {
|
|
16
|
-
|
|
18
|
+
const val = left * right.get();
|
|
19
|
+
return new types_1.Integer().set(val);
|
|
17
20
|
}
|
|
18
21
|
else if (typeof right === "number" && Number.isInteger(right) && left instanceof types_1.Integer) {
|
|
19
|
-
|
|
22
|
+
const val = left.get() * right;
|
|
23
|
+
return new types_1.Integer().set(val);
|
|
20
24
|
}
|
|
21
25
|
else if ((left instanceof string_1.String || left instanceof types_1.Character) && Number.isInteger(Number(left.get())) && right instanceof types_1.Integer) {
|
|
22
|
-
|
|
26
|
+
const val = Number.parseInt(left.get(), 10) * right.get();
|
|
27
|
+
return new types_1.Integer().set(val);
|
|
23
28
|
}
|
|
24
29
|
else if ((right instanceof string_1.String || right instanceof types_1.Character) && Number.isInteger(Number(right)) && left instanceof types_1.Integer) {
|
|
25
|
-
|
|
30
|
+
const val = left.get() * Number.parseInt(right.get(), 10);
|
|
31
|
+
return new types_1.Integer().set(val);
|
|
26
32
|
}
|
|
27
33
|
return new types_1.Float().set((0, _parse_1.parse)(left) * (0, _parse_1.parse)(right));
|
|
28
34
|
}
|
|
@@ -15,8 +15,9 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
|
15
15
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
16
16
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
17
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
18
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
19
|
-
function
|
|
18
|
+
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
19
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
20
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
20
21
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
21
22
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
22
23
|
function fulfill(value) { resume("next", value); }
|
|
@@ -2,6 +2,10 @@ import { Float } from "./float";
|
|
|
2
2
|
import { Hex } from "./hex";
|
|
3
3
|
import { ICharacter } from "./_character";
|
|
4
4
|
import { INumeric } from "./_numeric";
|
|
5
|
+
export declare const DIGITS: RegExp;
|
|
6
|
+
export declare const MAX_INTEGER = 2147483647;
|
|
7
|
+
export declare const MIN_INTEGER = -2147483648;
|
|
8
|
+
export declare function toInteger(value: string, exception?: boolean): number;
|
|
5
9
|
export declare class Integer implements INumeric {
|
|
6
10
|
private value;
|
|
7
11
|
private constant;
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Integer = void 0;
|
|
3
|
+
exports.Integer = exports.toInteger = exports.MIN_INTEGER = exports.MAX_INTEGER = exports.DIGITS = void 0;
|
|
4
4
|
const throw_error_1 = require("../throw_error");
|
|
5
5
|
const float_1 = require("./float");
|
|
6
6
|
const hex_1 = require("./hex");
|
|
7
7
|
const xstring_1 = require("./xstring");
|
|
8
|
-
|
|
8
|
+
exports.DIGITS = new RegExp(/^\s*-?\+?\d+\.?\d* *$/i);
|
|
9
|
+
exports.MAX_INTEGER = 2147483647;
|
|
10
|
+
exports.MIN_INTEGER = -2147483648;
|
|
11
|
+
function toInteger(value, exception = true) {
|
|
12
|
+
if (value.endsWith("-")) {
|
|
13
|
+
value = "-" + value.substring(0, value.length - 1);
|
|
14
|
+
}
|
|
15
|
+
if (value.trim().length === 0) {
|
|
16
|
+
value = "0";
|
|
17
|
+
}
|
|
18
|
+
else if (exports.DIGITS.test(value) === false) {
|
|
19
|
+
if (exception === true) {
|
|
20
|
+
(0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new Error("CONVT_NO_NUMBER");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return parseInt(value, 10);
|
|
27
|
+
}
|
|
28
|
+
exports.toInteger = toInteger;
|
|
9
29
|
class Integer {
|
|
10
30
|
constructor(input) {
|
|
11
31
|
this.constant = false;
|
|
@@ -27,16 +47,7 @@ class Integer {
|
|
|
27
47
|
this.value = Math.round(value);
|
|
28
48
|
}
|
|
29
49
|
else if (typeof value === "string") {
|
|
30
|
-
|
|
31
|
-
value = "-" + value.substring(0, value.length - 1);
|
|
32
|
-
}
|
|
33
|
-
if (value.trim().length === 0) {
|
|
34
|
-
value = "0";
|
|
35
|
-
}
|
|
36
|
-
else if (digits.test(value) === false) {
|
|
37
|
-
(0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
|
|
38
|
-
}
|
|
39
|
-
this.value = parseInt(value, 10);
|
|
50
|
+
this.value = toInteger(value);
|
|
40
51
|
}
|
|
41
52
|
else if (value instanceof float_1.Float) {
|
|
42
53
|
this.set(Math.round(value.getRaw()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.138",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"author": "abaplint",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/chai": "^4.3.
|
|
33
|
-
"@types/mocha": "^10.0.
|
|
32
|
+
"@types/chai": "^4.3.11",
|
|
33
|
+
"@types/mocha": "^10.0.6",
|
|
34
34
|
"chai": "^4.3.10",
|
|
35
35
|
"mocha": "^10.2.0",
|
|
36
36
|
"source-map-support": "^0.5.21",
|
|
37
|
-
"typescript": "^5.
|
|
37
|
+
"typescript": "^5.3.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"temporal-polyfill": "^0.1.1"
|