Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Allow classes to implement interface members with the same name in different methods #405

Open
erik-kallen opened this issue Mar 9, 2015 · 0 comments
Assignees
Milestone

Comments

@erik-kallen
Copy link
Contributor

This code should compile:

interface I1 { [ScriptName("m")] void M() {} }
interface I2 { [ScriptName("m")] void M() {} }

class C : I1, I2 {
    public void M() {
        Console.WriteLine("1");
    }

    void I2.M() {
        Console.WriteLine("2");
    }
}

...

C c = new C();
I2 i = c;
c.M();
i.M();

Expected output something like:

ss.initClass($Namespace_C, $asm, {
    m: function() {
        console.log('1');
    },
    $someOtherName: function() {
        console.log('2');
    }
});

...

var c = new $Namespace_C();
var i = { m: c.$someOtherName.bind(c) };
c.m();
i.m();

Need to ensure that this works with generics.

The solution should also work if the method implementing an interface member is explicitly renamed (even in imported classes). See #159.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant