@abaplint/runtime 2.7.165 → 2.8.1
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/binary_search.js +2 -2
- package/build/src/builtin/count_any_of.js +1 -1
- package/build/src/builtin/find.js +5 -6
- package/build/src/builtin/round.js +1 -1
- package/build/src/builtin/substring.js +2 -3
- package/build/src/builtin/substring_after.js +3 -3
- package/build/src/builtin/substring_before.js +2 -2
- package/build/src/compare/eq.d.ts +2 -2
- package/build/src/compare/eq.js +10 -0
- package/build/src/compare/gt.js +6 -0
- package/build/src/compare/initial.d.ts +2 -2
- package/build/src/compare/initial.js +3 -0
- package/build/src/expand_in.js +2 -3
- package/build/src/index.js +2 -2
- package/build/src/operators/add.d.ts +2 -2
- package/build/src/operators/add.js +11 -0
- package/build/src/operators/div.d.ts +1 -1
- package/build/src/operators/div.js +13 -3
- package/build/src/operators/divide.d.ts +2 -2
- package/build/src/operators/divide.js +13 -0
- package/build/src/operators/minus.d.ts +2 -2
- package/build/src/operators/minus.js +6 -1
- package/build/src/operators/mod.d.ts +1 -1
- package/build/src/operators/mod.js +6 -0
- package/build/src/operators/multiply.d.ts +2 -2
- package/build/src/operators/multiply.js +6 -1
- package/build/src/operators/power.d.ts +2 -2
- package/build/src/operators/power.js +5 -0
- package/build/src/statements/assign.js +1 -2
- package/build/src/statements/cast.js +3 -4
- package/build/src/statements/convert.js +3 -4
- package/build/src/statements/create_data.js +6 -6
- package/build/src/statements/delete_internal.js +36 -56
- package/build/src/statements/describe.js +1 -2
- package/build/src/statements/find.js +10 -11
- package/build/src/statements/get_time.js +3 -3
- package/build/src/statements/index.js +1 -1
- package/build/src/statements/insert_internal.js +7 -9
- package/build/src/statements/loop.js +56 -83
- package/build/src/statements/message.js +5 -6
- package/build/src/statements/move_corresponding.js +1 -2
- package/build/src/statements/open_cursor.js +1 -1
- package/build/src/statements/read_table.d.ts +2 -2
- package/build/src/statements/read_table.js +23 -21
- package/build/src/statements/replace.js +1 -1
- package/build/src/statements/select.js +4 -5
- package/build/src/statements/set_bit.js +1 -1
- package/build/src/statements/shift.js +10 -10
- package/build/src/statements/sort.js +4 -5
- package/build/src/statements/write.js +7 -8
- package/build/src/template_formatting.js +2 -2
- package/build/src/types/abap_object.js +2 -2
- package/build/src/types/character.js +5 -8
- package/build/src/types/data_reference.d.ts +3 -2
- package/build/src/types/data_reference.js +8 -12
- package/build/src/types/date.js +5 -5
- package/build/src/types/field_symbol.d.ts +1 -1
- package/build/src/types/field_symbol.js +7 -12
- package/build/src/types/float.js +5 -1
- package/build/src/types/hex.d.ts +4 -3
- package/build/src/types/hex.js +20 -6
- package/build/src/types/integer.js +5 -1
- package/build/src/types/integer8.d.ts +3 -3
- package/build/src/types/integer8.js +8 -5
- package/build/src/types/numc.js +4 -4
- package/build/src/types/packed.js +3 -3
- package/build/src/types/string.js +3 -3
- package/build/src/types/structure.js +4 -4
- package/build/src/types/table.js +9 -13
- package/build/src/types/time.js +5 -5
- package/build/src/types/utc_long.js +1 -1
- package/build/src/types/xstring.d.ts +3 -2
- package/build/src/types/xstring.js +16 -5
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ function binarySearchFromRow(array, left, right, keyField, keyValue, usesTableLi
|
|
|
21
21
|
row = a.get();
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
row = isStructured ?
|
|
24
|
+
row = isStructured ? { table_line: a, ...a.get() } : { table_line: a };
|
|
25
25
|
}
|
|
26
26
|
if ((0, compare_1.ge)(keyField(row), keyValue)) {
|
|
27
27
|
right = middle;
|
|
@@ -37,7 +37,7 @@ function binarySearchFromRow(array, left, right, keyField, keyValue, usesTableLi
|
|
|
37
37
|
row = a.get();
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
row = isStructured ?
|
|
40
|
+
row = isStructured ? { table_line: a, ...a.get() } : { table_line: a };
|
|
41
41
|
}
|
|
42
42
|
if ((0, compare_1.le)(keyValue, keyField(row))) {
|
|
43
43
|
// console.dir("choose left");
|
|
@@ -9,7 +9,7 @@ function count_any_of(input) {
|
|
|
9
9
|
if (sub !== "") {
|
|
10
10
|
for (const char of sub.split("")) {
|
|
11
11
|
const match = val.match(new RegExp(char, "g"));
|
|
12
|
-
found +=
|
|
12
|
+
found += match?.length || 0;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
return new types_1.Integer().set(found);
|
|
@@ -4,7 +4,6 @@ exports.find = void 0;
|
|
|
4
4
|
const throw_error_1 = require("../throw_error");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function find(input) {
|
|
7
|
-
var _a, _b, _c, _d, _e;
|
|
8
7
|
let val = typeof input.val === "string" ? input.val : input.val.get();
|
|
9
8
|
if (input.len !== undefined) {
|
|
10
9
|
throw "transpiler find(), todo len";
|
|
@@ -13,7 +12,7 @@ function find(input) {
|
|
|
13
12
|
if (input.off !== undefined) {
|
|
14
13
|
throw "transpiler find(), todo off regex";
|
|
15
14
|
}
|
|
16
|
-
const caseInput = typeof input.case === "string" ? input.case :
|
|
15
|
+
const caseInput = typeof input.case === "string" ? input.case : input.case?.get();
|
|
17
16
|
let regex = "";
|
|
18
17
|
if (input.regex) {
|
|
19
18
|
regex = typeof input.regex === "string" ? input.regex : input.regex.get();
|
|
@@ -23,7 +22,7 @@ function find(input) {
|
|
|
23
22
|
}
|
|
24
23
|
const flags = caseInput !== "X" ? "i" : "";
|
|
25
24
|
const reg = new RegExp(regex, flags);
|
|
26
|
-
const ret =
|
|
25
|
+
const ret = val.match(reg)?.index;
|
|
27
26
|
if (ret !== undefined) {
|
|
28
27
|
return new types_1.Integer().set(ret);
|
|
29
28
|
}
|
|
@@ -32,9 +31,9 @@ function find(input) {
|
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
else {
|
|
35
|
-
const sub = typeof input.sub === "string" ? input.sub :
|
|
36
|
-
let off = typeof input.off === "number" ? input.off :
|
|
37
|
-
let occ = typeof input.occ === "number" ? input.occ :
|
|
34
|
+
const sub = typeof input.sub === "string" ? input.sub : input.sub?.get();
|
|
35
|
+
let off = typeof input.off === "number" ? input.off : input.off?.get() || 0;
|
|
36
|
+
let occ = typeof input.occ === "number" ? input.occ : input.occ?.get();
|
|
38
37
|
if (occ === 0) {
|
|
39
38
|
(0, throw_error_1.throwError)("CX_SY_STRG_PAR_VAL");
|
|
40
39
|
}
|
|
@@ -9,7 +9,7 @@ function round(input) {
|
|
|
9
9
|
mode = 2;
|
|
10
10
|
}
|
|
11
11
|
else if (typeof mode !== "number") {
|
|
12
|
-
mode = mode
|
|
12
|
+
mode = mode?.get();
|
|
13
13
|
}
|
|
14
14
|
const val = (0, _parse_1.parse)(input.val);
|
|
15
15
|
const dec = (0, _parse_1.parse)(input.dec);
|
|
@@ -4,15 +4,14 @@ exports.substring = void 0;
|
|
|
4
4
|
const string_1 = require("../types/string");
|
|
5
5
|
const throw_error_1 = require("../throw_error");
|
|
6
6
|
function substring(input) {
|
|
7
|
-
|
|
8
|
-
let off = (_a = input === null || input === void 0 ? void 0 : input.off) === null || _a === void 0 ? void 0 : _a.get();
|
|
7
|
+
let off = input?.off?.get();
|
|
9
8
|
if (off === undefined) {
|
|
10
9
|
off = 0;
|
|
11
10
|
}
|
|
12
11
|
else if (off < 0) {
|
|
13
12
|
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
14
13
|
}
|
|
15
|
-
const len =
|
|
14
|
+
const len = input?.len?.get();
|
|
16
15
|
if (len && len < 0) {
|
|
17
16
|
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
18
17
|
}
|
|
@@ -16,16 +16,16 @@ function substring_after(input) {
|
|
|
16
16
|
else if (typeof input.pcre === "string") {
|
|
17
17
|
reg = input.pcre;
|
|
18
18
|
}
|
|
19
|
-
else if (input
|
|
19
|
+
else if (input?.regex) {
|
|
20
20
|
reg = input.regex.get();
|
|
21
21
|
}
|
|
22
|
-
else if (input
|
|
22
|
+
else if (input?.pcre) {
|
|
23
23
|
reg = input.pcre.get();
|
|
24
24
|
}
|
|
25
25
|
else if (typeof input.sub === "string") {
|
|
26
26
|
reg = abap_regex_1.ABAPRegExp.escapeRegExp(input.sub);
|
|
27
27
|
}
|
|
28
|
-
else if (input
|
|
28
|
+
else if (input?.sub) {
|
|
29
29
|
reg = abap_regex_1.ABAPRegExp.escapeRegExp(input.sub.get());
|
|
30
30
|
}
|
|
31
31
|
const r = new RegExp(reg + "(.*)");
|
|
@@ -19,13 +19,13 @@ function substring_before(input) {
|
|
|
19
19
|
if (typeof input.regex === "string") {
|
|
20
20
|
reg = input.regex;
|
|
21
21
|
}
|
|
22
|
-
else if (input
|
|
22
|
+
else if (input?.regex) {
|
|
23
23
|
reg = input.regex.get();
|
|
24
24
|
}
|
|
25
25
|
else if (typeof input.sub === "string") {
|
|
26
26
|
reg = abap_regex_1.ABAPRegExp.escapeRegExp(input.sub);
|
|
27
27
|
}
|
|
28
|
-
else if (input
|
|
28
|
+
else if (input?.sub) {
|
|
29
29
|
reg = abap_regex_1.ABAPRegExp.escapeRegExp(input.sub.get());
|
|
30
30
|
}
|
|
31
31
|
const r = new RegExp("(.*?)" + reg);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ABAPObject, FieldSymbol, Float, HashedTable, String, Hex, Structure, Table } from "../types";
|
|
1
|
+
import { ABAPObject, FieldSymbol, Float, HashedTable, String, Hex, Structure, Table, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function eq(left: number | string | ICharacter | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol, right: number | string | ICharacter | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol): boolean;
|
|
4
|
+
export declare function eq(left: number | string | ICharacter | Integer8 | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol, right: number | string | ICharacter | Integer8 | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol): boolean;
|
package/build/src/compare/eq.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.eq = void 0;
|
|
4
4
|
/* eslint-disable max-len */
|
|
5
5
|
const types_1 = require("../types");
|
|
6
|
+
const _parse_1 = require("../operators/_parse");
|
|
6
7
|
function compareTables(left, right) {
|
|
7
8
|
const leftArray = left.array();
|
|
8
9
|
const rightArray = right.array();
|
|
@@ -28,6 +29,15 @@ function eq(left, right) {
|
|
|
28
29
|
else if (left instanceof types_1.FieldSymbol) {
|
|
29
30
|
return eq(left.getPointer(), right);
|
|
30
31
|
}
|
|
32
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
33
|
+
if (left instanceof types_1.Table || left instanceof types_1.HashedTable || right instanceof types_1.Table || right instanceof types_1.HashedTable) {
|
|
34
|
+
// exception?
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
38
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
39
|
+
return l === r;
|
|
40
|
+
}
|
|
31
41
|
// for performance, do the typicaly/easy cases first
|
|
32
42
|
if (right instanceof types_1.Character) {
|
|
33
43
|
if (left instanceof types_1.Character) {
|
package/build/src/compare/gt.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.gt = void 0;
|
|
4
|
+
const _parse_1 = require("../operators/_parse");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
const integer_1 = require("../types/integer");
|
|
6
7
|
function gt(left, right) {
|
|
@@ -22,6 +23,11 @@ function gt(left, right) {
|
|
|
22
23
|
if (left instanceof types_1.Hex || right instanceof types_1.Hex) {
|
|
23
24
|
return gt_with_hex(left, right);
|
|
24
25
|
}
|
|
26
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
27
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
28
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
29
|
+
return l > r;
|
|
30
|
+
}
|
|
25
31
|
let l = undefined;
|
|
26
32
|
if (typeof left === "number" || typeof left === "string") {
|
|
27
33
|
l = left;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ABAPObject, DataReference, FieldSymbol, Structure, Table } from "../types";
|
|
1
|
+
import { ABAPObject, DataReference, FieldSymbol, Integer8, Structure, Table } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function initial(val: ICharacter | INumeric | string | number | Structure | DataReference | FieldSymbol | Table | ABAPObject): boolean;
|
|
4
|
+
export declare function initial(val: ICharacter | INumeric | string | number | Integer8 | Structure | DataReference | FieldSymbol | Table | ABAPObject): boolean;
|
|
@@ -9,6 +9,9 @@ function initial(val) {
|
|
|
9
9
|
if (val instanceof types_1.Table || val instanceof types_1.HashedTable) {
|
|
10
10
|
return val.array().length === 0;
|
|
11
11
|
}
|
|
12
|
+
else if (val instanceof types_1.Integer8) {
|
|
13
|
+
return val.get() === 0n;
|
|
14
|
+
}
|
|
12
15
|
else if (val instanceof types_1.DataReference) {
|
|
13
16
|
return val.getPointer() === undefined;
|
|
14
17
|
}
|
package/build/src/expand_in.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.expandIN = void 0;
|
|
|
4
4
|
// note: must always return an expression, never return empty string
|
|
5
5
|
// https://www.sqlite.org/lang_select.html
|
|
6
6
|
function expandIN(fieldName, table) {
|
|
7
|
-
var _a, _b, _c;
|
|
8
7
|
let ret = "";
|
|
9
8
|
if (table.array().length === 0) {
|
|
10
9
|
// " NOT IN ()" does not work on postgres
|
|
@@ -15,10 +14,10 @@ function expandIN(fieldName, table) {
|
|
|
15
14
|
ret = `"${fieldName}" IN (`;
|
|
16
15
|
const values = [];
|
|
17
16
|
for (const row of table.array()) {
|
|
18
|
-
if (
|
|
17
|
+
if (row.get().sign?.get() !== "I" || row.get().option?.get() !== "EQ") {
|
|
19
18
|
throw "Error: IN, only I EQ supported for now";
|
|
20
19
|
}
|
|
21
|
-
values.push("'" +
|
|
20
|
+
values.push("'" + row.get().low?.get().replace(/'/g, "''") + "'");
|
|
22
21
|
}
|
|
23
22
|
ret += values.join(",") + ")";
|
|
24
23
|
}
|
package/build/src/index.js
CHANGED
|
@@ -47,9 +47,9 @@ class ABAP {
|
|
|
47
47
|
this.ClassicError = classic_error_1.ClassicError;
|
|
48
48
|
this.IntegerFactory = integer_factory_1.IntegerFactory;
|
|
49
49
|
this.context = new context_1.Context();
|
|
50
|
-
this.console =
|
|
50
|
+
this.console = input?.console ? input?.console : new standard_out_console_1.StandardOutConsole();
|
|
51
51
|
this.context.console = this.console;
|
|
52
|
-
this.dbo =
|
|
52
|
+
this.dbo = input?.database || { schemaPrefix: "", tablePrefix: "" };
|
|
53
53
|
if (this.dbo.schemaPrefix === undefined) {
|
|
54
54
|
this.dbo.schemaPrefix = "";
|
|
55
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldSymbol, Float, Hex, Integer } from "../types";
|
|
1
|
+
import { FieldSymbol, Float, Hex, Integer, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function add(left: INumeric | ICharacter | string | number | Float | Integer | Hex | FieldSymbol, right: INumeric | ICharacter | string | number | Float | Integer | Hex | FieldSymbol): Integer | Float;
|
|
4
|
+
export declare function add(left: INumeric | ICharacter | string | number | Float | Integer | Hex | FieldSymbol, right: INumeric | ICharacter | string | number | Float | Integer | Hex | FieldSymbol): Integer | Integer8 | Float;
|
|
@@ -24,6 +24,17 @@ function add(left, right) {
|
|
|
24
24
|
else if ((right instanceof string_1.String || right instanceof types_1.Character) && Number.isInteger(Number(right)) && left instanceof types_1.Integer) {
|
|
25
25
|
return new types_1.Integer().set(left.get() + Number.parseInt(right.get(), 10));
|
|
26
26
|
}
|
|
27
|
+
else if (left instanceof types_1.Integer8) {
|
|
28
|
+
if (right instanceof types_1.Integer8) {
|
|
29
|
+
return new types_1.Integer8().set(left.get() + right.get());
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return new types_1.Integer8().set(left.get() + BigInt((0, _parse_1.parse)(right)));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (right instanceof types_1.Integer8) {
|
|
36
|
+
return new types_1.Integer8().set(BigInt((0, _parse_1.parse)(left)) + right.get());
|
|
37
|
+
}
|
|
27
38
|
if (left instanceof types_1.FieldSymbol) {
|
|
28
39
|
if (left.getPointer() === undefined) {
|
|
29
40
|
throw new Error("GETWA_NOT_ASSIGNED");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Integer, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function div(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Integer | Integer8;
|
|
4
|
+
export declare function div(left: INumeric | ICharacter | Integer8 | string | number, right: INumeric | Integer8 | ICharacter | string | number): Integer | Integer8;
|
|
@@ -5,6 +5,19 @@ const throw_error_1 = require("../throw_error");
|
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const _parse_1 = require("./_parse");
|
|
7
7
|
function div(left, right) {
|
|
8
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
9
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
10
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
11
|
+
if (r === 0n) {
|
|
12
|
+
if (l === 0n) {
|
|
13
|
+
return new types_1.Integer8().set(0n);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
(0, throw_error_1.throwError)("CX_SY_ZERODIVIDE");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return new types_1.Integer8().set(l / r);
|
|
20
|
+
}
|
|
8
21
|
const l = (0, _parse_1.parse)(left);
|
|
9
22
|
const r = (0, _parse_1.parse)(right);
|
|
10
23
|
if (r === 0) {
|
|
@@ -15,9 +28,6 @@ function div(left, right) {
|
|
|
15
28
|
(0, throw_error_1.throwError)("CX_SY_ZERODIVIDE");
|
|
16
29
|
}
|
|
17
30
|
}
|
|
18
|
-
else if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
19
|
-
return new types_1.Integer8().set(Math.floor(l / r));
|
|
20
|
-
}
|
|
21
31
|
else {
|
|
22
32
|
return new types_1.Integer().set(Math.floor(l / r));
|
|
23
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Float, Integer } from "../types";
|
|
1
|
+
import { Float, Integer, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function divide(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float |
|
|
4
|
+
export declare function divide(left: INumeric | ICharacter | Integer8 | string | number, right: INumeric | ICharacter | Integer8 | string | number): Integer | Float | Integer8;
|
|
@@ -6,6 +6,19 @@ const types_1 = require("../types");
|
|
|
6
6
|
const _parse_1 = require("./_parse");
|
|
7
7
|
// todo, this will only work when the target value is an integer?
|
|
8
8
|
function divide(left, right) {
|
|
9
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
10
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
11
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
12
|
+
if (r === 0n) {
|
|
13
|
+
if (l === 0n) {
|
|
14
|
+
return new types_1.Integer8().set(0n);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
(0, throw_error_1.throwError)("CX_SY_ZERODIVIDE");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return new types_1.Integer8().set(l / r);
|
|
21
|
+
}
|
|
9
22
|
const r = (0, _parse_1.parse)(right);
|
|
10
23
|
const l = (0, _parse_1.parse)(left);
|
|
11
24
|
if (r === 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldSymbol, Float, Integer } from "../types";
|
|
1
|
+
import { FieldSymbol, Float, Integer, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function minus(left: INumeric | ICharacter | string | number | Integer | Float | FieldSymbol, right: INumeric | ICharacter | string | number | Integer | Float | FieldSymbol): Integer | Float;
|
|
4
|
+
export declare function minus(left: INumeric | ICharacter | string | Integer8 | number | Integer | Float | FieldSymbol, right: INumeric | ICharacter | string | Integer8 | number | Integer | Float | FieldSymbol): Integer | Integer8 | Float;
|
|
@@ -17,7 +17,12 @@ function minus(left, right) {
|
|
|
17
17
|
}
|
|
18
18
|
return minus(left, right.getPointer());
|
|
19
19
|
}
|
|
20
|
-
if (left instanceof types_1.
|
|
20
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
21
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
22
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
23
|
+
return new types_1.Integer8().set(l - r);
|
|
24
|
+
}
|
|
25
|
+
else if (left instanceof types_1.Integer && right instanceof types_1.Integer) {
|
|
21
26
|
return new types_1.Integer().set(left.get() - right.get());
|
|
22
27
|
}
|
|
23
28
|
else if (typeof left === "number" && typeof right === "number"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Integer, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function mod(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Integer | Integer8;
|
|
4
|
+
export declare function mod(left: INumeric | ICharacter | string | Integer8 | number, right: INumeric | Integer8 | ICharacter | string | number): Integer | Integer8;
|
|
@@ -4,6 +4,12 @@ exports.mod = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function mod(left, right) {
|
|
7
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
8
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
9
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
10
|
+
// todo, is this correct?
|
|
11
|
+
return new types_1.Integer8().set(l % r);
|
|
12
|
+
}
|
|
7
13
|
const l = (0, _parse_1.parse)(left);
|
|
8
14
|
const r = (0, _parse_1.parse)(right);
|
|
9
15
|
let val = ((l % r) + r) % r;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Float, Integer } from "../types";
|
|
1
|
+
import { Float, Integer, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function multiply(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float |
|
|
4
|
+
export declare function multiply(left: INumeric | ICharacter | string | Integer8 | number, right: INumeric | ICharacter | string | Integer8 | number): Integer | Float | Integer8;
|
|
@@ -5,7 +5,12 @@ const types_1 = require("../types");
|
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
const string_1 = require("../types/string");
|
|
7
7
|
function multiply(left, right) {
|
|
8
|
-
if (left instanceof types_1.
|
|
8
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
9
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
10
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
11
|
+
return new types_1.Integer8().set(l * r);
|
|
12
|
+
}
|
|
13
|
+
else if (left instanceof types_1.Integer && right instanceof types_1.Integer) {
|
|
9
14
|
const val = left.get() * right.get();
|
|
10
15
|
return new types_1.Integer().set(val);
|
|
11
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Float } from "../types";
|
|
1
|
+
import { Float, Integer8 } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function power(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float;
|
|
4
|
+
export declare function power(left: INumeric | ICharacter | Integer8 | string | number, right: INumeric | ICharacter | Integer8 | string | number): Float | Integer8;
|
|
@@ -4,6 +4,11 @@ exports.power = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function power(left, right) {
|
|
7
|
+
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
|
|
8
|
+
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
|
|
9
|
+
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
|
|
10
|
+
return new types_1.Integer8().set(l ** r);
|
|
11
|
+
}
|
|
7
12
|
return new types_1.Float().set(Math.pow((0, _parse_1.parse)(left), (0, _parse_1.parse)(right)));
|
|
8
13
|
}
|
|
9
14
|
exports.power = power;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assign = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function assign(input) {
|
|
6
|
-
var _a;
|
|
7
6
|
// console.dir(input);
|
|
8
7
|
if (input.dynamicName) {
|
|
9
8
|
if (input.dynamicSource instanceof types_1.FieldSymbol) {
|
|
@@ -80,7 +79,7 @@ function assign(input) {
|
|
|
80
79
|
component = component.get();
|
|
81
80
|
}
|
|
82
81
|
if (input.source instanceof types_1.Table) {
|
|
83
|
-
if (
|
|
82
|
+
if (input.source.getOptions()?.withHeader === true) {
|
|
84
83
|
input.source = input.source.getHeader();
|
|
85
84
|
}
|
|
86
85
|
else {
|
|
@@ -8,7 +8,6 @@ const types_1 = require("../types");
|
|
|
8
8
|
// check with javascript instanceof?
|
|
9
9
|
// handling interfaces?
|
|
10
10
|
async function cast(target, source) {
|
|
11
|
-
var _a;
|
|
12
11
|
if (source instanceof types_1.ABAPObject && source.get() === undefined) {
|
|
13
12
|
target.clear();
|
|
14
13
|
return;
|
|
@@ -27,7 +26,7 @@ async function cast(target, source) {
|
|
|
27
26
|
}
|
|
28
27
|
let targetName = undefined;
|
|
29
28
|
if (target.getQualifiedName) {
|
|
30
|
-
targetName =
|
|
29
|
+
targetName = target.getQualifiedName()?.toUpperCase();
|
|
31
30
|
}
|
|
32
31
|
// @ts-ignore
|
|
33
32
|
let targetClass = abap.Classes[targetName];
|
|
@@ -36,14 +35,14 @@ async function cast(target, source) {
|
|
|
36
35
|
// @ts-ignore
|
|
37
36
|
targetClass = abap.Classes["PROG-ZFOOBAR-" + targetName];
|
|
38
37
|
}
|
|
39
|
-
if (
|
|
38
|
+
if (targetClass?.INTERNAL_TYPE === "CLAS") {
|
|
40
39
|
// using "instanceof" is probably wrong in some cases,
|
|
41
40
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
|
|
42
41
|
if (source.get() instanceof targetClass === false) {
|
|
43
42
|
(0, throw_error_1.throwError)("CX_SY_MOVE_CAST_ERROR");
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
else if (checkIntf === true &&
|
|
45
|
+
else if (checkIntf === true && targetClass?.INTERNAL_TYPE === "INTF") {
|
|
47
46
|
const list = source.get().constructor.IMPLEMENTED_INTERFACES;
|
|
48
47
|
const isImplemented = list.some(i => i === targetName);
|
|
49
48
|
if (isImplemented === false) {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.convert = void 0;
|
|
4
4
|
const temporal_polyfill_1 = require("temporal-polyfill");
|
|
5
5
|
function convert(source, target) {
|
|
6
|
-
var _a, _b, _c;
|
|
7
6
|
/*
|
|
8
7
|
console.dir(source);
|
|
9
8
|
console.dir(target);
|
|
@@ -58,7 +57,7 @@ function convert(source, target) {
|
|
|
58
57
|
let zoned = undefined;
|
|
59
58
|
if (date !== "" && time !== "") {
|
|
60
59
|
if (date === "00000000" && time === "000000") {
|
|
61
|
-
|
|
60
|
+
target.stamp?.clear();
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
63
|
const pt = temporal_polyfill_1.Temporal.PlainTime.from(time.substring(0, 2) + ":" + time.substring(2, 4) + ":" + time.substring(4, 6));
|
|
@@ -67,8 +66,8 @@ function convert(source, target) {
|
|
|
67
66
|
}
|
|
68
67
|
else {
|
|
69
68
|
if (stamp === "0") {
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
target.date?.clear();
|
|
70
|
+
target.time?.clear();
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
73
|
const pt = temporal_polyfill_1.Temporal.PlainTime.from(stamp.substring(8, 10) + ":" + stamp.substring(10, 12) + ":" + stamp.substring(12, 14));
|
|
@@ -12,7 +12,7 @@ function createData(target, options) {
|
|
|
12
12
|
else if (!(target instanceof types_1.DataReference)) {
|
|
13
13
|
throw new Error("CREATE_DATA_REFERENCE_EXPECTED");
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
15
|
+
if (options?.name && options?.table) {
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
if (abap.DDIC[options.name.trimEnd()] === undefined) {
|
|
18
18
|
(0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
|
|
@@ -20,7 +20,7 @@ function createData(target, options) {
|
|
|
20
20
|
// @ts-ignore
|
|
21
21
|
target.assign(new abap.types.Table(abap.DDIC[options.name.trimEnd()].type));
|
|
22
22
|
}
|
|
23
|
-
else if (options
|
|
23
|
+
else if (options?.name) {
|
|
24
24
|
// @ts-ignore
|
|
25
25
|
if (abap.DDIC[options.name.trimEnd()]) {
|
|
26
26
|
// @ts-ignore
|
|
@@ -89,7 +89,7 @@ function createData(target, options) {
|
|
|
89
89
|
target.assign((0, clone_1.clone)(target.getPointer().getRowType()));
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
else if (options
|
|
92
|
+
else if (options?.typeName) {
|
|
93
93
|
switch (options.typeName) {
|
|
94
94
|
case "C":
|
|
95
95
|
{
|
|
@@ -176,16 +176,16 @@ function createData(target, options) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
else if (options
|
|
179
|
+
else if (options?.type) {
|
|
180
180
|
target.assign((0, clone_1.clone)(options.type));
|
|
181
181
|
}
|
|
182
|
-
else if (options
|
|
182
|
+
else if (options?.likeLineOf) {
|
|
183
183
|
if (options.likeLineOf instanceof types_1.FieldSymbol) {
|
|
184
184
|
options.likeLineOf = options.likeLineOf.getPointer();
|
|
185
185
|
}
|
|
186
186
|
target.assign((0, clone_1.clone)(options.likeLineOf.getRowType()));
|
|
187
187
|
}
|
|
188
|
-
else if (options
|
|
188
|
+
else if (options?.like) {
|
|
189
189
|
if (options.like instanceof types_1.FieldSymbol) {
|
|
190
190
|
options.like = options.like.getPointer();
|
|
191
191
|
}
|