[vala/0.36] codegen: Emit initializer for enum-value into wanted declaration space



commit db88ef6671450d11adcd5c0b8980c16da8161be9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Nov 30 16:43:42 2018 +0100

    codegen: Emit initializer for enum-value into wanted declaration space
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/167

 codegen/valaccodebasemodule.vala | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index fa32df2e9..62de5bd7e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -801,6 +801,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                cenum.modifiers |= (en.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
 
+               var current_cfile = cfile;
+               cfile = decl_space;
+
                int flag_shift = 0;
                foreach (EnumValue ev in en.get_values ()) {
                        CCodeEnumValue c_ev;
@@ -818,6 +821,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        cenum.add_value (c_ev);
                }
 
+               cfile = current_cfile;
+
                decl_space.add_type_definition (cenum);
                decl_space.add_type_definition (new CCodeNewline ());
 


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