mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 14:48:40 +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.)
26 lines
346 B
Plaintext
26 lines
346 B
Plaintext
// Single expression body.
|
|
Fn.new { System.print("ok") }() // expect: ok
|
|
|
|
// Curly body.
|
|
Fn.new {
|
|
System.print("ok") // expect: ok
|
|
}()
|
|
|
|
// Multiple statements.
|
|
Fn.new {
|
|
System.print("1") // expect: 1
|
|
System.print("2") // expect: 2
|
|
}()
|
|
|
|
// Extra newlines.
|
|
Fn.new {
|
|
|
|
|
|
System.print("1") // expect: 1
|
|
|
|
|
|
System.print("2") // expect: 2
|
|
|
|
|
|
}()
|