[vala] Fix crash with invalid property default expressions



commit dbdb5df5951ae13870e02ff3dd018b37bd4bc78b
Author: Levi Bard <taktaktaktaktaktaktaktaktaktak gmail com>
Date:   Wed Apr 15 22:37:51 2009 +0200

    Fix crash with invalid property default expressions
    
    Do not check type compatibility on the default expression of a
    property if it fails semantic analysis. Fixes bug 576122.
---
 vala/valaproperty.vala |    2 +-
 vala/valastruct.vala   |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index 241fd36..8d666de 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -451,7 +451,7 @@ public class Vala.Property : Member, Lockable {
 			}
 		}
 
-		if (default_expression != null && !(default_expression.value_type.compatible (property_type))) {
+		if (default_expression != null && !default_expression.error && !(default_expression.value_type.compatible (property_type))) {
 			error = true;
 			Report.error (default_expression.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), default_expression.value_type.to_string ()));
 		}
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 4d13ac7..cc991eb 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -719,6 +719,7 @@ public class Vala.Struct : TypeSymbol {
 		}
 
 		if (!external && !external_package && base_type == null && get_fields ().size == 0) {
+			error = true;
 			Report.error (source_reference, "structs cannot be empty");
 		}
 



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