@abaplint/runtime 2.7.164 → 2.8.0

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.
Files changed (51) hide show
  1. package/build/src/binary_search.js +2 -2
  2. package/build/src/builtin/abs.js +5 -0
  3. package/build/src/builtin/count_any_of.js +1 -1
  4. package/build/src/builtin/find.js +5 -6
  5. package/build/src/builtin/round.js +1 -1
  6. package/build/src/builtin/substring.js +2 -3
  7. package/build/src/builtin/substring_after.js +3 -3
  8. package/build/src/builtin/substring_before.js +2 -2
  9. package/build/src/builtin/trunc.js +5 -0
  10. package/build/src/expand_in.js +2 -3
  11. package/build/src/index.js +2 -2
  12. package/build/src/statements/assign.js +1 -2
  13. package/build/src/statements/cast.js +3 -4
  14. package/build/src/statements/convert.js +3 -4
  15. package/build/src/statements/create_data.js +6 -6
  16. package/build/src/statements/delete_internal.js +36 -56
  17. package/build/src/statements/describe.js +1 -2
  18. package/build/src/statements/find.js +10 -11
  19. package/build/src/statements/get_time.js +3 -3
  20. package/build/src/statements/index.js +1 -1
  21. package/build/src/statements/insert_internal.js +7 -9
  22. package/build/src/statements/loop.js +56 -83
  23. package/build/src/statements/message.js +5 -6
  24. package/build/src/statements/move_corresponding.js +1 -2
  25. package/build/src/statements/open_cursor.js +1 -1
  26. package/build/src/statements/read_table.js +20 -21
  27. package/build/src/statements/replace.js +1 -1
  28. package/build/src/statements/select.js +4 -5
  29. package/build/src/statements/set_bit.js +1 -1
  30. package/build/src/statements/shift.js +10 -10
  31. package/build/src/statements/sort.js +4 -5
  32. package/build/src/statements/write.js +7 -8
  33. package/build/src/template_formatting.js +2 -2
  34. package/build/src/types/abap_object.js +2 -2
  35. package/build/src/types/character.js +5 -8
  36. package/build/src/types/data_reference.js +8 -12
  37. package/build/src/types/date.js +5 -5
  38. package/build/src/types/field_symbol.js +7 -12
  39. package/build/src/types/float.js +1 -1
  40. package/build/src/types/hex.js +4 -4
  41. package/build/src/types/integer.js +1 -1
  42. package/build/src/types/integer8.js +1 -1
  43. package/build/src/types/numc.js +4 -4
  44. package/build/src/types/packed.js +3 -3
  45. package/build/src/types/string.js +3 -3
  46. package/build/src/types/structure.js +4 -4
  47. package/build/src/types/table.js +9 -13
  48. package/build/src/types/time.js +5 -5
  49. package/build/src/types/utc_long.js +1 -1
  50. package/build/src/types/xstring.js +3 -3
  51. package/package.json +2 -2
@@ -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 ? Object.assign({ table_line: a }, a.get()) : { table_line: a };
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 ? Object.assign({ table_line: a }, a.get()) : { table_line: a };
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");
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.abs = void 0;
4
+ /* eslint-disable radix */
5
+ const types_1 = require("../types");
4
6
  function abs(input) {
5
7
  let num_in = undefined;
6
8
  if (typeof input.val === "number") {
@@ -9,6 +11,9 @@ function abs(input) {
9
11
  else if (typeof input.val === "string") {
10
12
  num_in = parseFloat(input.val);
11
13
  }
14
+ else if (input.val instanceof types_1.Float) {
15
+ num_in = input.val.getRaw();
16
+ }
12
17
  else {
13
18
  num_in = parseFloat(input.val.get().toString());
14
19
  }
@@ -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 += (match === null || match === void 0 ? void 0 : match.length) || 0;
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 : (_a = input.case) === null || _a === void 0 ? void 0 : _a.get();
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 = (_b = val.match(reg)) === null || _b === void 0 ? void 0 : _b.index;
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 : (_c = input.sub) === null || _c === void 0 ? void 0 : _c.get();
36
- let off = typeof input.off === "number" ? input.off : ((_d = input.off) === null || _d === void 0 ? void 0 : _d.get()) || 0;
37
- let occ = typeof input.occ === "number" ? input.occ : (_e = input.occ) === null || _e === void 0 ? void 0 : _e.get();
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 === null || mode === void 0 ? void 0 : mode.get();
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
- var _a, _b;
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 = (_b = input === null || input === void 0 ? void 0 : input.len) === null || _b === void 0 ? void 0 : _b.get();
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 === null || input === void 0 ? void 0 : input.regex) {
19
+ else if (input?.regex) {
20
20
  reg = input.regex.get();
21
21
  }
22
- else if (input === null || input === void 0 ? void 0 : input.pcre) {
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 === null || input === void 0 ? void 0 : input.sub) {
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 === null || input === void 0 ? void 0 : input.regex) {
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 === null || input === void 0 ? void 0 : input.sub) {
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,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.trunc = void 0;
4
+ /* eslint-disable radix */
5
+ const types_1 = require("../types");
4
6
  function trunc(input) {
5
7
  let num_in = undefined;
6
8
  if (typeof input.val === "number") {
@@ -9,6 +11,9 @@ function trunc(input) {
9
11
  else if (typeof input.val === "string") {
10
12
  num_in = parseFloat(input.val);
11
13
  }
14
+ else if (input.val instanceof types_1.Float) {
15
+ num_in = input.val.getRaw();
16
+ }
12
17
  else {
13
18
  num_in = parseFloat(input.val.get().toString());
14
19
  }
@@ -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 (((_a = row.get().sign) === null || _a === void 0 ? void 0 : _a.get()) !== "I" || ((_b = row.get().option) === null || _b === void 0 ? void 0 : _b.get()) !== "EQ") {
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("'" + ((_c = row.get().low) === null || _c === void 0 ? void 0 : _c.get().replace(/'/g, "''")) + "'");
20
+ values.push("'" + row.get().low?.get().replace(/'/g, "''") + "'");
22
21
  }
23
22
  ret += values.join(",") + ")";
24
23
  }
@@ -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 = (input === null || input === void 0 ? void 0 : input.console) ? input === null || input === void 0 ? void 0 : input.console : new standard_out_console_1.StandardOutConsole();
50
+ this.console = input?.console ? input?.console : new standard_out_console_1.StandardOutConsole();
51
51
  this.context.console = this.console;
52
- this.dbo = (input === null || input === void 0 ? void 0 : input.database) || { schemaPrefix: "", tablePrefix: "" };
52
+ this.dbo = input?.database || { schemaPrefix: "", tablePrefix: "" };
53
53
  if (this.dbo.schemaPrefix === undefined) {
54
54
  this.dbo.schemaPrefix = "";
55
55
  }
@@ -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 (((_a = input.source.getOptions()) === null || _a === void 0 ? void 0 : _a.withHeader) === true) {
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 = (_a = target.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
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 ((targetClass === null || targetClass === void 0 ? void 0 : targetClass.INTERNAL_TYPE) === "CLAS") {
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 && (targetClass === null || targetClass === void 0 ? void 0 : targetClass.INTERNAL_TYPE) === "INTF") {
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
- (_a = target.stamp) === null || _a === void 0 ? void 0 : _a.clear();
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
- (_b = target.date) === null || _b === void 0 ? void 0 : _b.clear();
71
- (_c = target.time) === null || _c === void 0 ? void 0 : _c.clear();
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 ((options === null || options === void 0 ? void 0 : options.name) && (options === null || options === void 0 ? void 0 : options.table)) {
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 === null || options === void 0 ? void 0 : options.name) {
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 === null || options === void 0 ? void 0 : options.typeName) {
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 === null || options === void 0 ? void 0 : options.type) {
179
+ else if (options?.type) {
180
180
  target.assign((0, clone_1.clone)(options.type));
181
181
  }
182
- else if (options === null || options === void 0 ? void 0 : options.likeLineOf) {
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 === null || options === void 0 ? void 0 : options.like) {
188
+ else if (options?.like) {
189
189
  if (options.like instanceof types_1.FieldSymbol) {
190
190
  options.like = options.like.getPointer();
191
191
  }
@@ -1,18 +1,10 @@
1
1
  "use strict";
2
- var __asyncValues = (this && this.__asyncValues) || function (o) {
3
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
4
- var m = o[Symbol.asyncIterator], i;
5
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
6
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
8
- };
9
2
  Object.defineProperty(exports, "__esModule", { value: true });
10
3
  exports.deleteInternal = void 0;
11
4
  const types_1 = require("../types");
12
5
  const compare_1 = require("../compare");
13
6
  const loop_1 = require("./loop");
14
7
  async function deleteInternal(target, options) {
15
- var _a, e_1, _b, _c;
16
8
  let index = 0;
17
9
  if (target instanceof types_1.FieldSymbol) {
18
10
  target = target.getPointer();
@@ -20,12 +12,12 @@ async function deleteInternal(target, options) {
20
12
  throw new Error("deleteInternal, FS not assigned");
21
13
  }
22
14
  }
23
- if ((options === null || options === void 0 ? void 0 : options.index)
24
- && (options === null || options === void 0 ? void 0 : options.where) === undefined
25
- && (options === null || options === void 0 ? void 0 : options.adjacent) === undefined
26
- && (options === null || options === void 0 ? void 0 : options.fromValue) === undefined
27
- && (options === null || options === void 0 ? void 0 : options.from) === undefined
28
- && (options === null || options === void 0 ? void 0 : options.to) === undefined) {
15
+ if (options?.index
16
+ && options?.where === undefined
17
+ && options?.adjacent === undefined
18
+ && options?.fromValue === undefined
19
+ && options?.from === undefined
20
+ && options?.to === undefined) {
29
21
  if (target.array()[options.index.get() - 1] === undefined) {
30
22
  // @ts-ignore
31
23
  abap.builtin.sy.get().subrc.set(4);
@@ -38,8 +30,8 @@ async function deleteInternal(target, options) {
38
30
  return;
39
31
  }
40
32
  }
41
- if (options === null || options === void 0 ? void 0 : options.to) {
42
- if ((options === null || options === void 0 ? void 0 : options.from) !== undefined || (options === null || options === void 0 ? void 0 : options.where) !== undefined) {
33
+ if (options?.to) {
34
+ if (options?.from !== undefined || options?.where !== undefined) {
43
35
  throw "DeleteInternalTodo";
44
36
  }
45
37
  for (let i = 0; i < options.to.get(); i++) {
@@ -47,7 +39,7 @@ async function deleteInternal(target, options) {
47
39
  }
48
40
  return;
49
41
  }
50
- if ((options === null || options === void 0 ? void 0 : options.adjacent) === true) {
42
+ if (options?.adjacent === true) {
51
43
  if (target instanceof types_1.HashedTable) {
52
44
  throw new Error("delete adjacent, hashed table");
53
45
  }
@@ -55,7 +47,7 @@ async function deleteInternal(target, options) {
55
47
  for (let index = array.length - 1; index > 0; index--) {
56
48
  const prev = array[index - 1];
57
49
  const i = array[index];
58
- if (options === null || options === void 0 ? void 0 : options.comparing) {
50
+ if (options?.comparing) {
59
51
  let match = false;
60
52
  for (const compareField of options.comparing) {
61
53
  match = (0, compare_1.eq)(prev.get()[compareField], i.get()[compareField]);
@@ -73,53 +65,41 @@ async function deleteInternal(target, options) {
73
65
  }
74
66
  return;
75
67
  }
76
- if (target instanceof types_1.HashedTable && (options === null || options === void 0 ? void 0 : options.fromValue)) {
68
+ if (target instanceof types_1.HashedTable && options?.fromValue) {
77
69
  target.deleteFrom(options.fromValue);
78
70
  return;
79
71
  }
80
72
  // @ts-ignore
81
73
  const originalTabix = abap.builtin.sy.get().tabix.get();
82
- try {
83
- for (var _d = true, _e = __asyncValues((0, loop_1.loop)(target)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
84
- _c = _f.value;
85
- _d = false;
86
- const i = _c;
87
- // @ts-ignore
88
- index = abap.builtin.sy.get().tabix.get() - 1;
89
- if (options === null || options === void 0 ? void 0 : options.where) {
90
- const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
91
- if (options.where(row) === true) {
92
- if (target instanceof types_1.HashedTable) {
93
- target.deleteFrom(i);
94
- }
95
- else {
96
- target.deleteIndex(index);
97
- }
74
+ for await (const i of (0, loop_1.loop)(target)) {
75
+ // @ts-ignore
76
+ index = abap.builtin.sy.get().tabix.get() - 1;
77
+ if (options?.where) {
78
+ const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
79
+ if (options.where(row) === true) {
80
+ if (target instanceof types_1.HashedTable) {
81
+ target.deleteFrom(i);
82
+ }
83
+ else {
84
+ target.deleteIndex(index);
98
85
  }
99
- }
100
- else if ((options === null || options === void 0 ? void 0 : options.index) && options.index.get() === index) {
101
- target.deleteIndex(options.index.get() - 1);
102
- break;
103
- }
104
- else if ((options === null || options === void 0 ? void 0 : options.fromValue) && (0, compare_1.eq)(options.fromValue, i)) {
105
- target.deleteIndex(index);
106
- }
107
- else if ((options === null || options === void 0 ? void 0 : options.from) && options.from.get() <= index + 1) {
108
- target.deleteIndex(index);
109
- }
110
- else if (options === undefined && originalTabix === index + 1) {
111
- // short form, "DELETE tab"
112
- target.deleteIndex(index);
113
- break;
114
86
  }
115
87
  }
116
- }
117
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
118
- finally {
119
- try {
120
- if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
88
+ else if (options?.index && options.index.get() === index) {
89
+ target.deleteIndex(options.index.get() - 1);
90
+ break;
91
+ }
92
+ else if (options?.fromValue && (0, compare_1.eq)(options.fromValue, i)) {
93
+ target.deleteIndex(index);
94
+ }
95
+ else if (options?.from && options.from.get() <= index + 1) {
96
+ target.deleteIndex(index);
97
+ }
98
+ else if (options === undefined && originalTabix === index + 1) {
99
+ // short form, "DELETE tab"
100
+ target.deleteIndex(index);
101
+ break;
121
102
  }
122
- finally { if (e_1) throw e_1.error; }
123
103
  }
124
104
  }
125
105
  exports.deleteInternal = deleteInternal;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describe = void 0;
4
4
  const types_1 = require("../types");
5
5
  function describe(input) {
6
- var _a;
7
6
  // console.dir(input);
8
7
  if (input.type) {
9
8
  if (input.field instanceof types_1.FieldSymbol) {
@@ -87,7 +86,7 @@ function describe(input) {
87
86
  if (input.table) {
88
87
  // @ts-ignore
89
88
  abap.builtin.sy.get().tfill.set(input.table.getArrayLength());
90
- (_a = input.lines) === null || _a === void 0 ? void 0 : _a.set(input.table.getArrayLength());
89
+ input.lines?.set(input.table.getArrayLength());
91
90
  }
92
91
  }
93
92
  exports.describe = describe;
@@ -4,8 +4,7 @@ exports.find = void 0;
4
4
  const abap_regex_1 = require("../abap_regex");
5
5
  const types_1 = require("../types");
6
6
  function find(input, options) {
7
- var _a, _b, _c, _d, _e, _f, _g;
8
- let sectionOffset = (_a = options.sectionOffset) === null || _a === void 0 ? void 0 : _a.get();
7
+ let sectionOffset = options.sectionOffset?.get();
9
8
  if (sectionOffset && options.byteMode) {
10
9
  sectionOffset = sectionOffset * 2;
11
10
  }
@@ -76,7 +75,7 @@ function find(input, options) {
76
75
  let temp;
77
76
  // eslint-disable-next-line no-cond-assign
78
77
  while (temp = s.exec(blah.get())) {
79
- matches.push(Object.assign(Object.assign({}, temp), { line }));
78
+ matches.push({ ...temp, line });
80
79
  if (options.first === true) {
81
80
  break;
82
81
  }
@@ -157,7 +156,7 @@ function find(input, options) {
157
156
  // @ts-ignore
158
157
  abap.builtin.sy.get().subrc.set(0);
159
158
  }
160
- if (((_b = matches[0]) === null || _b === void 0 ? void 0 : _b.index) !== undefined) {
159
+ if (matches[0]?.index !== undefined) {
161
160
  let val = matches[0].index;
162
161
  if (sectionOffset) {
163
162
  val += sectionOffset;
@@ -165,19 +164,19 @@ function find(input, options) {
165
164
  if (options.byteMode) {
166
165
  val = val / 2;
167
166
  }
168
- (_c = options.offset) === null || _c === void 0 ? void 0 : _c.set(val);
167
+ options.offset?.set(val);
169
168
  }
170
- if (options === null || options === void 0 ? void 0 : options.count) {
171
- (_d = options.count) === null || _d === void 0 ? void 0 : _d.set(matches.length);
169
+ if (options?.count) {
170
+ options.count?.set(matches.length);
172
171
  }
173
172
  else {
174
- (_e = options.count) === null || _e === void 0 ? void 0 : _e.clear();
173
+ options.count?.clear();
175
174
  }
176
- if ((options === null || options === void 0 ? void 0 : options.length) && matches && matches[0]) {
177
- (_f = options.length) === null || _f === void 0 ? void 0 : _f.set(matches[0][0].length);
175
+ if (options?.length && matches && matches[0]) {
176
+ options.length?.set(matches[0][0].length);
178
177
  }
179
178
  else {
180
- (_g = options.length) === null || _g === void 0 ? void 0 : _g.clear();
179
+ options.length?.clear();
181
180
  }
182
181
  }
183
182
  exports.find = find;
@@ -12,7 +12,7 @@ function getTime(options) {
12
12
  if (options === undefined) {
13
13
  options = {};
14
14
  }
15
- if ((options === null || options === void 0 ? void 0 : options.sy) === undefined) {
15
+ if (options?.sy === undefined) {
16
16
  // @ts-ignore
17
17
  options.sy = abap.builtin.sy;
18
18
  }
@@ -20,10 +20,10 @@ function getTime(options) {
20
20
  options.sy.get().datum.set(date);
21
21
  options.sy.get().timlo.set(time);
22
22
  options.sy.get().uzeit.set(time);
23
- if (options === null || options === void 0 ? void 0 : options.field) {
23
+ if (options?.field) {
24
24
  options.field.set(time);
25
25
  }
26
- if (options === null || options === void 0 ? void 0 : options.stamp) {
26
+ if (options?.stamp) {
27
27
  options.stamp.set(date + time);
28
28
  }
29
29
  }
@@ -164,7 +164,7 @@ class Statements {
164
164
  target.set(num);
165
165
  }
166
166
  async fetchNextCursor(cursor, target, packageSize) {
167
- await (0, fetch_next_cursor_1.fetchNextCursor)(this.context, cursor.get(), target, (packageSize === null || packageSize === void 0 ? void 0 : packageSize.get()) || 0);
167
+ await (0, fetch_next_cursor_1.fetchNextCursor)(this.context, cursor.get(), target, packageSize?.get() || 0);
168
168
  }
169
169
  async closeCursor(cursor) {
170
170
  await (0, close_cursor_1.closeCursor)(this.context, cursor.get());
@@ -7,7 +7,6 @@ const types_1 = require("../types");
7
7
  const read_table_1 = require("./read_table");
8
8
  const sort_1 = require("./sort");
9
9
  function insertInternal(options) {
10
- var _a, _b, _c, _d, _e;
11
10
  if (options.table instanceof types_1.FieldSymbol) {
12
11
  if (options.table.getPointer() === undefined) {
13
12
  throw new Error("GETWA_NOT_ASSIGNED");
@@ -21,16 +20,15 @@ function insertInternal(options) {
21
20
  options.data = options.data.getPointer();
22
21
  }
23
22
  const tableOptions = options.table.getOptions();
24
- let isSorted = ((_a = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.primaryKey) === null || _a === void 0 ? void 0 : _a.type) === types_1.TableAccessType.sorted
25
- || ((_b = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.primaryKey) === null || _b === void 0 ? void 0 : _b.type) === types_1.TableAccessType.hashed;
23
+ let isSorted = tableOptions?.primaryKey?.type === types_1.TableAccessType.sorted
24
+ || tableOptions?.primaryKey?.type === types_1.TableAccessType.hashed;
26
25
  if (options.table instanceof types_1.HashedTable) {
27
26
  isSorted = false;
28
27
  }
29
28
  else if (isSorted) {
30
29
  const insert = options.data instanceof types_1.Structure ? options.data.get() : { table_line: options.data };
31
30
  let compare = (row) => {
32
- var _a;
33
- for (const key of ((_a = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.primaryKey) === null || _a === void 0 ? void 0 : _a.keyFields) || []) {
31
+ for (const key of tableOptions?.primaryKey?.keyFields || []) {
34
32
  if (key.includes("-")) {
35
33
  const [first, second] = key.split("-");
36
34
  if ((0, compare_1.ne)(row[first.toLowerCase()].get()[second.toLowerCase()], insert[first.toLowerCase()].get()[second.toLowerCase()])) {
@@ -45,10 +43,10 @@ function insertInternal(options) {
45
43
  }
46
44
  return true;
47
45
  };
48
- if (((_c = tableOptions.primaryKey) === null || _c === void 0 ? void 0 : _c.isUnique) === true) {
46
+ if (tableOptions.primaryKey?.isUnique === true) {
49
47
  const withKeyValue = [];
50
48
  let binary = false;
51
- const data = options === null || options === void 0 ? void 0 : options.data;
49
+ const data = options?.data;
52
50
  if (data instanceof types_1.Structure) {
53
51
  const fieldName = tableOptions.primaryKey.keyFields[0].toLowerCase();
54
52
  if (fieldName !== "table_line" && fieldName.includes("-") === false) {
@@ -140,10 +138,10 @@ function insertInternal(options) {
140
138
  abap.builtin.sy.get().subrc.set(0);
141
139
  if (isSorted && !(options.table instanceof types_1.HashedTable)) {
142
140
  // slow, but works for now
143
- let by = (_e = (_d = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.primaryKey) === null || _d === void 0 ? void 0 : _d.keyFields) === null || _e === void 0 ? void 0 : _e.map(f => {
141
+ let by = tableOptions?.primaryKey?.keyFields?.map(f => {
144
142
  return { component: f.toLowerCase() };
145
143
  });
146
- if ((by === null || by === void 0 ? void 0 : by.length) === 1 && by[0].component === "table_line") {
144
+ if (by?.length === 1 && by[0].component === "table_line") {
147
145
  by = [];
148
146
  }
149
147
  if (by && by.length > 0) {