@abaplint/runtime 2.13.33 → 2.13.35
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/abap_regex.js +2 -2
- package/build/src/builtin/contains.js +1 -1
- package/build/src/builtin/escape.js +1 -0
- package/build/src/builtin/find.js +2 -2
- package/build/src/builtin/match.js +1 -1
- package/build/src/builtin/matches.js +1 -1
- package/build/src/builtin/round.js +2 -2
- package/build/src/statements/append.js +2 -2
- package/build/src/statements/collect.js +1 -1
- package/build/src/statements/create_data.js +1 -1
- package/build/src/statements/delete_internal.js +1 -1
- package/build/src/statements/find.js +1 -1
- package/build/src/statements/insert_database.js +1 -1
- package/build/src/statements/modify_database.js +1 -1
- package/build/src/statements/replace.js +2 -2
- package/build/src/statements/sort.js +1 -1
- package/build/src/template_formatting.js +1 -1
- package/build/src/types/character.js +2 -2
- package/build/src/types/data_reference.js +1 -1
- package/build/src/types/float.js +2 -2
- package/build/src/types/table.js +1 -1
- package/package.json +1 -1
package/build/src/abap_regex.js
CHANGED
|
@@ -50,11 +50,11 @@ class ABAPRegExp {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
else if (typeof r !== "string") {
|
|
53
|
-
throw "getRegex(), unexpected input";
|
|
53
|
+
throw new Error("getRegex(), unexpected input");
|
|
54
54
|
}
|
|
55
55
|
r = ABAPRegExp.convert(r);
|
|
56
56
|
if (r.length === 0 && options.all === true) {
|
|
57
|
-
throw "getRegex(), zero length input";
|
|
57
|
+
throw new Error("getRegex(), zero length input");
|
|
58
58
|
}
|
|
59
59
|
return new RegExp(r, "m" + ignoreCase + allOccurrences);
|
|
60
60
|
}
|
|
@@ -6,11 +6,11 @@ const types_1 = require("../types");
|
|
|
6
6
|
function find(input) {
|
|
7
7
|
let val = typeof input.val === "string" ? input.val : input.val.get();
|
|
8
8
|
if (input.len !== undefined) {
|
|
9
|
-
throw "transpiler find(), todo len";
|
|
9
|
+
throw new Error("transpiler find(), todo len");
|
|
10
10
|
}
|
|
11
11
|
if (input.regex || input.pcre) {
|
|
12
12
|
if (input.off !== undefined) {
|
|
13
|
-
throw "transpiler find(), todo off regex";
|
|
13
|
+
throw new Error("transpiler find(), todo off regex");
|
|
14
14
|
}
|
|
15
15
|
const caseInput = typeof input.case === "string" ? input.case : input.case?.get();
|
|
16
16
|
let regex = "";
|
|
@@ -6,7 +6,7 @@ function match(input) {
|
|
|
6
6
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
7
7
|
const regexInput = input.pcre || input.regex;
|
|
8
8
|
if (regexInput === undefined) {
|
|
9
|
-
throw "match() requires either regex or pcre parameter";
|
|
9
|
+
throw new Error("match() requires either regex or pcre parameter");
|
|
10
10
|
}
|
|
11
11
|
let reg = "";
|
|
12
12
|
if (typeof regexInput === "string") {
|
|
@@ -4,7 +4,7 @@ exports.matches = matches;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function matches(input) {
|
|
6
6
|
if (input.pcre === undefined && input.regex === undefined) {
|
|
7
|
-
throw "matches(), todo";
|
|
7
|
+
throw new Error("matches(), todo");
|
|
8
8
|
}
|
|
9
9
|
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
10
10
|
let reg = "";
|
|
@@ -14,7 +14,7 @@ function round(input) {
|
|
|
14
14
|
const val = (0, _parse_1.parse)(input.val);
|
|
15
15
|
const dec = (0, _parse_1.parse)(input.dec);
|
|
16
16
|
if (dec !== 0) {
|
|
17
|
-
throw "round(), todo, handle decimals";
|
|
17
|
+
throw new Error("round(), todo, handle decimals");
|
|
18
18
|
}
|
|
19
19
|
const ret = new types_1.Float();
|
|
20
20
|
switch (mode) {
|
|
@@ -34,7 +34,7 @@ function round(input) {
|
|
|
34
34
|
ret.set(Math.floor(val));
|
|
35
35
|
break;
|
|
36
36
|
default:
|
|
37
|
-
throw "round(), unknown mode: " + mode;
|
|
37
|
+
throw new Error("round(), unknown mode: " + mode);
|
|
38
38
|
}
|
|
39
39
|
return ret;
|
|
40
40
|
}
|
|
@@ -6,7 +6,7 @@ function append(input) {
|
|
|
6
6
|
if (input.target instanceof types_1.FieldSymbol) {
|
|
7
7
|
input.target = input.target.getPointer();
|
|
8
8
|
if (input.target === undefined) {
|
|
9
|
-
throw "Field symbol not assigned";
|
|
9
|
+
throw new Error("Field symbol not assigned");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
if (input.source instanceof types_1.FieldSymbol) {
|
|
@@ -15,7 +15,7 @@ function append(input) {
|
|
|
15
15
|
if (input.target === undefined) {
|
|
16
16
|
// short APPEND, use header field
|
|
17
17
|
if (!(input.source instanceof types_1.Table)) {
|
|
18
|
-
throw "APPEND, header, table";
|
|
18
|
+
throw new Error("APPEND, header, table");
|
|
19
19
|
}
|
|
20
20
|
input.source.append(input.source.getHeader());
|
|
21
21
|
abap.builtin.sy.get().tabix.set(input.source.array().length);
|
|
@@ -167,7 +167,7 @@ function createData(target, options) {
|
|
|
167
167
|
target.assign(abap.Classes[className][typeName.toLowerCase().trimEnd()].clone());
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
|
-
throw "CREATE DATA, unknown type " + options.typeName;
|
|
170
|
+
throw new Error("CREATE DATA, unknown type " + options.typeName);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -33,7 +33,7 @@ async function deleteInternal(target, options) {
|
|
|
33
33
|
}
|
|
34
34
|
if (options?.to) {
|
|
35
35
|
if (options?.from !== undefined || options?.where !== undefined) {
|
|
36
|
-
throw "DeleteInternalTodo";
|
|
36
|
+
throw new Error("DeleteInternalTodo");
|
|
37
37
|
}
|
|
38
38
|
for (let i = 0; i < options.to.get(); i++) {
|
|
39
39
|
target.deleteIndex(0);
|
|
@@ -39,7 +39,7 @@ function find(input, options) {
|
|
|
39
39
|
s = abap_regex_1.ABAPRegExp.getRegex({ all: true, ...options });
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
throw "FIND, runtime, no input";
|
|
42
|
+
throw new Error("FIND, runtime, no input");
|
|
43
43
|
}
|
|
44
44
|
const matches = [];
|
|
45
45
|
if (input instanceof types_1.Table) {
|
|
@@ -18,7 +18,7 @@ async function insertDatabase(table, options, context) {
|
|
|
18
18
|
const columns = [];
|
|
19
19
|
const values = [];
|
|
20
20
|
if (options.values === undefined && options.table === undefined) {
|
|
21
|
-
throw "insertDatabase, wrong input";
|
|
21
|
+
throw new Error("insertDatabase, wrong input");
|
|
22
22
|
}
|
|
23
23
|
if (options.table !== undefined) {
|
|
24
24
|
let subrc = 0;
|
|
@@ -22,7 +22,7 @@ function replace(input) {
|
|
|
22
22
|
inp = input.of.getTrimEnd();
|
|
23
23
|
}
|
|
24
24
|
if (inp.length === 0 && input.all === true) {
|
|
25
|
-
throw "REPLACE, zero length input";
|
|
25
|
+
throw new Error("REPLACE, zero length input");
|
|
26
26
|
}
|
|
27
27
|
found = temp.indexOf(inp) >= 0;
|
|
28
28
|
inp = abap_regex_1.ABAPRegExp.escapeRegExp(inp);
|
|
@@ -40,7 +40,7 @@ function replace(input) {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
throw "REPLACE, unexpected input";
|
|
43
|
+
throw new Error("REPLACE, unexpected input");
|
|
44
44
|
}
|
|
45
45
|
let rr = "";
|
|
46
46
|
if (typeof input.with === "string") {
|
|
@@ -61,7 +61,7 @@ function templateFormatting(source, options) {
|
|
|
61
61
|
}
|
|
62
62
|
if (options) {
|
|
63
63
|
if (options.currency !== undefined) {
|
|
64
|
-
throw "template formatting with currency not supported";
|
|
64
|
+
throw new Error("template formatting with currency not supported");
|
|
65
65
|
}
|
|
66
66
|
if (options.date === "iso") {
|
|
67
67
|
text = text.substr(0, 4) + "-" + text.substr(4, 2) + "-" + text.substr(6, 2);
|
|
@@ -16,10 +16,10 @@ class Character {
|
|
|
16
16
|
constructor(length, extra) {
|
|
17
17
|
this.length = length || 1;
|
|
18
18
|
if (typeof this.length === "object") {
|
|
19
|
-
throw "Character, invalid length, object: " + JSON.stringify(this.length);
|
|
19
|
+
throw new Error("Character, invalid length, object: " + JSON.stringify(this.length));
|
|
20
20
|
}
|
|
21
21
|
else if (this.length <= 0) {
|
|
22
|
-
throw "Character, invalid length, less than zero";
|
|
22
|
+
throw new Error("Character, invalid length, less than zero");
|
|
23
23
|
}
|
|
24
24
|
this.extra = extra;
|
|
25
25
|
this.clear();
|
package/build/src/types/float.js
CHANGED
|
@@ -7,11 +7,11 @@ const integer8_1 = require("./integer8");
|
|
|
7
7
|
/*
|
|
8
8
|
function getNumberParts(x: number) {
|
|
9
9
|
if(isNaN(x)) {
|
|
10
|
-
throw "Float NaN";
|
|
10
|
+
throw new Error("Float NaN";
|
|
11
11
|
}
|
|
12
12
|
const sig = x > 0 ? 1 : -1;
|
|
13
13
|
if (!isFinite(x)) {
|
|
14
|
-
throw "Float not finite";
|
|
14
|
+
throw new Error("Float not finite";
|
|
15
15
|
}
|
|
16
16
|
x = Math.abs(x);
|
|
17
17
|
const exp = Math.floor(Math.log(x) * Math.LOG2E) - 52;
|
package/build/src/types/table.js
CHANGED