Paul Gofman : jscript: Factor out compiler statement push and pop functions.
Alexandre Julliard
julliard at winehq.org
Mon Jun 21 16:14:56 CDT 2021
Module: wine
Branch: master
Commit: deeadb4fa682db2852027396f4de079ba66ff851
URL: https://source.winehq.org/git/wine.git/?a=commit;h=deeadb4fa682db2852027396f4de079ba66ff851
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Mon Jun 21 20:48:19 2021 +0300
jscript: Factor out compiler statement push and pop functions.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/compile.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 1c4085dc64a..f14392b166f 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -568,6 +568,24 @@ static HRESULT emit_member_expression(compiler_ctx_t *ctx, expression_t *expr)
return S_OK;
}
+static void push_compiler_statement_ctx(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx)
+{
+ if (stat_ctx)
+ {
+ stat_ctx->next = ctx->stat_ctx;
+ ctx->stat_ctx = stat_ctx;
+ }
+}
+
+static void pop_compiler_statement_ctx(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx)
+{
+ if (stat_ctx)
+ {
+ assert(ctx->stat_ctx == stat_ctx);
+ ctx->stat_ctx = stat_ctx->next;
+ }
+}
+
static HRESULT compile_memberid_expression(compiler_ctx_t *ctx, expression_t *expr, unsigned flags)
{
HRESULT hres;
@@ -1866,10 +1884,7 @@ static HRESULT compile_statement(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx,
{
HRESULT hres;
- if(stat_ctx) {
- stat_ctx->next = ctx->stat_ctx;
- ctx->stat_ctx = stat_ctx;
- }
+ push_compiler_statement_ctx(ctx, stat_ctx);
set_compiler_loc(ctx, stat->loc);
@@ -1926,10 +1941,7 @@ static HRESULT compile_statement(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx,
DEFAULT_UNREACHABLE;
}
- if(stat_ctx) {
- assert(ctx->stat_ctx == stat_ctx);
- ctx->stat_ctx = stat_ctx->next;
- }
+ pop_compiler_statement_ctx(ctx, stat_ctx);
return hres;
}
@@ -2186,11 +2198,7 @@ static HRESULT visit_statement(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx, s
{
HRESULT hres = S_OK;
- if(stat_ctx)
- {
- stat_ctx->next = ctx->stat_ctx;
- ctx->stat_ctx = stat_ctx;
- }
+ push_compiler_statement_ctx(ctx, stat_ctx);
switch(stat->type) {
case STAT_BLOCK:
@@ -2352,11 +2360,7 @@ static HRESULT visit_statement(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx, s
DEFAULT_UNREACHABLE;
}
- if(stat_ctx)
- {
- assert(ctx->stat_ctx == stat_ctx);
- ctx->stat_ctx = stat_ctx->next;
- }
+ pop_compiler_statement_ctx(ctx, stat_ctx);
return hres;
}
More information about the wine-cvs
mailing list