Simn / genjvm

13 stars 1 forks source link

super.calls() #7

Closed Simn closed 5 years ago

Simn commented 5 years ago

This currently doesn't compile:

class Base {
    function test() {
        trace("Base.test");
    }
}

class Main extends Base {
    static public function main() { }

    function new() { }

    override function test() {
        trace("Main.test");
        super.test();
    }
}

I have to check which instruction to use for this. I think it's invokespecial.

nadako commented 5 years ago

Invoke instance method; special handling for superclass, private, and instance initialization method invocations

so we can also call private methods in the bytecode?

Simn commented 5 years ago

Yes

Not sure if that helps us much though because it only applies to (non-static) methods.

nadako commented 5 years ago

I'm asking because it would be nice to generate private methods as proper private for non-haxe consumers, but still have all the inline/closure/etc niceties.