diff options
Diffstat (limited to 'vala/valadeclarationstatement.vala')
-rw-r--r-- | vala/valadeclarationstatement.vala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vala/valadeclarationstatement.vala b/vala/valadeclarationstatement.vala index 6e981287a..d29c0d6e4 100644 --- a/vala/valadeclarationstatement.vala +++ b/vala/valadeclarationstatement.vala @@ -48,4 +48,25 @@ public class Vala.DeclarationStatement : CodeNode, Statement { visitor.visit_declaration_statement (this); } + + public override bool check (SemanticAnalyzer analyzer) { + if (checked) { + return !error; + } + + checked = true; + + var local = declaration as LocalVariable; + if (local != null && local.initializer != null) { + foreach (DataType error_type in local.initializer.get_error_types ()) { + // ensure we can trace back which expression may throw errors of this type + var initializer_error_type = error_type.copy (); + initializer_error_type.source_reference = local.initializer.source_reference; + + add_error_type (initializer_error_type); + } + } + + return !error; + } } |