greybel-interpreter 4.0.17 → 4.0.19

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.
Files changed (2) hide show
  1. package/dist/vm.js +13 -6
  2. package/package.json +1 -1
package/dist/vm.js CHANGED
@@ -518,11 +518,17 @@ class VM {
518
518
  const value = frame.scope.value.get(arg.name);
519
519
  args.set(arg.name.toString(), value);
520
520
  }
521
- callback(this, frame.self, args).then((result) => {
522
- this.pushStack(result);
523
- this.resume(done);
524
- }).catch(done);
525
- return;
521
+ const immediateRet = callback(this, frame.self, args);
522
+ // Due to transformations it can happen that return values may not be PromiseLike
523
+ if (immediateRet === null || immediateRet === void 0 ? void 0 : immediateRet.then) {
524
+ immediateRet.then((ret) => {
525
+ this.pushStack(ret);
526
+ this.resume(done);
527
+ }).catch(done);
528
+ return;
529
+ }
530
+ this.pushStack(immediateRet);
531
+ break;
526
532
  }
527
533
  case instruction_1.OpCode.SLICE: {
528
534
  const b = this.popStack();
@@ -694,8 +700,9 @@ class VM {
694
700
  this.debugger.resume().then(() => {
695
701
  this.resume(done);
696
702
  }).catch(done);
703
+ return;
697
704
  }
698
- return;
705
+ break;
699
706
  }
700
707
  case instruction_1.OpCode.BREAKPOINT_ENABLE: {
701
708
  this.debugger.setBreakpoint(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "4.0.17",
3
+ "version": "4.0.19",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",