jscript: Get rid of stat_eval_table.

This commit is contained in:
Jacek Caban 2011-12-29 11:08:34 +01:00 committed by Alexandre Julliard
parent f08fcff4fd
commit 6710e7ec6f
3 changed files with 11 additions and 21 deletions

View File

@ -1289,6 +1289,13 @@ static HRESULT compile_break_statement(compiler_ctx_t *ctx, branch_statement_t *
return push_instr_uint(ctx, OP_jmp, pop_ctx->break_label);
}
/* ECMA-262 3rd Edition 12.9 */
static HRESULT compile_return_statement(compiler_ctx_t *ctx, expression_statement_t *stat)
{
stat->stat.eval = return_statement_eval;
return compile_interp_fallback(ctx, &stat->stat);
}
/* ECMA-262 3rd Edition 12.10 */
static HRESULT compile_with_statement(compiler_ctx_t *ctx, with_statement_t *stat)
{
@ -1527,6 +1534,9 @@ static HRESULT compile_statement(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx,
case STAT_LABEL:
hres = push_instr(ctx, OP_label) == -1 ? E_OUTOFMEMORY : S_OK; /* FIXME */
break;
case STAT_RETURN:
hres = compile_return_statement(ctx, (expression_statement_t*)stat);
break;
case STAT_SWITCH:
hres = compile_switch_statement(ctx, (switch_statement_t*)stat);
break;

View File

@ -412,7 +412,6 @@ typedef struct {
statement_t *finally_statement;
} try_statement_t;
HRESULT compiled_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT continue_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT break_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT return_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;

View File

@ -835,25 +835,6 @@ static BOOL allow_auto_semicolon(parser_ctx_t *ctx)
return ctx->nl || ctx->ptr == ctx->end || *(ctx->ptr-1) == '}';
}
static const statement_eval_t stat_eval_table[] = {
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
return_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval,
compiled_statement_eval
};
static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size)
{
statement_t *stat;
@ -863,7 +844,7 @@ static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size
return NULL;
stat->type = type;
stat->eval = stat_eval_table[type];
stat->eval = NULL;
stat->instr_off = -1;
stat->next = NULL;