Commit 9aafd031 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Use bytecode for assigning to array expression.

parent d3d2f063
......@@ -358,6 +358,21 @@ static HRESULT compile_assign_expression(compiler_ctx_t *ctx, binary_expression_
return hres;
break;
}
case EXPR_ARRAY: {
array_expression_t *array_expr = (array_expression_t*)expr->expression1;
hres = compile_expression(ctx, array_expr->member_expr);
if(FAILED(hres))
return hres;
hres = compile_expression(ctx, array_expr->expression);
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);
......
......@@ -1573,6 +1573,41 @@ HRESULT member_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD fla
return hres;
}
/* ECMA-262 3rd Edition 11.2.1 */
static HRESULT interp_memberid(exec_ctx_t *ctx)
{
VARIANT *objv, *namev;
IDispatch *obj;
BSTR name;
DISPID id;
HRESULT hres;
TRACE("\n");
namev = stack_pop(ctx);
objv = stack_pop(ctx);
hres = to_object(ctx->parser->script, objv, &obj);
VariantClear(objv);
if(SUCCEEDED(hres)) {
hres = to_string(ctx->parser->script, namev, &ctx->ei, &name);
if(FAILED(hres))
IDispatch_Release(obj);
}
VariantClear(namev);
if(FAILED(hres))
return hres;
hres = disp_get_id(ctx->parser->script, obj, name, fdexNameEnsure, &id);
SysFreeString(name);
if(FAILED(hres)) {
IDispatch_Release(obj);
return hres;
}
return stack_push_objid(ctx, obj, id);
}
static void free_dp(DISPPARAMS *dp)
{
DWORD i;
......
......@@ -62,6 +62,7 @@ typedef struct _func_stack {
X(jmp_z, 0, ARG_ADDR, 0) \
X(lt, 1, 0,0) \
X(lteq, 1, 0,0) \
X(memberid, 1, 0,0) \
X(minus, 1, 0,0) \
X(mod, 1, 0,0) \
X(mul, 1, 0,0) \
......
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