]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Ensure attributes of base types are processed before querying C header
authorJürg Billeter <j@bitron.ch>
Sun, 9 Nov 2008 18:44:16 +0000 (18:44 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 9 Nov 2008 18:44:16 +0000 (18:44 +0000)
2008-11-09  Jürg Billeter  <j@bitron.ch>

* 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

ChangeLog
vala/valaclass.vala
vala/valainterface.vala
vala/valamemberaccess.vala
vala/valaobjecttype.vala
vala/valasemanticanalyzer.vala

index a812ae1a9ce4b2d9bc3ed063abcfcbf766c6382d..dce3e01be4ce1e7ba5e7cb86036b124a8f5aa2d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-09  Jürg Billeter  <j@bitron.ch>
+
+       * 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  <j@bitron.ch>
 
        * vala/valablock.vala:
index 1d27d765019ecad9b6a2aab25cf0084ff61e3d28..9baec15df96b244479914b787b0fee25707e5af9 100644 (file)
@@ -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;
        }
index 306eb21d6f98b7e0e9fb282e0aa728a79cc9468e..195582cb3d32acb32baa54671739c7903080af3a 100644 (file)
@@ -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;
        }
index 153453a4bbd9c9afab9cfe4b6eb3950634d7d708..896236f15c28f51ef0eecd8ecbccdea1e8602300 100644 (file)
@@ -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) {
index a8aa9dd04b346447030e9ee4c5a49560453b6b4c..ac5f28a45b33ca15ae0e791949653896cf6a6b67 100644 (file)
@@ -98,4 +98,8 @@ public class Vala.ObjectType : ReferenceType {
                        return null;
                }
        }
+
+       public override bool check (SemanticAnalyzer analyzer) {
+               return type_symbol.check (analyzer);
+       }
 }
index bcf7b5228d9607c14dbafd05e5f77d0ecde138a1..b3ef264336c3b457402cbe4d99eb16ab2e43010d 100644 (file)
@@ -37,8 +37,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public Class current_class;
        public Struct current_struct;
 
-       public Gee.List<UsingDirective> 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) {