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
+25
View File
@@ -0,0 +1,25 @@
class A {
this new(arg) {
io.write("A.new " + arg)
}
}
class B is A {
this otherName(arg1, arg2) super.new(arg2) {
io.write("B.otherName " + arg1)
}
}
class C is B {
this create super.otherName("one", "two") {
io.write("C.create")
}
}
var c = C.create
// expect: A.new two
// expect: B.otherName one
// expect: C.create
io.write(c is A) // expect: true
io.write(c is B) // expect: true
io.write(c is C) // expect: true