jscript: Store exception code in exprval_t.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-08-02 17:40:42 +02:00 committed by Alexandre Julliard
parent 806ea12766
commit 7af8330e93
1 changed files with 9 additions and 2 deletions

View File

@ -58,6 +58,7 @@ typedef struct {
IDispatch *disp; IDispatch *disp;
DISPID id; DISPID id;
} idref; } idref;
HRESULT hres;
} u; } u;
} exprval_t; } exprval_t;
@ -221,6 +222,12 @@ static void exprval_release(exprval_t *val)
} }
} }
static inline void exprval_set_exception(exprval_t *val, HRESULT hres)
{
val->type = EXPRVAL_INVALID;
val->u.hres = hres;
}
/* ECMA-262 3rd Edition 8.7.1 */ /* ECMA-262 3rd Edition 8.7.1 */
static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *val, jsval_t *ret) static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *val, jsval_t *ret)
{ {
@ -537,7 +544,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
if(lookup_global_members(ctx, identifier, ret)) if(lookup_global_members(ctx, identifier, ret))
return S_OK; return S_OK;
ret->type = EXPRVAL_INVALID; exprval_set_exception(ret, JS_E_UNDEFINED_VARIABLE);
return S_OK; return S_OK;
} }
@ -1060,7 +1067,7 @@ static HRESULT interp_ident(script_ctx_t *ctx)
return hres; return hres;
if(exprval.type == EXPRVAL_INVALID) if(exprval.type == EXPRVAL_INVALID)
return throw_type_error(ctx, JS_E_UNDEFINED_VARIABLE, arg); return throw_type_error(ctx, exprval.u.hres, arg);
hres = exprval_to_value(ctx, &exprval, &v); hres = exprval_to_value(ctx, &exprval, &v);
exprval_release(&exprval); exprval_release(&exprval);