Skip to content

Commit 38e1763

Browse files
committed
jsc: fix tsc_helpers to handle object ctors
1 parent 46f7434 commit 38e1763

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

test-app/app/src/main/assets/internal/ts_helpers.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@
9292
Array.prototype.slice.call(arguments, 1)
9393
);
9494
} else {
95-
thiz = new (Function.prototype.bind.apply(
95+
thiz = new (Function.prototype.bind.apply(
9696
Extended,
9797
[null].concat(Array.prototype.slice.call(arguments, 1))
9898
))();
9999
}
100100
} else {
101-
thiz = new Extended();
101+
thiz = new Extended();
102102
}
103103
return thiz;
104104
};
@@ -107,10 +107,17 @@
107107
var Extended = extend(thiz);
108108
thiz.__container__ = true;
109109
if (args && args.length > 0) {
110-
thiz = new (Function.prototype.bind.apply(
111-
Extended,
112-
[null].concat(args)
113-
))();
110+
if (typeof Extended !== "function") {
111+
thiz = Reflect.construct(
112+
Extended,
113+
[null].concat(args)
114+
);
115+
} else {
116+
thiz = new (Function.prototype.bind.apply(
117+
Extended,
118+
[null].concat(args)
119+
))();
120+
}
114121
} else {
115122
thiz = new Extended();
116123
}

0 commit comments

Comments
 (0)