Allow empty argument list methods.

- Compile them as calls and definitions.
- Use them for call(), clear(), run(), try(), and yield().
- Update the docs.
This commit is contained in:
Bob Nystrom
2015-02-26 23:08:36 -08:00
parent 1aaa8cff52
commit 96ceaa528b
94 changed files with 291 additions and 224 deletions
+4 -2
View File
@@ -1,5 +1,6 @@
class Foo {
method { 0 }
method { "getter" }
method() { "no args" }
method(a) { a }
method(a, b) { a + b }
method(a, b, c) { a + b + c }
@@ -19,7 +20,8 @@ class Foo {
}
var foo = new Foo
IO.print(foo.method) // expect: 0
IO.print(foo.method) // expect: getter
IO.print(foo.method()) // expect: no args
IO.print(foo.method(1)) // expect: 1
IO.print(foo.method(1, 2)) // expect: 3
IO.print(foo.method(1, 2, 3)) // expect: 6
+3
View File
@@ -0,0 +1,3 @@
var list = [1, 2]
list[] // expect error
"don't actually want error here, but cascades from above" // expect error
@@ -0,0 +1,3 @@
class Foo {
[] { "empty" } // expect error
}