feat: allow super calls in static methods by removing compiler error and fixing metaclass binding

Remove the compiler check that prevented 'super' from being used inside static methods, and fix the runtime binding logic in bindMethod to correctly resolve the superclass for static method dispatch. The key change moves the metaclass lookup (classObj->obj.classObj) to occur before wrenBindMethodCode so that bytecode patching uses the actual class rather than the metaclass, while preserving the original class name for foreign method resolution.
This commit is contained in:
Bob Nystrom
2015-09-19 22:19:41 +00:00
parent a4922635f2
commit 3a8582af89
3 changed files with 10 additions and 12 deletions
@@ -1,5 +1,8 @@
class Foo {
static method {
super // expect error
static name {
System.print("Foo.name") // expect: Foo.name
System.print(super) // expect: Foo
}
}
Foo.name