@abaplint/runtime 2.12.25 → 2.12.27

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,12 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mod = mod;
4
+ const throw_error_1 = require("../throw_error");
4
5
  const types_1 = require("../types");
5
6
  const _parse_1 = require("./_parse");
6
7
  function mod(left, right) {
7
8
  if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
8
9
  const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
9
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
+ }
10
19
  let val = ((l % r) + r) % r;
11
20
  if (val < 0) {
12
21
  val = val * -1n;
@@ -15,6 +24,14 @@ function mod(left, right) {
15
24
  }
16
25
  const l = (0, _parse_1.parse)(left);
17
26
  const r = (0, _parse_1.parse)(right);
27
+ if (r === 0) {
28
+ if (l === 0) {
29
+ return new types_1.Integer().set(0);
30
+ }
31
+ else {
32
+ (0, throw_error_1.throwError)("CX_SY_ZERODIVIDE");
33
+ }
34
+ }
18
35
  let val = ((l % r) + r) % r;
19
36
  if (val < 0) {
20
37
  val = val * -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.12.25",
3
+ "version": "2.12.27",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",