@abaplint/runtime 2.1.66 → 2.1.68

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.
@@ -5,7 +5,18 @@ const types_1 = require("../types");
5
5
  const _parse_1 = require("./_parse");
6
6
  // todo, this will only work when the target value is an integer?
7
7
  function divide(left, right) {
8
- const val = (0, _parse_1.parse)(left) / (0, _parse_1.parse)(right);
8
+ const r = (0, _parse_1.parse)(right);
9
+ if (r === 0) {
10
+ // @ts-ignore
11
+ if (abap.Classes["CX_SY_ZERODIVIDE"] !== undefined) {
12
+ // @ts-ignore
13
+ throw new abap.Classes["CX_SY_ZERODIVIDE"]();
14
+ }
15
+ else {
16
+ throw "Global class CX_SY_ZERODIVIDE not found";
17
+ }
18
+ }
19
+ const val = (0, _parse_1.parse)(left) / r;
9
20
  return new types_1.Float().set(val);
10
21
  }
11
22
  exports.divide = divide;
@@ -30,7 +30,8 @@ class SelectDatabase {
30
30
  for (const column in rows[0]) {
31
31
  result[column] = (0, clone_1.clone)(target.get()[column]).set(rows[0][column]);
32
32
  }
33
- target.set(new types_1.Structure(result));
33
+ // @ts-ignore
34
+ abap.statements.moveCorresponding(new types_1.Structure(result), target);
34
35
  }
35
36
  else if (target instanceof types_1.Table) {
36
37
  for (const row of rows) {
@@ -31,10 +31,23 @@ class Structure {
31
31
  }
32
32
  else if (input instanceof Structure) {
33
33
  const obj = input.get();
34
- for (const f in obj) {
35
- // @ts-ignore
36
- this.value[f].set((0, clone_1.clone)(obj[f]));
34
+ const keys1 = Object.keys(obj);
35
+ const keys2 = Object.keys(this.value);
36
+ /*
37
+ console.dir(keys1);
38
+ console.dir(keys2);
39
+ */
40
+ for (let i = 0; i < keys1.length; i++) {
41
+ const key1 = keys1[i];
42
+ const key2 = keys2[i];
43
+ this.value[key2].set((0, clone_1.clone)(obj[key1]));
37
44
  }
45
+ /*
46
+ for (const f in obj) {
47
+ // @ts-ignore
48
+ this.value[f].set(clone(obj[f]));
49
+ }
50
+ */
38
51
  }
39
52
  else {
40
53
  this.setCharacter(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.1.66",
3
+ "version": "2.1.68",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",