Jacek Caban : jscript: Get rid of stat_eval_table.

Alexandre Julliard julliard at winehq.org
Thu Dec 29 12:15:45 CST 2011


Module: wine
Branch: master
Commit: 6710e7ec6fbc4c68dbffabb02b7f78339d391b0b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6710e7ec6fbc4c68dbffabb02b7f78339d391b0b

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Dec 29 11:08:34 2011 +0100

jscript: Get rid of stat_eval_table.

---

 dlls/jscript/compile.c |   10 ++++++++++
 dlls/jscript/engine.h  |    1 -
 dlls/jscript/parser.y  |   21 +--------------------
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 127d967..5d63dbe 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -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;
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 4ac5e6a..b42a2ba 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -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;
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index 5cf0412..a3fe42a 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -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;
 




More information about the wine-cvs mailing list