From 8b66110e51366c7c705240d7f0a90d0ef61ed1d4 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 18 Nov 2011 14:05:57 +0100 Subject: [PATCH] jscript: Store expression type in expression_t. --- dlls/jscript/engine.h | 123 +++++++++++++++++++++--------------------- dlls/jscript/parser.y | 1 + 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 73d06c926dc..c346e5f8f32 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -291,9 +291,71 @@ typedef struct { } u; } exprval_t; +typedef enum { + EXPR_COMMA, + EXPR_OR, + EXPR_AND, + EXPR_BOR, + EXPR_BXOR, + EXPR_BAND, + EXPR_INSTANCEOF, + EXPR_IN, + EXPR_ADD, + EXPR_SUB, + EXPR_MUL, + EXPR_DIV, + EXPR_MOD, + EXPR_DELETE, + EXPR_VOID, + EXPR_TYPEOF, + EXPR_MINUS, + EXPR_PLUS, + EXPR_POSTINC, + EXPR_POSTDEC, + EXPR_PREINC, + EXPR_PREDEC, + EXPR_EQ, + EXPR_EQEQ, + EXPR_NOTEQ, + EXPR_NOTEQEQ, + EXPR_LESS, + EXPR_LESSEQ, + EXPR_GREATER, + EXPR_GREATEREQ, + EXPR_BITNEG, + EXPR_LOGNEG, + EXPR_LSHIFT, + EXPR_RSHIFT, + EXPR_RRSHIFT, + EXPR_ASSIGN, + EXPR_ASSIGNLSHIFT, + EXPR_ASSIGNRSHIFT, + EXPR_ASSIGNRRSHIFT, + EXPR_ASSIGNADD, + EXPR_ASSIGNSUB, + EXPR_ASSIGNMUL, + EXPR_ASSIGNDIV, + EXPR_ASSIGNMOD, + EXPR_ASSIGNAND, + EXPR_ASSIGNOR, + EXPR_ASSIGNXOR, + EXPR_COND, + EXPR_ARRAY, + EXPR_MEMBER, + EXPR_NEW, + EXPR_CALL, + EXPR_THIS, + EXPR_FUNC, + EXPR_IDENT, + EXPR_ARRAYLIT, + EXPR_PROPVAL, + EXPR_LITERAL +} expression_type_t; + typedef HRESULT (*expression_eval_t)(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*); struct _expression_t { + expression_type_t type; expression_eval_t eval; }; @@ -396,67 +458,6 @@ typedef struct { prop_val_t *property_list; } property_value_expression_t; -typedef enum { - EXPR_COMMA, - EXPR_OR, - EXPR_AND, - EXPR_BOR, - EXPR_BXOR, - EXPR_BAND, - EXPR_INSTANCEOF, - EXPR_IN, - EXPR_ADD, - EXPR_SUB, - EXPR_MUL, - EXPR_DIV, - EXPR_MOD, - EXPR_DELETE, - EXPR_VOID, - EXPR_TYPEOF, - EXPR_MINUS, - EXPR_PLUS, - EXPR_POSTINC, - EXPR_POSTDEC, - EXPR_PREINC, - EXPR_PREDEC, - EXPR_EQ, - EXPR_EQEQ, - EXPR_NOTEQ, - EXPR_NOTEQEQ, - EXPR_LESS, - EXPR_LESSEQ, - EXPR_GREATER, - EXPR_GREATEREQ, - EXPR_BITNEG, - EXPR_LOGNEG, - EXPR_LSHIFT, - EXPR_RSHIFT, - EXPR_RRSHIFT, - EXPR_ASSIGN, - EXPR_ASSIGNLSHIFT, - EXPR_ASSIGNRSHIFT, - EXPR_ASSIGNRRSHIFT, - EXPR_ASSIGNADD, - EXPR_ASSIGNSUB, - EXPR_ASSIGNMUL, - EXPR_ASSIGNDIV, - EXPR_ASSIGNMOD, - EXPR_ASSIGNAND, - EXPR_ASSIGNOR, - EXPR_ASSIGNXOR, - EXPR_COND, - EXPR_ARRAY, - EXPR_MEMBER, - EXPR_NEW, - EXPR_CALL, - EXPR_THIS, - EXPR_FUNC, - EXPR_IDENT, - EXPR_ARRAYLIT, - EXPR_PROPVAL, - EXPR_LITERAL -} expression_type_t; - HRESULT function_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT conditional_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT array_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 69b94839d6e..db7a3c58c08 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -1369,6 +1369,7 @@ static void *new_expression(parser_ctx_t *ctx, expression_type_t type, size_t si { expression_t *ret = parser_alloc(ctx, size ? size : sizeof(*ret)); + ret->type = type; ret->eval = expression_eval_table[type]; return ret;