What steps will reproduce the problem?
Build the following code:
[JsType(JsMode.Clr, Filename = "res/Default.js")]
public class BaseClass
{
public string A { get; set; }
public BaseClass(string a = null)
{
A = "foo";
}
}
[JsType(JsMode.Clr, Filename = "res/Default.js")]
public class SubclassNoCall : BaseClass
{
public string B { get; set; }
public SubclassNoCall(string s)
{
B = s;
}
}
[JsType(JsMode.Clr, Filename = "res/Default.js")]
public class SubclassExplicitCall : BaseClass
{
public string B { get; set; }
public SubclassExplicitCall(string s) : base()
{
B = s;
}
}
What is the expected output? What do you see instead?
Examine the compiler output (some boilerplate elided):
JsTypes.push(BaseClassBug$BaseClass);
var BaseClassBug$SubclassNoCall =
{
...
definition:
{
ctor: function (s)
{
this._B = null;
this.set_B(s);
}
}
};
JsTypes.push(BaseClassBug$SubclassNoCall);
var BaseClassBug$SubclassExplicitCall =
{
...
definition:
{
ctor: function (s)
{
this._B = null;
BaseClassBug.BaseClass.ctor.call(this, null);
this.set_B(s);
}
}
};
You'll notice that the call to the base constructor is only present in the
second (explicit) example. Obviously it's illegal for subclasses to not have
their base class constructors called, so this seems like a bug. If you remove
the default parameter for the constructor, everything works fine. My guess is
that there's some subtle bug when accounting for the default parameter and no
argument being passed to it from the subclass.
Original issue reported on code.google.com by kirk.w...@gmail.com on 9 Dec 2013 at 10:02
Original issue reported on code.google.com by
kirk.w...@gmail.com
on 9 Dec 2013 at 10:02