[vala/0.40] vala: Write value of constants/enums in fast-vapi if they are constant only



commit 29f0873d4eb6e41bfda5d446dd13463b06f2ee0d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Nov 5 10:07:49 2019 +0100

    vala: Write value of constants/enums in fast-vapi if they are constant only
    
    Introduced by 89a1243a4f066cc9652b26f86eb94fd038874982
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/461

 vala/valacodewriter.vala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index e4d25a63a..9e881b656 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -462,7 +462,7 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_indent ();
                        write_identifier (ev.name);
 
-                       if (type == CodeWriterType.FAST && ev.value != null) {
+                       if (type == CodeWriterType.FAST && ev.value != null && ev.value.is_constant ()) {
                                write_string(" = ");
                                ev.value.accept (this);
                        }
@@ -574,7 +574,7 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string (" ");
                write_identifier (c.name);
                write_type_suffix (c.type_reference);
-               if (type == CodeWriterType.FAST && c.value != null) {
+               if (type == CodeWriterType.FAST && c.value != null && c.value.is_constant ()) {
                        write_string(" = ");
                        c.value.accept (this);
                }


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