jscript: Support passing EXPRVAL_JSVAL through JS stack.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9d1ae850df
commit
3c91e5ed60
|
@ -171,7 +171,10 @@ static HRESULT stack_push_exprval(script_ctx_t *ctx, exprval_t *val)
|
||||||
|
|
||||||
switch(val->type) {
|
switch(val->type) {
|
||||||
case EXPRVAL_JSVAL:
|
case EXPRVAL_JSVAL:
|
||||||
assert(0);
|
hres = stack_push(ctx, jsval_null());
|
||||||
|
if(SUCCEEDED(hres))
|
||||||
|
hres = stack_push(ctx, val->u.val);
|
||||||
|
return hres;
|
||||||
case EXPRVAL_IDREF:
|
case EXPRVAL_IDREF:
|
||||||
hres = stack_push(ctx, jsval_disp(val->u.idref.disp));
|
hres = stack_push(ctx, jsval_disp(val->u.idref.disp));
|
||||||
if(SUCCEEDED(hres))
|
if(SUCCEEDED(hres))
|
||||||
|
@ -245,6 +248,10 @@ static BOOL stack_topn_exprval(script_ctx_t *ctx, unsigned n, exprval_t *r)
|
||||||
assert(is_number(stack_topn(ctx, n)));
|
assert(is_number(stack_topn(ctx, n)));
|
||||||
r->u.hres = get_number(stack_topn(ctx, n));
|
r->u.hres = get_number(stack_topn(ctx, n));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
case JSV_NULL:
|
||||||
|
r->type = EXPRVAL_JSVAL;
|
||||||
|
r->u.val = stack_topn(ctx, n);
|
||||||
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -268,6 +275,9 @@ static HRESULT exprval_propput(script_ctx_t *ctx, exprval_t *ref, jsval_t v)
|
||||||
}
|
}
|
||||||
case EXPRVAL_IDREF:
|
case EXPRVAL_IDREF:
|
||||||
return disp_propput(ctx, ref->u.idref.disp, ref->u.idref.id, v);
|
return disp_propput(ctx, ref->u.idref.disp, ref->u.idref.id, v);
|
||||||
|
case EXPRVAL_JSVAL:
|
||||||
|
WARN("ignoring an attempt to set value reference\n");
|
||||||
|
return S_OK;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -281,6 +291,8 @@ static HRESULT exprval_propget(script_ctx_t *ctx, exprval_t *ref, jsval_t *r)
|
||||||
return jsval_copy(ctx->stack[ref->u.off], r);
|
return jsval_copy(ctx->stack[ref->u.off], r);
|
||||||
case EXPRVAL_IDREF:
|
case EXPRVAL_IDREF:
|
||||||
return disp_propget(ctx, ref->u.idref.disp, ref->u.idref.id, r);
|
return disp_propget(ctx, ref->u.idref.disp, ref->u.idref.id, r);
|
||||||
|
case EXPRVAL_JSVAL:
|
||||||
|
return jsval_copy(ref->u.val, r);
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -302,6 +314,17 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig
|
||||||
}
|
}
|
||||||
case EXPRVAL_IDREF:
|
case EXPRVAL_IDREF:
|
||||||
return disp_call(ctx, ref->u.idref.disp, ref->u.idref.id, flags, argc, argv, r);
|
return disp_call(ctx, ref->u.idref.disp, ref->u.idref.id, flags, argc, argv, r);
|
||||||
|
case EXPRVAL_JSVAL: {
|
||||||
|
IDispatch *obj;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = to_object(ctx, ref->u.val, &obj);
|
||||||
|
if(SUCCEEDED(hres)) {
|
||||||
|
hres = disp_call_value(ctx, obj, NULL, flags, argc, argv, r);
|
||||||
|
IDispatch_Release(obj);
|
||||||
|
}
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
Loading…
Reference in New Issue