mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-14 07:38:03 +01:00
- Allow this for both argument lists and block arguments.
- Tweak precedence to make "." higher than infix "{}" to avoid a
class body being parsed as the superclass clause's block argument.
- Convert all uses of ".call" to use this. (There was not a single
case in the repo that ran into the getter ambiguity.)
10 lines
244 B
Plaintext
10 lines
244 B
Plaintext
var fn = Fn.new {|arg| System.print(arg) }
|
|
|
|
fn("string") // expect: string
|
|
|
|
fn = Fn.new {|block| System.print(block()) }
|
|
fn { "block" } // expect: block
|
|
|
|
fn = Fn.new {|a, b, c| System.print("%(a) %(b) %(c())") }
|
|
fn(1, 2) { 3 } // expect: 1 2 3
|