From: Jürg Billeter Date: Sun, 9 Nov 2008 18:44:16 +0000 (+0000) Subject: Ensure attributes of base types are processed before querying C header X-Git-Tag: VALA_0_5_2~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d793aff50f212dc5e698e9f35216b3ed03d6cc18;p=thirdparty%2Fvala.git Ensure attributes of base types are processed before querying C header 2008-11-09 Jürg Billeter * vala/valaclass.vala: * vala/valainterface.vala: * vala/valamemberaccess.vala: * vala/valaobjecttype.vala: * vala/valasemanticanalyzer.vala: Ensure attributes of base types are processed before querying C header filenames svn path=/trunk/; revision=2004 --- diff --git a/ChangeLog b/ChangeLog index a812ae1a9..dce3e01be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-11-09 Jürg Billeter + + * vala/valaclass.vala: + * vala/valainterface.vala: + * vala/valamemberaccess.vala: + * vala/valaobjecttype.vala: + * vala/valasemanticanalyzer.vala: + + Ensure attributes of base types are processed before querying + C header filenames + 2008-11-07 Jürg Billeter * vala/valablock.vala: diff --git a/vala/valaclass.vala b/vala/valaclass.vala index 1d27d7650..9baec15df 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -858,10 +858,22 @@ public class Vala.Class : ObjectTypeSymbol { process_attributes (); + var old_source_file = analyzer.current_source_file; + var old_symbol = analyzer.current_symbol; + var old_class = analyzer.current_class; + + if (source_reference != null) { + analyzer.current_source_file = source_reference.file; + } analyzer.current_symbol = this; analyzer.current_class = this; foreach (DataType base_type_reference in get_base_types ()) { + if (!base_type_reference.check (analyzer)) { + error = true; + return false; + } + // check whether base type is at least as accessible as the class if (!analyzer.is_type_accessible (this, base_type_reference)) { error = true; @@ -993,8 +1005,9 @@ public class Vala.Class : ObjectTypeSymbol { } } - analyzer.current_symbol = analyzer.current_symbol.parent_symbol; - analyzer.current_class = null; + analyzer.current_source_file = old_source_file; + analyzer.current_symbol = old_symbol; + analyzer.current_class = old_class; return !error; } diff --git a/vala/valainterface.vala b/vala/valainterface.vala index 306eb21d6..195582cb3 100644 --- a/vala/valainterface.vala +++ b/vala/valainterface.vala @@ -550,6 +550,12 @@ public class Vala.Interface : ObjectTypeSymbol { process_attributes (); + var old_source_file = analyzer.current_source_file; + var old_symbol = analyzer.current_symbol; + + if (source_reference != null) { + analyzer.current_source_file = source_reference.file; + } analyzer.current_symbol = this; foreach (DataType prerequisite_reference in get_prerequisites ()) { @@ -586,7 +592,8 @@ public class Vala.Interface : ObjectTypeSymbol { accept_children (analyzer); - analyzer.current_symbol = analyzer.current_symbol.parent_symbol; + analyzer.current_source_file = old_source_file; + analyzer.current_symbol = old_symbol; return !error; } diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala index 153453a4b..896236f15 100644 --- a/vala/valamemberaccess.vala +++ b/vala/valamemberaccess.vala @@ -233,7 +233,7 @@ public class Vala.MemberAccess : Expression { } if (symbol_reference == null) { - foreach (UsingDirective ns in analyzer.current_using_directives) { + foreach (UsingDirective ns in analyzer.current_source_file.get_using_directives ()) { var local_sym = ns.namespace_symbol.scope.lookup (member_name); if (local_sym != null) { if (symbol_reference != null) { diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala index a8aa9dd04..ac5f28a45 100644 --- a/vala/valaobjecttype.vala +++ b/vala/valaobjecttype.vala @@ -98,4 +98,8 @@ public class Vala.ObjectType : ReferenceType { return null; } } + + public override bool check (SemanticAnalyzer analyzer) { + return type_symbol.check (analyzer); + } } diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index bcf7b5228..b3ef26433 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -37,8 +37,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public Class current_class; public Struct current_struct; - public Gee.List current_using_directives; - public DataType bool_type; public DataType string_type; public DataType uchar_type; @@ -129,13 +127,10 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public override void visit_source_file (SourceFile file) { current_source_file = file; - current_using_directives = file.get_using_directives (); next_lambda_id = 0; file.accept_children (this); - - current_using_directives = null; } public override void visit_namespace (Namespace ns) {