Jacek Caban : jscript: Use bytecode for assignment to member expression.

Alexandre Julliard julliard at winehq.org
Mon Dec 5 14:55:01 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec  5 11:11:59 2011 +0100

jscript: Use bytecode for assignment to member expression.

---

 dlls/jscript/compile.c |   16 ++++++++++++++++
 dlls/jscript/engine.c  |    5 ++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index a237093..93d780f 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -373,6 +373,22 @@ static HRESULT compile_assign_expression(compiler_ctx_t *ctx, binary_expression_
             return E_OUTOFMEMORY;
         break;
     }
+    case EXPR_MEMBER: {
+        member_expression_t *member_expr = (member_expression_t*)expr->expression1;
+
+        hres = compile_expression(ctx, member_expr->expression);
+        if(FAILED(hres))
+            return hres;
+
+        /* FIXME: Potential optimization */
+        hres = push_instr_str(ctx, OP_str, member_expr->identifier);
+        if(FAILED(hres))
+            return hres;
+
+        if(push_instr(ctx, OP_memberid) == -1)
+            return E_OUTOFMEMORY;
+        break;
+    }
     default:
         expr->expr.eval = assign_expression_eval;
         return compile_interp_fallback(ctx, &expr->expr);
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index e4d918f..2af2d75 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -3328,9 +3328,8 @@ HRESULT assign_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD fla
     }
 
     if(SUCCEEDED(hres)) {
-        hres = put_value(ctx, &exprval, &rval, ei);
-        if(FAILED(hres))
-            VariantClear(&rval);
+        assert(exprval.type != EXPRVAL_IDREF);
+        return throw_reference_error(ctx, ei, JS_E_ILLEGAL_ASSIGN, NULL);
     }
 
     exprval_release(&exprval);




More information about the wine-cvs mailing list