@abaplint/runtime 2.8.25 → 2.8.26

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.
@@ -1,4 +1,4 @@
1
- import { ABAPObject, HashedTable, Structure, Table } from "../types";
1
+ import { ABAPObject, HashedTable, Integer8, Structure, Table } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
3
  import { INumeric } from "../types/_numeric";
4
- export declare function gt(left: number | string | ICharacter | INumeric | ABAPObject | Structure | Table | HashedTable, right: number | string | ICharacter | INumeric | ABAPObject | Structure | Table | HashedTable): boolean;
4
+ export declare function gt(left: number | string | ICharacter | INumeric | ABAPObject | Structure | Table | HashedTable | Integer8, right: number | string | ICharacter | INumeric | ABAPObject | Structure | Table | HashedTable | Integer8): boolean;
@@ -5,6 +5,43 @@ const _parse_1 = require("../operators/_parse");
5
5
  const types_1 = require("../types");
6
6
  const integer_1 = require("../types/integer");
7
7
  function gt(left, right) {
8
+ if (right instanceof integer_1.Integer) {
9
+ if (left instanceof integer_1.Integer) {
10
+ return left.get() > right.get();
11
+ }
12
+ else if (left instanceof types_1.Float) {
13
+ return left.getRaw() > right.get();
14
+ }
15
+ else if (left instanceof types_1.Character) {
16
+ return (0, _parse_1.parse)(left) > right.get();
17
+ }
18
+ else if (left instanceof types_1.Integer8) {
19
+ const l = left.get();
20
+ const r = BigInt(right.get());
21
+ return l > r;
22
+ }
23
+ }
24
+ else if (right instanceof types_1.Float) {
25
+ if (left instanceof types_1.Float) {
26
+ return left.getRaw() > right.getRaw();
27
+ }
28
+ else if (left instanceof integer_1.Integer) {
29
+ return left.get() > right.getRaw();
30
+ }
31
+ else if (left instanceof types_1.Integer8) {
32
+ const l = left.get();
33
+ const r = BigInt(right.getRaw());
34
+ return l > r;
35
+ }
36
+ }
37
+ else if (right instanceof types_1.Integer8) {
38
+ if (left instanceof types_1.Table || left instanceof types_1.HashedTable) {
39
+ throw new Error("runtime_todo, gt TABLE");
40
+ }
41
+ const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
42
+ const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
43
+ return l > r;
44
+ }
8
45
  if (left instanceof types_1.FieldSymbol) {
9
46
  if (left.getPointer() === undefined) {
10
47
  throw new Error("GETWA_NOT_ASSIGNED");
@@ -20,12 +57,12 @@ function gt(left, right) {
20
57
  if (left instanceof types_1.Table || right instanceof types_1.Table || left instanceof types_1.HashedTable || right instanceof types_1.HashedTable) {
21
58
  throw new Error("runtime_todo, gt TABLE");
22
59
  }
23
- if (left instanceof types_1.Hex || right instanceof types_1.Hex || left instanceof types_1.HexUInt8 || right instanceof types_1.HexUInt8) {
60
+ else if (left instanceof types_1.Hex || right instanceof types_1.Hex || left instanceof types_1.HexUInt8 || right instanceof types_1.HexUInt8) {
24
61
  return gt_with_hex(left, right);
25
62
  }
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));
63
+ if (left instanceof types_1.Integer8) {
64
+ const l = left.get();
65
+ const r = BigInt((0, _parse_1.parse)(right));
29
66
  return l > r;
30
67
  }
31
68
  let l = undefined;
@@ -67,12 +104,13 @@ function gt(left, right) {
67
104
  if (l === undefined) {
68
105
  return true; // todo, not sure this is correct
69
106
  }
70
- if (r === undefined) {
107
+ else if (r === undefined) {
71
108
  return true; // todo, not sure this is correct
72
109
  }
73
110
  return l > r;
74
111
  }
75
112
  exports.gt = gt;
113
+ ///////////////////////////////////////////////////////////////////
76
114
  function gt_with_hex(left, right) {
77
115
  const left_hex = get_hex_from_parameter(left);
78
116
  const right_hex = get_hex_from_parameter(right);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.8.25",
3
+ "version": "2.8.26",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -37,6 +37,6 @@
37
37
  "typescript": "^5.4.5"
38
38
  },
39
39
  "dependencies": {
40
- "temporal-polyfill": "^0.2.4"
40
+ "temporal-polyfill": "^0.2.5"
41
41
  }
42
42
  }