[Vala] [PATCH] Add parenthesis to macro substitutions



Only for expressions. No parenthesis is added to string macros.
A test is attached. Without the patch BBBB compiles to a wrong expression.
---
 ccode/valaccodemacroreplacement.vala |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ccode/valaccodemacroreplacement.vala b/ccode/valaccodemacroreplacement.vala
index 1737c2e..8c00b80 100644
--- a/ccode/valaccodemacroreplacement.vala
+++ b/ccode/valaccodemacroreplacement.vala
@@ -59,7 +59,9 @@ public class Vala.CCodeMacroReplacement : CCodeNode {
                if (replacement != null) {
                        writer.write_string (replacement);
                } else {
+                       writer.write_string ("(");
                        replacement_expression.write (writer);
+                       writer.write_string (")");
                }
                writer.write_newline ();
        }
-- 
1.6.0.6

Attachment: const.vala
Description: Text Data



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