diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index 3679dfe32e8..a2370930faf 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -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); diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index c445eab15eb..e4d918f58d3 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -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; diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 12329e87b32..a032f7b2971 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -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) \