@abaplint/runtime 2.13.52 → 2.13.54

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.
@@ -13,13 +13,13 @@ class ABAPEventing {
13
13
  if (!this.registrations[event.EVENT_CLASS][event.EVENT_NAME]) {
14
14
  this.registrations[event.EVENT_CLASS][event.EVENT_NAME] = [];
15
15
  }
16
- const ref = forObject === "ALL" ? "ALL" : new WeakRef(forObject);
16
+ const target = forObject === "ALL" ? "ALL" : forObject.get();
17
17
  const handlers = this.registrations[event.EVENT_CLASS][event.EVENT_NAME];
18
18
  if (activation === true) {
19
19
  // todo: tackle duplicates
20
20
  handlers.push({
21
21
  handlers: methods,
22
- forObject: ref,
22
+ forObject: target === "ALL" ? "ALL" : new WeakRef(target),
23
23
  });
24
24
  }
25
25
  else {
@@ -27,7 +27,12 @@ class ABAPEventing {
27
27
  throw new Error("ABAPEventing.setHandler: deactivation of multiple methods not supported, todo");
28
28
  }
29
29
  // todo: comparing the functions via toString might give the wrong result
30
- const index = handlers.findIndex(handler => handler.forObject === ref && handler.handlers[0].toString() === methods[0].toString());
30
+ const index = handlers.findIndex(handler => {
31
+ const sameObject = handler.forObject === "ALL"
32
+ ? target === "ALL"
33
+ : target !== "ALL" && handler.forObject.deref() === target;
34
+ return sameObject && handler.handlers[0].toString() === methods[0].toString();
35
+ });
31
36
  if (index !== -1) {
32
37
  handlers.splice(index, 1);
33
38
  }
@@ -45,7 +50,7 @@ class ABAPEventing {
45
50
  await method(parameters);
46
51
  }
47
52
  }
48
- else if (handler.forObject.deref() === me) {
53
+ else if (handler.forObject.deref() === me.get()) {
49
54
  for (const method of handler.handlers) {
50
55
  await method(parameters);
51
56
  }
@@ -1,4 +1,4 @@
1
- import { ABAPObject, DataReference, FieldSymbol, Integer8, Structure, Table } from "../types";
1
+ import { ABAPObject, DataReference, DecFloat34, FieldSymbol, Integer8, Structure, Table } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
3
  import { INumeric } from "../types/_numeric";
4
- export declare function initial(val: ICharacter | INumeric | string | number | Integer8 | Structure | DataReference | FieldSymbol | Table | ABAPObject): boolean;
4
+ export declare function initial(val: ICharacter | INumeric | string | number | Integer8 | DecFloat34 | Structure | DataReference | FieldSymbol | Table | ABAPObject): boolean;
@@ -27,7 +27,7 @@ function initial(val) {
27
27
  else if (val instanceof types_1.Time) {
28
28
  return val.get() === "000000";
29
29
  }
30
- else if (val instanceof types_1.Float) {
30
+ else if (val instanceof types_1.Float || val instanceof types_1.DecFloat34) {
31
31
  return val.getRaw() === 0;
32
32
  }
33
33
  else if (val instanceof types_1.Character) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.13.52",
3
+ "version": "2.13.54",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",