Start getting superclass constructors working.

This also means the metaclass inheritance hierarchy parallels
the regular inheritance chain so that the subclass can find
the superclass constructor.
This commit is contained in:
Bob Nystrom
2013-12-17 09:39:05 -08:00
parent 70e548657e
commit 271fcec81b
5 changed files with 99 additions and 10 deletions
+3 -4
View File
@@ -2,12 +2,14 @@ class Foo {
methodOnFoo { io.write("foo") }
method(a) { io.write("foo") }
method(a, b, c) { io.write("foo") }
override { io.write("foo") }
}
class Bar is Foo {
methodOnBar { io.write("bar") }
method(a, b) { io.write("bar") }
method(a, b, c, d) { io.write("bar") }
override { io.write("bar") }
}
var bar = Bar.new
@@ -19,9 +21,6 @@ bar.method(1) // expect: foo
bar.method(1, 2) // expect: bar
bar.method(1, 2, 3) // expect: foo
bar.method(1, 2, 3, 4) // expect: bar
bar.override // expect: bar
// TODO: Overriding.
// TODO: Private fields.
// TODO: Super (or inner) calls.
// TODO: Grammar for what expressions can follow "is".
// TODO: Prevent extending built-in types.