From 43a73a0d98424703f3b9af6cf762b521a10aa66a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrg=20Billeter?= Date: Mon, 12 Jul 2010 19:45:57 +0200 Subject: [PATCH] Fix side effects in assertions Fixes bug 624129. --- vala/valabinaryexpression.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala index 8e813e219..1ae617594 100644 --- a/vala/valabinaryexpression.vala +++ b/vala/valabinaryexpression.vala @@ -149,6 +149,10 @@ public class Vala.BinaryExpression : Expression { return (expr != null); } + bool pure_and_in_assert () { + return is_pure () && in_assert (); + } + public override bool check (SemanticAnalyzer analyzer) { if (checked) { return !error; @@ -165,7 +169,7 @@ public class Vala.BinaryExpression : Expression { // reachability analysis and error handling should never be // necessary for assertion expressions, so it is ok to avoid // the split - if (analyzer.current_symbol is Block && !in_assert () + if (analyzer.current_symbol is Block && !pure_and_in_assert () && (operator == BinaryOperator.AND || operator == BinaryOperator.OR)) { // convert conditional expression into if statement // required for flow analysis and exception handling -- 2.47.2