@abaplint/runtime 2.8.15 → 2.8.16

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.
@@ -4,6 +4,7 @@ exports.eq = void 0;
4
4
  /* eslint-disable max-len */
5
5
  const types_1 = require("../types");
6
6
  const _parse_1 = require("../operators/_parse");
7
+ const initial_1 = require("./initial");
7
8
  function compareTables(left, right) {
8
9
  const leftArray = left.array();
9
10
  const rightArray = right.array();
@@ -106,10 +107,37 @@ function eq(left, right) {
106
107
  return false;
107
108
  }
108
109
  }
109
- else if (right instanceof types_1.Hex || right instanceof types_1.HexUInt8 || right instanceof types_1.XString) {
110
- if (left instanceof types_1.Hex || left instanceof types_1.XString || left instanceof types_1.HexUInt8) {
110
+ else if (right instanceof types_1.Hex || right instanceof types_1.XString || right instanceof types_1.HexUInt8) {
111
+ if (left instanceof types_1.Hex || left instanceof types_1.HexUInt8) {
112
+ // @ts-ignore
113
+ if (right.getLength && right.getLength() !== left.getLength()) {
114
+ return (0, initial_1.initial)(left) && (0, initial_1.initial)(right);
115
+ }
116
+ return right.get() === left.get();
117
+ }
118
+ else if (left instanceof types_1.XString) {
111
119
  return right.get() === left.get();
112
120
  }
121
+ /*
122
+ } else if (right instanceof HexUInt8) {
123
+ if (left instanceof XString) {
124
+ return right.get() === left.get();
125
+ } else if (left instanceof HexUInt8) {
126
+ // https://stackoverflow.com/questions/21553528/how-to-test-for-equality-in-arraybuffer-dataview-and-typedarray
127
+ const llen = left.getLength();
128
+ if (llen === right.getLength()) {
129
+ // todo: this can be optimized by creating multi byte views?
130
+ // new DataView(this.value.buffer).setInt32(0, 0, true);
131
+ for (let i = 0; i < llen; i++) {
132
+ if (right.getOffsetRaw(i) !== left.getOffsetRaw(i)) {
133
+ return false;
134
+ }
135
+ }
136
+ } else {
137
+ return initial(left) && initial(right);
138
+ }
139
+ }
140
+ */
113
141
  }
114
142
  else if (right instanceof types_1.ABAPObject) {
115
143
  if (left instanceof types_1.ABAPObject) {
@@ -53,6 +53,9 @@ class Hex {
53
53
  }
54
54
  return this.set(hex);
55
55
  }
56
+ else if (value instanceof Hex || value instanceof xstring_1.XString) {
57
+ this.value = value.get();
58
+ }
56
59
  else {
57
60
  const v = value.get();
58
61
  if (value instanceof float_1.Float) {
@@ -65,6 +65,12 @@ class HexUInt8 {
65
65
  hexString = hexString.padStart(this.length * 2, "0");
66
66
  }
67
67
  }
68
+ else if (value instanceof HexUInt8 || value instanceof xstring_1.XString) {
69
+ hexString = value.get();
70
+ if (hexString.length < this.length * 2) {
71
+ hexString = hexString.padEnd(this.length * 2, "0");
72
+ }
73
+ }
68
74
  else {
69
75
  const v = value.get();
70
76
  if (value instanceof float_1.Float) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.8.15",
3
+ "version": "2.8.16",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",