This repository has been archived by the owner on Mar 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
O.Prop1.Prop2 fails #6
Comments
public class Cls
{
private string prop = "property: Prop";
private InnerCls inner = new InnerCls();
public string Prop
{
get { return prop; }
set { prop = value; }
}
public InnerCls Inner
{
get { return inner; }
set { inner = value; }
}
}
public class InnerCls
{
private string a = "A";
public string A
{
get { return a; }
set { a = value; }
}
}
[Test]
public void TestInnerProp()
{
var engine = new ScriptEngine();
engine.EnableDebugging = true;
engine.ForceStrictMode = true;
JurassicExposer.RegisterInfos(typeof(InnerCls), new JurassicInfo("A", new JSPropertyAttribute()));
JurassicExposer.ExposeClass(typeof(InnerCls), engine);
JurassicExposer.RegisterInfos(typeof(Cls), new JurassicInfo("Prop", new JSPropertyAttribute()));
JurassicExposer.RegisterInfos(typeof(Cls), new JurassicInfo("Inner", new JSPropertyAttribute()));
JurassicExposer.ExposeClass(typeof(Cls), engine);
JurassicExposer.ExposeInstance(engine, new Cls(), "c");
JurassicExposer.ExposeFunction(engine, new Action<string>(Console.WriteLine), "log");
engine.Execute("log(\"Hello, \" + c.Inner.A + \"!\");");
} |
Hi, I finally got some time to look at this. It's a limitation of how RegisterInfos currently works: It will just register the infos from the first call and ignore any subsequent calls for the same type (I created issue #7 about this). Your code runs when it's changed like this: JurassicExposer.RegisterInfos(typeof(Cls),
new JurassicInfo("Prop", new JSPropertyAttribute()),
new JurassicInfo("Inner", new JSPropertyAttribute())
); |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
when O is exposed, Prop1 of type T2 is exposed and T2.Prop2 is exposed including types,
still O.Prop1.Prop2 fails with undefined error...
The text was updated successfully, but these errors were encountered: