@abaplint/runtime 2.7.103 → 2.7.104

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.
@@ -71,9 +71,9 @@ class Hex {
71
71
  if (length) {
72
72
  length = (0, _parse_1.parse)(length);
73
73
  }
74
- if ((offset && offset >= this.length)
75
- || (length && length > this.length)
76
- || (offset && length && offset + length > this.length)
74
+ if ((offset && offset * 2 > this.value.length)
75
+ || (length && length * 2 > this.value.length)
76
+ || (offset && length && offset * 2 + length * 2 > this.value.length)
77
77
  || (offset && offset < 0)
78
78
  || (length && length < 0)) {
79
79
  (0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
@@ -72,6 +72,8 @@ class String {
72
72
  length = (0, _parse_1.parse)(length);
73
73
  }
74
74
  if ((offset && offset > this.value.length)
75
+ || (length && length > this.value.length)
76
+ || (offset && length && offset + length > this.value.length)
75
77
  || (offset && offset < 0)
76
78
  || (length && length < 0)) {
77
79
  (0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
@@ -4,6 +4,7 @@ exports.XString = void 0;
4
4
  const _parse_1 = require("../operators/_parse");
5
5
  const float_1 = require("./float");
6
6
  const character_1 = require("./character");
7
+ const throw_error_1 = require("../throw_error");
7
8
  class XString {
8
9
  constructor(input) {
9
10
  this.value = "";
@@ -51,20 +52,29 @@ class XString {
51
52
  return this.value;
52
53
  }
53
54
  getOffset(input) {
54
- if (input === null || input === void 0 ? void 0 : input.offset) {
55
- input.offset = (0, _parse_1.parse)(input.offset);
55
+ let offset = input === null || input === void 0 ? void 0 : input.offset;
56
+ if (offset) {
57
+ offset = (0, _parse_1.parse)(offset);
56
58
  }
57
- if (input === null || input === void 0 ? void 0 : input.length) {
58
- input.length = (0, _parse_1.parse)(input.length);
59
+ let length = input === null || input === void 0 ? void 0 : input.length;
60
+ if (length) {
61
+ length = (0, _parse_1.parse)(length);
62
+ }
63
+ if ((offset && offset * 2 > this.value.length)
64
+ || (length && length * 2 > this.value.length)
65
+ || (offset && length && offset * 2 + length * 2 > this.value.length)
66
+ || (offset && offset < 0)
67
+ || (length && length < 0)) {
68
+ (0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
59
69
  }
60
70
  let ret = this.value;
61
- if (input === null || input === void 0 ? void 0 : input.offset) {
71
+ if (offset) {
62
72
  // @ts-ignore
63
- ret = ret.substr(input.offset * 2);
73
+ ret = ret.substr(offset * 2);
64
74
  }
65
- if ((input === null || input === void 0 ? void 0 : input.length) !== undefined) {
75
+ if (length !== undefined) {
66
76
  // @ts-ignore
67
- ret = ret.substr(0, input.length * 2);
77
+ ret = ret.substr(0, length * 2);
68
78
  }
69
79
  const r = new XString();
70
80
  r.set(ret);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.103",
3
+ "version": "2.7.104",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@types/chai": "^4.3.6",
32
+ "@types/chai": "^4.3.7",
33
33
  "@types/mocha": "^10.0.2",
34
34
  "chai": "^4.3.10",
35
35
  "mocha": "^10.2.0",