@abaplint/runtime 2.8.10 → 2.8.12

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 { Character, Hex, Structure, XString } from "./types";
1
+ import { Character, FieldSymbol, Hex, Structure, XString } from "./types";
2
2
  import { ICharacter } from "./types/_character";
3
3
  import { INumeric } from "./types/_numeric";
4
4
  export interface IOffsetLengthOptions {
@@ -10,7 +10,7 @@ export declare class OffsetLength {
10
10
  private readonly offset?;
11
11
  private readonly length?;
12
12
  private readonly isHex;
13
- constructor(obj: ICharacter | Character | Hex | XString | Structure, options: IOffsetLengthOptions);
13
+ constructor(obj: ICharacter | Character | Hex | XString | Structure | FieldSymbol, options: IOffsetLengthOptions);
14
14
  get(): string;
15
15
  set(value: ICharacter | string): void;
16
16
  }
@@ -5,7 +5,13 @@ const types_1 = require("./types");
5
5
  class OffsetLength {
6
6
  constructor(obj, options) {
7
7
  this.obj = obj;
8
- this.isHex = obj instanceof types_1.Hex || obj instanceof types_1.XString;
8
+ if (this.obj instanceof types_1.FieldSymbol) {
9
+ this.obj = this.obj.getPointer();
10
+ if (this.obj === undefined) {
11
+ throw new Error("GETWA_NOT_ASSIGNED");
12
+ }
13
+ }
14
+ this.isHex = this.obj instanceof types_1.Hex || this.obj instanceof types_1.XString;
9
15
  if (options.offset) {
10
16
  if (typeof options.offset === "number") {
11
17
  this.offset = options.offset;
@@ -16,7 +16,16 @@ function div(left, right) {
16
16
  (0, throw_error_1.throwError)("CX_SY_ZERODIVIDE");
17
17
  }
18
18
  }
19
- return new types_1.Integer8().set(l / r);
19
+ const remainder = l % r;
20
+ let div = l / r;
21
+ if (remainder !== 0n) {
22
+ const sign1 = l < 0n;
23
+ const sign2 = r < 0n;
24
+ if (sign1 !== sign2) {
25
+ div = div - 1n;
26
+ }
27
+ }
28
+ return new types_1.Integer8().set(div);
20
29
  }
21
30
  const l = (0, _parse_1.parse)(left);
22
31
  const r = (0, _parse_1.parse)(right);
@@ -5,12 +5,8 @@ function setBit(number, hex, val) {
5
5
  if (number.get() <= 0) {
6
6
  throw new Error("BIT_OFFSET_NOT_POSITIVE");
7
7
  }
8
- let hexFull = hex.get();
9
- if (hexFull === "") {
10
- hexFull = "00";
11
- }
8
+ const hexFull = hex.get();
12
9
  const fullByteLength = Math.ceil(hexFull.length / 2);
13
- hexFull = hexFull.padEnd(fullByteLength * 2, "0");
14
10
  const byteNum = Math.ceil(number.get() / 8);
15
11
  if (byteNum > fullByteLength) {
16
12
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.8.10",
3
+ "version": "2.8.12",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",