Commit 58e8fdd5 authored by Raffaele Sandrini's avatar Raffaele Sandrini Committed by Raffaele Sandrini
Browse files

check whether a class implements all methods required by its super

2007-03-07  Raffaele Sandrini  <rasa@gmx.ch>

	* vala/valasemanticanalyzer.vala: check whether a class implements all
	  methods required by its super interfaces

svn path=/trunk/; revision=226
parent d6ea95e3
2007-03-07 Raffaele Sandrini <rasa@gmx.ch>
* vala/valasemanticanalyzer.vala: check whether a class implements all
methods required by its super interfaces
2007-03-05 Jürg Billeter <j@bitron.ch>
* vala/scanner.l, vala/parser.y, vala/valacatchclause.vala,
......
......@@ -178,6 +178,25 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
Report.error (cl.source_reference, error_string);
}
/* all virtual symbols defined in interfaces have to be at least defined (or implemented) also in this type */
foreach (TypeReference base_type in cl.get_base_types ()) {
if (base_type.data_type is Interface) {
Interface iface = (Interface)base_type.data_type;
/* We do not need to do expensive equality checking here since this is done
* already. We only need to guarantee the symbols are present.
*/
/* check methods */
foreach (Method m in iface.get_methods ()) {
if (cl.symbol.lookup (m.name) == null && m.is_abstract) {
cl.error = true;
Report.error (cl.source_reference, "`%s' does not implement interface method `%s'".printf (cl.symbol.get_full_name (), m.symbol.get_full_name ()));
}
}
}
}
current_symbol = current_symbol.parent_symbol;
current_class = null;
}
......
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