@abaplint/runtime 2.7.20 → 2.7.21

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.
@@ -74,36 +74,31 @@ async function deleteInternal(target, options) {
74
74
  return;
75
75
  }
76
76
  try {
77
- for (var _d = true, _e = __asyncValues((0, loop_1.loop)(target)), _f; _f = await _e.next(), _a = _f.done, !_a;) {
77
+ for (var _d = true, _e = __asyncValues((0, loop_1.loop)(target)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
78
78
  _c = _f.value;
79
79
  _d = false;
80
- try {
81
- const i = _c;
82
- // @ts-ignore
83
- index = abap.builtin.sy.get().tabix.get() - 1;
84
- if (options === null || options === void 0 ? void 0 : options.where) {
85
- const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
86
- if (options.where(row) === true) {
87
- if (target instanceof types_1.HashedTable) {
88
- target.deleteFrom(i);
89
- }
90
- else {
91
- target.deleteIndex(index);
92
- }
80
+ const i = _c;
81
+ // @ts-ignore
82
+ index = abap.builtin.sy.get().tabix.get() - 1;
83
+ if (options === null || options === void 0 ? void 0 : options.where) {
84
+ const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
85
+ if (options.where(row) === true) {
86
+ if (target instanceof types_1.HashedTable) {
87
+ target.deleteFrom(i);
88
+ }
89
+ else {
90
+ target.deleteIndex(index);
93
91
  }
94
92
  }
95
- else if ((options === null || options === void 0 ? void 0 : options.index) && options.index.get() === index) {
96
- target.deleteIndex(options.index.get() - 1);
97
- }
98
- else if ((options === null || options === void 0 ? void 0 : options.fromValue) && (0, compare_1.eq)(options.fromValue, i)) {
99
- target.deleteIndex(index);
100
- }
101
- else if ((options === null || options === void 0 ? void 0 : options.from) && options.from.get() <= index + 1) {
102
- target.deleteIndex(index);
103
- }
104
93
  }
105
- finally {
106
- _d = true;
94
+ else if ((options === null || options === void 0 ? void 0 : options.index) && options.index.get() === index) {
95
+ target.deleteIndex(options.index.get() - 1);
96
+ }
97
+ else if ((options === null || options === void 0 ? void 0 : options.fromValue) && (0, compare_1.eq)(options.fromValue, i)) {
98
+ target.deleteIndex(index);
99
+ }
100
+ else if ((options === null || options === void 0 ? void 0 : options.from) && options.from.get() <= index + 1) {
101
+ target.deleteIndex(index);
107
102
  }
108
103
  }
109
104
  }
@@ -7,6 +7,7 @@ export * from "./field_symbol";
7
7
  export * from "./float";
8
8
  export * from "./hex";
9
9
  export * from "./integer";
10
+ export * from "./integer8";
10
11
  export * from "./numc";
11
12
  export * from "./packed";
12
13
  export * from "./string";
@@ -23,6 +23,7 @@ __exportStar(require("./field_symbol"), exports);
23
23
  __exportStar(require("./float"), exports);
24
24
  __exportStar(require("./hex"), exports);
25
25
  __exportStar(require("./integer"), exports);
26
+ __exportStar(require("./integer8"), exports);
26
27
  __exportStar(require("./numc"), exports);
27
28
  __exportStar(require("./packed"), exports);
28
29
  __exportStar(require("./string"), exports);
@@ -0,0 +1,16 @@
1
+ import { Float } from "./float";
2
+ import { Hex } from "./hex";
3
+ import { ICharacter } from "./_character";
4
+ import { INumeric } from "./_numeric";
5
+ import { Integer } from "./integer";
6
+ export declare class Integer8 implements INumeric {
7
+ private value;
8
+ private readonly qualifiedName;
9
+ constructor(input?: {
10
+ qualifiedName?: string;
11
+ });
12
+ getQualifiedName(): string | undefined;
13
+ set(value: INumeric | ICharacter | Hex | string | number | Integer8 | Integer | Float): this;
14
+ clear(): void;
15
+ get(): number;
16
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Integer8 = void 0;
4
+ const throw_error_1 = require("../throw_error");
5
+ const float_1 = require("./float");
6
+ const hex_1 = require("./hex");
7
+ const xstring_1 = require("./xstring");
8
+ const digits = new RegExp(/^\s*-?\+?\d+\.?\d* *$/i);
9
+ class Integer8 {
10
+ constructor(input) {
11
+ this.value = 0;
12
+ this.qualifiedName = input === null || input === void 0 ? void 0 : input.qualifiedName;
13
+ }
14
+ getQualifiedName() {
15
+ return this.qualifiedName;
16
+ }
17
+ set(value) {
18
+ if (typeof value === "number") {
19
+ this.value = Math.round(value);
20
+ }
21
+ else if (typeof value === "string") {
22
+ if (value.endsWith("-")) {
23
+ value = "-" + value.substring(0, value.length - 1);
24
+ }
25
+ if (value.trim().length === 0) {
26
+ value = "0";
27
+ }
28
+ else if (digits.test(value) === false) {
29
+ (0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
30
+ }
31
+ this.value = parseInt(value, 10);
32
+ }
33
+ else if (value instanceof float_1.Float) {
34
+ this.set(Math.round(value.getRaw()));
35
+ }
36
+ else if (value instanceof hex_1.Hex || value instanceof xstring_1.XString) {
37
+ let num = parseInt(value.get(), 16);
38
+ // handle two complement,
39
+ if (value instanceof hex_1.Hex && value.getLength() >= 4) {
40
+ const maxVal = Math.pow(2, value.get().length / 2 * 8);
41
+ if (num > maxVal / 2 - 1) {
42
+ num = num - maxVal;
43
+ }
44
+ }
45
+ this.set(num);
46
+ }
47
+ else {
48
+ this.set(value.get());
49
+ }
50
+ return this;
51
+ }
52
+ clear() {
53
+ this.value = 0;
54
+ }
55
+ get() {
56
+ return this.value;
57
+ }
58
+ }
59
+ exports.Integer8 = Integer8;
60
+ //# sourceMappingURL=integer8.js.map
@@ -16,13 +16,13 @@ var TableAccessType;
16
16
  TableAccessType["hashed"] = "HASHED";
17
17
  TableAccessType["index"] = "INDEX";
18
18
  TableAccessType["any"] = "ANY";
19
- })(TableAccessType = exports.TableAccessType || (exports.TableAccessType = {}));
19
+ })(TableAccessType || (exports.TableAccessType = TableAccessType = {}));
20
20
  var TableKeyType;
21
21
  (function (TableKeyType) {
22
22
  TableKeyType["default"] = "DEFAULT";
23
23
  TableKeyType["user"] = "USER";
24
24
  TableKeyType["empty"] = "EMPTY";
25
- })(TableKeyType = exports.TableKeyType || (exports.TableKeyType = {}));
25
+ })(TableKeyType || (exports.TableKeyType = TableKeyType = {}));
26
26
  class LoopController {
27
27
  constructor(from, loopTo, array) {
28
28
  this.index = from;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.20",
3
+ "version": "2.7.21",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "chai": "^4.3.7",
35
35
  "mocha": "^10.2.0",
36
36
  "source-map-support": "^0.5.21",
37
- "typescript": "^5.0.4"
37
+ "typescript": "^5.1.3"
38
38
  },
39
39
  "dependencies": {
40
40
  "temporal-polyfill": "^0.1.1"