[vala/staging] codegen: Make *_try_id specific to emit-context instead being global states



commit 5e5126b5a071f2bac83cef3548e4ef3b03772d7c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Feb 3 13:22:28 2020 +0100

    codegen: Make *_try_id specific to emit-context instead being global states

 codegen/valaccodebasemodule.vala | 12 ++++++++++++
 codegen/valagerrormodule.vala    |  2 --
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index f8ff16872..52bc6d930 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -31,6 +31,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                public Symbol? current_symbol;
                public ArrayList<Symbol> symbol_stack = new ArrayList<Symbol> ();
                public TryStatement current_try;
+               public int current_try_id;
+               public int next_try_id;
                public CatchClause current_catch;
                public CCodeFunction ccode;
                public ArrayList<CCodeFunction> ccode_stack = new ArrayList<CCodeFunction> ();
@@ -77,6 +79,16 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                set { emit_context.current_try = value; }
        }
 
+       public int current_try_id {
+               get { return emit_context.current_try_id; }
+               set { emit_context.current_try_id = value; }
+       }
+
+       public int next_try_id {
+               get { return emit_context.next_try_id; }
+               set { emit_context.next_try_id = value; }
+       }
+
        public CatchClause current_catch {
                get { return emit_context.current_catch; }
                set { emit_context.current_catch = value; }
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index d54f0d9d1..75baa8b5a 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -24,8 +24,6 @@
 using GLib;
 
 public class Vala.GErrorModule : CCodeDelegateModule {
-       private int current_try_id = 0;
-       private int next_try_id = 0;
        private bool is_in_catch = false;
 
        public override void generate_error_domain_declaration (ErrorDomain edomain, CCodeFile decl_space) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]