@abaplint/runtime 2.7.150 → 2.7.151

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.
@@ -78,6 +78,16 @@ function eq(left, right) {
78
78
  return false;
79
79
  }
80
80
  }
81
+ else if (right instanceof types_1.Hex) {
82
+ if (left instanceof types_1.Hex || left instanceof types_1.XString) {
83
+ return right.get() === left.get();
84
+ }
85
+ }
86
+ else if (right instanceof types_1.XString) {
87
+ if (left instanceof types_1.Hex || left instanceof types_1.XString) {
88
+ return right.get() === left.get();
89
+ }
90
+ }
81
91
  if (left instanceof types_1.Structure || right instanceof types_1.Structure) {
82
92
  if (!(right instanceof types_1.Structure)) {
83
93
  return eq(left.getCharacter(), right);
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initial = void 0;
4
4
  const types_1 = require("../types");
5
+ const REGEX_ZEROS = /^0+$/;
6
+ const REGEX_SPACES = /^ *$/;
5
7
  function initial(val) {
6
8
  // todo, refactor? add as method in each type instead?
7
9
  if (val instanceof types_1.Table || val instanceof types_1.HashedTable) {
@@ -14,10 +16,10 @@ function initial(val) {
14
16
  return val.get() === "00000000";
15
17
  }
16
18
  else if (val instanceof types_1.Numc) {
17
- return val.get().match(/^0+$/) !== null;
19
+ return val.get().match(REGEX_ZEROS) !== null;
18
20
  }
19
21
  else if (val instanceof types_1.Hex) {
20
- return val.get().match(/^0+$/) !== null;
22
+ return val.get().match(REGEX_ZEROS) !== null;
21
23
  }
22
24
  else if (val instanceof types_1.Time) {
23
25
  return val.get() === "000000";
@@ -26,7 +28,7 @@ function initial(val) {
26
28
  return val.getRaw() === 0;
27
29
  }
28
30
  else if (val instanceof types_1.Character) {
29
- return val.get().match(/^ *$/) !== null;
31
+ return val.get().match(REGEX_SPACES) !== null;
30
32
  }
31
33
  else if (val instanceof types_1.FieldSymbol && val.getPointer() === undefined) {
32
34
  throw new Error("FS not assigned");
@@ -130,7 +130,7 @@ class HashedTable {
130
130
  }
131
131
  buildHashFromSimple(data) {
132
132
  let hash = "";
133
- const rowType = (0, clone_1.clone)(this.getRowType());
133
+ const ttyp = this.getRowType();
134
134
  for (const k of this.options.primaryKey.keyFields) {
135
135
  let val = data[k.toLowerCase()];
136
136
  if (val instanceof structure_1.Structure) {
@@ -139,12 +139,17 @@ class HashedTable {
139
139
  else {
140
140
  // convert to correct type, eg Chars have specific length, or rounding,
141
141
  if (k === "TABLE_LINE") {
142
+ const rowType = (0, clone_1.clone)(ttyp);
143
+ rowType.set(val.get());
144
+ val = rowType.get();
145
+ }
146
+ else if (ttyp instanceof structure_1.Structure) {
147
+ const rowType = (0, clone_1.clone)(ttyp.get()[k.toLowerCase()]);
142
148
  rowType.set(val.get());
143
149
  val = rowType.get();
144
150
  }
145
151
  else {
146
- rowType.get()[k.toLowerCase()].set(val.get());
147
- val = rowType.get()[k.toLowerCase()].get();
152
+ throw new Error("HashedTable, buildHashFromSimple, unexpected type");
148
153
  }
149
154
  }
150
155
  hash += k + ":" + val + "|";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.150",
3
+ "version": "2.7.151",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",