Commit 7af8330e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Store exception code in exprval_t.

parent 806ea127
...@@ -58,6 +58,7 @@ typedef struct { ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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);
......
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