feat: migrate all function literals from fn syntax to new Fn block syntax
Replace all occurrences of the old `fn` function literal syntax with the new `new Fn {|params| body}` block syntax across benchmark, test, and source files. Update the Wren compiler to handle the pipe operator as a block argument delimiter by removing `TOKEN_PIPE` from the newline-swallowing token list and adding explicit newline matching in `infixOp`. Adjust test expectations in `conditional/precedence.wren` to remove `fn`-based expressions and update `test/assignment/local.wren` to use the new syntax.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
var f0 = fn IO.print("zero")
|
||||
var f1 = fn(a) IO.print("one " + a)
|
||||
var f2 = fn(a, b) IO.print("two " + a + " " + b)
|
||||
var f3 = fn(a, b, c) IO.print("three " + a + " " + b + " " + c)
|
||||
var f0 = new Fn { IO.print("zero") }
|
||||
var f1 = new Fn {|a| IO.print("one " + a) }
|
||||
var f2 = new Fn {|a, b| IO.print("two " + a + " " + b) }
|
||||
var f3 = new Fn {|a, b, c| IO.print("three " + a + " " + b + " " + c) }
|
||||
|
||||
f0.call("a") // expect: zero
|
||||
f0.call("a", "b") // expect: zero
|
||||
|
||||
Reference in New Issue
Block a user