jscript: Use binary_expression_t instead of array_expression_t.

This commit is contained in:
Jacek Caban 2011-12-07 11:01:40 +01:00 committed by Alexandre Julliard
parent 4da0cf39f4
commit 9c9157a144
4 changed files with 11 additions and 28 deletions

View File

@ -257,13 +257,13 @@ static HRESULT compile_memberid_expression(compiler_ctx_t *ctx, expression_t *ex
break; break;
} }
case EXPR_ARRAY: { case EXPR_ARRAY: {
array_expression_t *array_expr = (array_expression_t*)expr; binary_expression_t *array_expr = (binary_expression_t*)expr;
hres = compile_expression(ctx, array_expr->member_expr); hres = compile_expression(ctx, array_expr->expression1);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = compile_expression(ctx, array_expr->expression); hres = compile_expression(ctx, array_expr->expression2);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -438,13 +438,13 @@ static HRESULT compile_delete_expression(compiler_ctx_t *ctx, unary_expression_t
switch(expr->expression->type) { switch(expr->expression->type) {
case EXPR_ARRAY: { case EXPR_ARRAY: {
array_expression_t *array_expr = (array_expression_t*)expr->expression; binary_expression_t *array_expr = (binary_expression_t*)expr->expression;
hres = compile_expression(ctx, array_expr->member_expr); hres = compile_expression(ctx, array_expr->expression1);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = compile_expression(ctx, array_expr->expression); hres = compile_expression(ctx, array_expr->expression2);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -1508,7 +1508,7 @@ HRESULT function_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD f
/* ECMA-262 3rd Edition 11.2.1 */ /* ECMA-262 3rd Edition 11.2.1 */
HRESULT array_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) HRESULT array_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{ {
array_expression_t *expr = (array_expression_t*)_expr; binary_expression_t *expr = (binary_expression_t*)_expr;
exprval_t exprval; exprval_t exprval;
VARIANT member, val; VARIANT member, val;
DISPID id; DISPID id;
@ -1518,7 +1518,7 @@ HRESULT array_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flag
TRACE("\n"); TRACE("\n");
hres = expr_eval(ctx, expr->member_expr, 0, ei, &exprval); hres = expr_eval(ctx, expr->expression1, 0, ei, &exprval);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1527,7 +1527,7 @@ HRESULT array_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flag
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = expr_eval(ctx, expr->expression, EXPR_NEWREF, ei, &exprval); hres = expr_eval(ctx, expr->expression2, EXPR_NEWREF, ei, &exprval);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
hres = exprval_to_value(ctx, &exprval, ei, &val); hres = exprval_to_value(ctx, &exprval, ei, &val);
exprval_release(&exprval); exprval_release(&exprval);

View File

@ -497,12 +497,6 @@ typedef struct {
expression_t *false_expression; expression_t *false_expression;
} conditional_expression_t; } conditional_expression_t;
typedef struct {
expression_t expr;
expression_t *member_expr;
expression_t *expression;
} array_expression_t;
typedef struct { typedef struct {
expression_t expr; expression_t expr;
expression_t *expression; expression_t *expression;

View File

@ -129,7 +129,6 @@ static expression_t *new_function_expression(parser_ctx_t*,const WCHAR*,paramete
static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*); static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*); static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
static expression_t *new_conditional_expression(parser_ctx_t*,expression_t*,expression_t*,expression_t*); static expression_t *new_conditional_expression(parser_ctx_t*,expression_t*,expression_t*,expression_t*);
static expression_t *new_array_expression(parser_ctx_t*,expression_t*,expression_t*);
static expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*); static expression_t *new_member_expression(parser_ctx_t*,expression_t*,const WCHAR*);
static expression_t *new_new_expression(parser_ctx_t*,expression_t*,argument_list_t*); static expression_t *new_new_expression(parser_ctx_t*,expression_t*,argument_list_t*);
static expression_t *new_call_expression(parser_ctx_t*,expression_t*,argument_list_t*); static expression_t *new_call_expression(parser_ctx_t*,expression_t*,argument_list_t*);
@ -710,7 +709,7 @@ MemberExpression
: PrimaryExpression { $$ = $1; } : PrimaryExpression { $$ = $1; }
| FunctionExpression { $$ = $1; } | FunctionExpression { $$ = $1; }
| MemberExpression '[' Expression ']' | MemberExpression '[' Expression ']'
{ $$ = new_array_expression(ctx, $1, $3); } { $$ = new_binary_expression(ctx, EXPR_ARRAY, $1, $3); }
| MemberExpression '.' tIdentifier | MemberExpression '.' tIdentifier
{ $$ = new_member_expression(ctx, $1, $3); } { $$ = new_member_expression(ctx, $1, $3); }
| kNEW MemberExpression Arguments | kNEW MemberExpression Arguments
@ -723,7 +722,7 @@ CallExpression
| CallExpression Arguments | CallExpression Arguments
{ $$ = new_call_expression(ctx, $1, $2); } { $$ = new_call_expression(ctx, $1, $2); }
| CallExpression '[' Expression ']' | CallExpression '[' Expression ']'
{ $$ = new_array_expression(ctx, $1, $3); } { $$ = new_binary_expression(ctx, EXPR_ARRAY, $1, $3); }
| CallExpression '.' tIdentifier | CallExpression '.' tIdentifier
{ $$ = new_member_expression(ctx, $1, $3); } { $$ = new_member_expression(ctx, $1, $3); }
@ -1407,16 +1406,6 @@ static expression_t *new_conditional_expression(parser_ctx_t *ctx, expression_t
return &ret->expr; return &ret->expr;
} }
static expression_t *new_array_expression(parser_ctx_t *ctx, expression_t *member_expr, expression_t *expression)
{
array_expression_t *ret = new_expression(ctx, EXPR_ARRAY, sizeof(*ret));
ret->member_expr = member_expr;
ret->expression = expression;
return &ret->expr;
}
static expression_t *new_member_expression(parser_ctx_t *ctx, expression_t *expression, const WCHAR *identifier) static expression_t *new_member_expression(parser_ctx_t *ctx, expression_t *expression, const WCHAR *identifier)
{ {
member_expression_t *ret = new_expression(ctx, EXPR_MEMBER, sizeof(*ret)); member_expression_t *ret = new_expression(ctx, EXPR_MEMBER, sizeof(*ret));