1
0
forked from Mirror/wren
Files
wren/test/core/fiber/transfer_error.wren
Bob Nystrom b05a74da19 Revamp how runtime errors and fiber switching is handled.
- Add Fiber.transferError(_).
- Primitives place runtime errors directly in the fiber instead of on
  the stack.
- Primitives that change fibers set it directly in the VM.
- Allow a fiber's error to be any object (except null).
2015-09-29 22:57:03 -07:00

16 lines
287 B
Plaintext

var A = Fiber.new {
System.print("transferred to A")
B.transferError("error!")
}
var B = Fiber.new {
System.print("started B")
A.transfer()
System.print("should not get here")
}
B.try()
// expect: started B
// expect: transferred to A
System.print(B.error) // expect: error!