Jacek Caban : jscript: Store exception code in exprval_t.

Alexandre Julliard julliard at winehq.org
Tue Aug 2 17:33:33 CDT 2016


Module: wine
Branch: master
Commit: 7af8330e932e9e04bad194b1af0f99cd8ef03046
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7af8330e932e9e04bad194b1af0f99cd8ef03046

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug  2 17:40:42 2016 +0200

jscript: Store exception code in exprval_t.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/engine.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 2c44112..ba408b8 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -58,6 +58,7 @@ typedef struct {
             IDispatch *disp;
             DISPID id;
         } idref;
+        HRESULT hres;
     } u;
 } 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 */
 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))
         return S_OK;
 
-    ret->type = EXPRVAL_INVALID;
+    exprval_set_exception(ret, JS_E_UNDEFINED_VARIABLE);
     return S_OK;
 }
 
@@ -1060,7 +1067,7 @@ static HRESULT interp_ident(script_ctx_t *ctx)
         return hres;
 
     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);
     exprval_release(&exprval);




More information about the wine-cvs mailing list