feat: convert fiber tests to use block arguments instead of anonymous function literals
Update all fiber test files to replace `Fiber.create(fn { ... })` with `Fiber.create { ... }` block syntax, and add compiler support for parsing block bodies without requiring a newline after the opening brace. The compiler changes include removing `TOKEN_LEFT_BRACE` from the newline-discarding token list and adding `match(compiler, TOKEN_LINE)` calls in `finishBlock`, `methodCall`, `function`, and `block` to handle empty block bodies and inline expressions.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
var fiber = Fiber.create(fn {
|
||||
var fiber = Fiber.create {
|
||||
IO.print("fiber 1")
|
||||
Fiber.yield("yield 1")
|
||||
IO.print("fiber 2")
|
||||
Fiber.yield("yield 2")
|
||||
IO.print("fiber 3")
|
||||
})
|
||||
}
|
||||
|
||||
var result = fiber.run // expect: fiber 1
|
||||
IO.print(result) // expect: yield 1
|
||||
|
||||
Reference in New Issue
Block a user