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
This commit is contained in:
@@ -16,10 +16,10 @@ var g = null
|
||||
}
|
||||
}
|
||||
|
||||
f.call
|
||||
f.call()
|
||||
// expect: local
|
||||
// expect: after f
|
||||
|
||||
g.call
|
||||
g.call()
|
||||
// expect: after f
|
||||
// expect: after g
|
||||
|
||||
@@ -6,4 +6,4 @@ new Fn {|param|
|
||||
}
|
||||
}.call("param")
|
||||
|
||||
f.call // expect: param
|
||||
f.call() // expect: param
|
||||
|
||||
@@ -9,5 +9,5 @@ new Fn {
|
||||
new Fn {
|
||||
IO.print(b) // expect: b
|
||||
IO.print(a) // expect: a
|
||||
}.call
|
||||
}.call
|
||||
}.call()
|
||||
}.call()
|
||||
|
||||
@@ -9,4 +9,4 @@ class Foo {
|
||||
}
|
||||
|
||||
(new Foo).method("param")
|
||||
F.call // expect: param
|
||||
F.call() // expect: param
|
||||
|
||||
@@ -7,4 +7,4 @@ var f = null
|
||||
}
|
||||
}
|
||||
|
||||
f.call // expect: local
|
||||
f.call() // expect: local
|
||||
|
||||
@@ -11,11 +11,11 @@ new Fn {
|
||||
IO.print(b)
|
||||
IO.print(c)
|
||||
}
|
||||
}.call
|
||||
}.call
|
||||
}.call
|
||||
}.call()
|
||||
}.call()
|
||||
}.call()
|
||||
|
||||
f.call
|
||||
f.call()
|
||||
// expect: a
|
||||
// expect: b
|
||||
// expect: c
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
var local = "local"
|
||||
new Fn {
|
||||
IO.print(local) // expect: local
|
||||
}.call
|
||||
}.call()
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ var f = null
|
||||
}
|
||||
}
|
||||
|
||||
f.call
|
||||
f.call()
|
||||
// expect: a
|
||||
// expect: a
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// Since a is out of scope, the local slot will be reused by b. Make sure
|
||||
// that f still closes over a.
|
||||
var b = "b"
|
||||
f.call // expect: a
|
||||
f.call() // expect: a
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
IO.print(foo) // expect: shadow
|
||||
}
|
||||
IO.print(foo) // expect: closure
|
||||
}.call
|
||||
}.call()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user