From 5b2c2c5cf924ca8d99ce132b1f58e7f260dd2a7b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 5 Dec 2011 11:11:59 +0100 Subject: [PATCH] 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 a2370930faf..93d780faa4c 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 e4d918f58d3..2af2d75ca4b 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);