mgusmano / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

dynamic type with .As<>() generate wrong code #274

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
C# source  (SignalR):
                dynamic hub = JsCode("$.connection.hub");
                hub.start().As<Deferred>()
                    .fail(new JsAction(this.Start_Failed))
                    .done(new JsAction(this.Start_OK));

What is the expected output? What do you see instead?

Javascript code :
        var hub =  $.connection.hub;
        hub.start().As().fail($CreateDelegate(this, this.Start_Failed)).done($CreateDelegate(this, this.Start_OK));

Should be :
        var hub =  $.connection.hub;
        hub.start().fail($CreateDelegate(this, this.Start_Failed)).done($CreateDelegate(this, this.Start_OK));

Original issue reported on code.google.com by maitred...@gmail.com on 24 Jan 2013 at 6:11

GoogleCodeExporter commented 8 years ago
Hi,
This is actually following the C# rules, since the As<> invocation over a 
dynamic instance should be resolved at runtime, the NRefactory parser will not 
detect it as the extension method. I would recommend that you use the NodeJs 
typed library in SharpKit, or try and use casting instead of invisible casting. 
If you need help with this feel free to drop me a line in the forum / support 
email.

Original comment by DanelK...@gmail.com on 17 May 2013 at 6:35