Commit aa809f1b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added bytecode version of array expression.

parent 9c9157a1
......@@ -558,6 +558,8 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr,
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_add);
case EXPR_AND:
return compile_logical_expression(ctx, (binary_expression_t*)expr, OP_jmp_z);
case EXPR_ARRAY:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_array);
case EXPR_ASSIGN:
return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_LAST);
case EXPR_ASSIGNADD:
......
......@@ -1561,6 +1561,46 @@ HRESULT array_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flag
}
/* ECMA-262 3rd Edition 11.2.1 */
static HRESULT interp_array(exec_ctx_t *ctx)
{
VARIANT v, *namev;
IDispatch *obj;
DISPID id;
BSTR name;
HRESULT hres;
TRACE("\n");
namev = stack_pop(ctx);
hres = stack_pop_object(ctx, &obj);
if(FAILED(hres)) {
VariantClear(namev);
return hres;
}
hres = to_string(ctx->parser->script, namev, &ctx->ei, &name);
if(FAILED(hres)) {
IDispatch_Release(obj);
return hres;
}
hres = disp_get_id(ctx->parser->script, obj, name, 0, &id);
SysFreeString(name);
if(SUCCEEDED(hres)) {
hres = disp_propget(ctx->parser->script, obj, id, &v, &ctx->ei, NULL/*FIXME*/);
}else if(hres == DISP_E_UNKNOWNNAME) {
V_VT(&v) = VT_EMPTY;
hres = S_OK;
}
IDispatch_Release(obj);
if(FAILED(hres))
return hres;
return stack_push(ctx, &v);
}
/* ECMA-262 3rd Edition 11.2.1 */
HRESULT member_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
member_expression_t *expr = (member_expression_t*)_expr;
......
......@@ -43,6 +43,7 @@ typedef struct _func_stack {
#define OP_LIST \
X(add, 1, 0,0) \
X(array, 1, 0,0) \
X(assign, 1, 0,0) \
X(bool, 1, ARG_INT, 0) \
X(bneg, 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