Commit 426d1905 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

report error and fix critical to prevent private members in namespaces

2007-08-20  Juerg Billeter  <j@bitron.ch>

	* vala/valasemanticanalyzer.vala: report error and fix critical to
	  prevent private members in namespaces

svn path=/trunk/; revision=484
parent 93973281
2007-08-20 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: report error and fix critical to
prevent private members in namespaces
2007-08-19 Mathias Hasselmann <mathias.hasselmann@gmx.de> 2007-08-19 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* gobject/valacodegenerator.vala: also use _vala_array_free to * gobject/valacodegenerator.vala: also use _vala_array_free to
......
...@@ -338,6 +338,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { ...@@ -338,6 +338,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
current_source_file.add_symbol_dependency (f.type_reference.data_type, SourceFileDependencyType.HEADER_SHALLOW); current_source_file.add_symbol_dependency (f.type_reference.data_type, SourceFileDependencyType.HEADER_SHALLOW);
} }
} else { } else {
if (f.parent_symbol is Namespace) {
f.error = true;
Report.error (f.source_reference, "Namespaces may not have private members");
return;
}
if (f.type_reference.data_type != null) { if (f.type_reference.data_type != null) {
/* is null if it references a type parameter */ /* is null if it references a type parameter */
current_source_file.add_symbol_dependency (f.type_reference.data_type, SourceFileDependencyType.SOURCE); current_source_file.add_symbol_dependency (f.type_reference.data_type, SourceFileDependencyType.SOURCE);
...@@ -1279,7 +1285,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor { ...@@ -1279,7 +1285,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
} }
if (access == MemberAccessibility.PRIVATE) { if (access == MemberAccessibility.PRIVATE) {
var target_type = (DataType) member.parent_symbol; var target_type = member.parent_symbol;
bool in_target_type = false; bool in_target_type = false;
for (Symbol this_symbol = current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) { for (Symbol this_symbol = current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
......
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