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:
Bob Nystrom
2015-02-27 07:08:36 +00:00
parent 94f34367f9
commit 5382fa05d7
94 changed files with 291 additions and 224 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+1 -1
View File
@@ -7,4 +7,4 @@ var f = null
}
}
f.call // expect: local
f.call() // expect: local
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
}
}
+1 -1
View File
@@ -7,5 +7,5 @@
IO.print(foo) // expect: shadow
}
IO.print(foo) // expect: closure
}.call
}.call()
}