Commit 0c6b804e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added initial prototype of functions.

parent b2a93fe3
......@@ -424,11 +424,17 @@ HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, sourc
scope_chain_t *scope_chain, DispatchEx **ret)
{
FunctionInstance *function;
DispatchEx *prototype;
parameter_t *iter;
DWORD length = 0;
HRESULT hres;
hres = create_function(ctx->script, PROPF_CONSTR, NULL, &function);
hres = create_object(ctx->script, NULL, &prototype);
if(FAILED(hres))
return hres;
hres = create_function(ctx->script, PROPF_CONSTR, prototype, &function);
jsdisp_release(prototype);
if(FAILED(hres))
return hres;
......
......@@ -93,4 +93,27 @@ obj1.func = function () {
ok(obj1.func(true) === "test", "obj1.func(true) is not \"test\"");
function testConstr1() {
this.var1 = 1;
ok(this !== undefined, "this is undefined");
ok(arguments.length === 1, "arguments.length is not 1");
ok(arguments["0"] === true, "arguments[0] is not 1");
return false;
}
testConstr1.prototype.pvar = 1;
var obj2 = new testConstr1(true);
ok(typeof(obj2) === "object", "typeof(obj2) is not object");
ok(obj2.pvar === 1, "obj2.pvar is not 1");
testConstr1.prototype.pvar = 2;
ok(obj2.pvar === 2, "obj2.pvar is not 2");
obj2.pvar = 3;
testConstr1.prototype.pvar = 1;
ok(obj2.pvar === 3, "obj2.pvar is not 3");
reportSuccess();
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