* Allow prototype name as HopObject constructor function.
This commit is contained in:
parent
edfdfd5a79
commit
f759dbfa91
1 changed files with 5 additions and 1 deletions
|
@ -96,7 +96,11 @@ public class HopObjectCtor extends FunctionObject {
|
||||||
HopObject hobj = new HopObject(protoname, core, node, proto);
|
HopObject hobj = new HopObject(protoname, core, node, proto);
|
||||||
|
|
||||||
if (proto != null) {
|
if (proto != null) {
|
||||||
Object f = ScriptableObject.getProperty(proto, "__constructor__");
|
Object f = ScriptableObject.getProperty(proto, protoname);
|
||||||
|
if (!(f instanceof Function)) {
|
||||||
|
// backup compatibility: look up function constructor
|
||||||
|
f = ScriptableObject.getProperty(proto, "__constructor__");
|
||||||
|
}
|
||||||
if (f instanceof Function) {
|
if (f instanceof Function) {
|
||||||
((Function) f).call(cx, core.global, hobj, args);
|
((Function) f).call(cx, core.global, hobj, args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue