Commit d793aff5 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Ensure attributes of base types are processed before querying C header

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
parent 955c4f6c
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:
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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) {
......
......@@ -98,4 +98,8 @@ public class Vala.ObjectType : ReferenceType {
return null;
}
}
public override bool check (SemanticAnalyzer analyzer) {
return type_symbol.check (analyzer);
}
}
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment