Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
f1fd125385 feat: allow yielding main fiber and expose current fiber reference
- Change Fiber.yield() to exit interpreter when no parent fiber exists instead of raising runtime error
- Add Fiber.current primitive to return the currently executing fiber object
- Update interpreter loop to stop execution when PRIM_RUN_FIBER receives null value
- Modify test expectations to reflect new yielding behavior from main fiber
2015-03-07 20:32:11 +00:00
Bob Nystrom
5382fa05d7 feat: allow empty argument list methods in calls, definitions, and docs
- Compile empty `()` as a valid method signature distinct from no parentheses
- Update `call()`, `clear()`, `run()`, `try()`, and `yield()` to use empty argument lists
- Revise documentation across multiple files to reflect new signature semantics
2015-02-27 07:08:36 +00:00
Bob Nystrom
8abfb4ec7d feat: add fiber.isDone property and runtime error checks for finished fiber operations
Add a new `isDone` native method to the Fiber class that returns true when the fiber has no remaining frames. Replace TODO comments with proper runtime error handling in `fiber_run`, `fiber_run1`, `fiber_yield`, and `fiber_yield1` to prevent running finished fibers or yielding from the main fiber. Include test cases verifying the new property and error conditions.
2014-01-13 14:58:27 +00:00