Commit d7e4193d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added support for Function constructor called as a function.

parent 1c2dd4b3
......@@ -821,6 +821,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE("\n");
switch(flags) {
case DISPATCH_METHOD:
case DISPATCH_CONSTRUCT: {
IDispatch *ret;
......
......@@ -1869,6 +1869,16 @@ ok(tmp === undefined, "func() = " + tmp);
tmp = func.toString();
ok(tmp == "function anonymous() {\n\n}", "func.toString() = " + tmp);
// Function constructor called as function
func = Function("return 3;");
tmp = func();
ok(tmp === 3, "func() = " + tmp);
ok(func.call() === 3, "func.call() = " + tmp);
ok(func.length === 0, "func.length = " + func.length);
tmp = func.toString();
ok(tmp === "function anonymous() {\nreturn 3;\n}", "func.toString() = " + tmp);
func = (function() {
var tmp = 3;
return new Function("return tmp;");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment