From: Jürg Billeter Date: Sun, 25 Jul 2010 19:22:55 +0000 (+0200) Subject: Simplify signal handler assignment check X-Git-Tag: 0.9.4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ba054e9df58c30d1cd53c8b0d7be5460922cc38;p=thirdparty%2Fvala.git Simplify signal handler assignment check --- diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index 66c93165a..0e381fea7 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -321,13 +321,13 @@ public class Vala.Assignment : Expression { Report.warning (ma.source_reference, "assigning to construct-only properties is deprecated, use Object (property: value) constructor chain up"); } } - } else if (ma.symbol_reference is LocalVariable && right.value_type == null) { - var local = (LocalVariable) ma.symbol_reference; + } else if (ma.symbol_reference is Variable && right.value_type == null) { + var variable = (Variable) ma.symbol_reference; if (right.symbol_reference is Method && - local.variable_type is DelegateType) { + variable.variable_type is DelegateType) { var m = (Method) right.symbol_reference; - var dt = (DelegateType) local.variable_type; + var dt = (DelegateType) variable.variable_type; var cb = dt.delegate_symbol; /* check whether method matches callback type */ @@ -337,29 +337,7 @@ public class Vala.Assignment : Expression { return false; } - right.value_type = local.variable_type; - } else { - error = true; - Report.error (source_reference, "Assignment: Invalid callback assignment attempt"); - return false; - } - } else if (ma.symbol_reference is Field && right.value_type == null) { - var f = (Field) ma.symbol_reference; - - if (right.symbol_reference is Method && - f.variable_type is DelegateType) { - var m = (Method) right.symbol_reference; - var dt = (DelegateType) f.variable_type; - var cb = dt.delegate_symbol; - - /* check whether method matches callback type */ - if (!cb.matches_method (m, dt)) { - f.error = true; - Report.error (source_reference, "declaration of method `%s' doesn't match declaration of callback `%s'".printf (m.get_full_name (), cb.get_full_name ())); - return false; - } - - right.value_type = f.variable_type; + right.value_type = variable.variable_type; } else { error = true; Report.error (source_reference, "Assignment: Invalid callback assignment attempt");