[vala] codegen: Support constant unary expressions in field initializers
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Support constant unary expressions in field initializers
- Date: Fri, 12 Dec 2014 15:06:50 +0000 (UTC)
commit 50222da1622de0039fc812624253f85f474d80d4
Author: Luca Bruno <lucabru src gnome org>
Date: Fri Dec 12 16:06:38 2014 +0100
codegen: Support constant unary expressions in field initializers
codegen/valaccodebasemodule.vala | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 1bee9e5..8d6ebdd 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1342,6 +1342,16 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
} else if (cexpr is CCodeCastExpression) {
var ccast = (CCodeCastExpression) cexpr;
return is_constant_ccode_expression (ccast.inner);
+ } else if (cexpr is CCodeUnaryExpression) {
+ var cunary = (CCodeUnaryExpression) cexpr;
+ switch (cunary.operator) {
+ case CCodeUnaryOperator.PREFIX_INCREMENT:
+ case CCodeUnaryOperator.PREFIX_DECREMENT:
+ case CCodeUnaryOperator.POSTFIX_INCREMENT:
+ case CCodeUnaryOperator.POSTFIX_DECREMENT:
+ return false;
+ }
+ return is_constant_ccode_expression (cunary.inner);
} else if (cexpr is CCodeBinaryExpression) {
var cbinary = (CCodeBinaryExpression) cexpr;
return is_constant_ccode_expression (cbinary.left) && is_constant_ccode_expression
(cbinary.right);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]