]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dova: Support string equality expressions
authorJürg Billeter <j@bitron.ch>
Wed, 21 Jul 2010 06:35:45 +0000 (08:35 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 21 Jul 2010 06:47:10 +0000 (08:47 +0200)
vala/valabinaryexpression.vala

index 1ae617594ee058e0ddb3be4b47d1f4cb2e88118d..81bc2ce7154b97d7c2216d695d20ec3091e6e926 100644 (file)
@@ -413,6 +413,18 @@ public class Vala.BinaryExpression : Expression {
                        if (left.value_type.compatible (analyzer.string_type)
                            && right.value_type.compatible (analyzer.string_type)) {
                                // string comparison
+                               if (analyzer.context.profile == Profile.DOVA) {
+                                       var equals_call = new MethodCall (new MemberAccess (left, "equals", source_reference), source_reference);
+                                       equals_call.add_argument (right);
+                                       if (operator == BinaryOperator.EQUALITY) {
+                                               parent_node.replace_expression (this, equals_call);
+                                               return equals_call.check (analyzer);
+                                       } else {
+                                               var not = new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, equals_call, source_reference);
+                                               parent_node.replace_expression (this, not);
+                                               return not.check (analyzer);
+                                       }
+                               }
                        }
 
                        value_type = analyzer.bool_type;