From 37dad833c217ca661f00d44eea8b298263bb65eb Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Mon, 30 Jun 2008 05:51:42 +0000 Subject: [PATCH] Report error when an abstract method has a body, an extern method has a 2008-06-30 Jared Moore * vala/valasemanticanalyzer.vala: Report error when an abstract method has a body, an extern method has a body, or a non-abstract non-extern method has no body, fixes bug 539692. svn path=/trunk/; revision=1662 --- ChangeLog | 8 ++++++++ vala/valasemanticanalyzer.vala | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 614579e..b41fce0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-06-30 Jared Moore + + * vala/valasemanticanalyzer.vala: + + Report error when an abstract method has a body, an extern method has + a body, or a non-abstract non-extern method has no body, fixes bug + 539692. + 2008-06-29 Jürg Billeter * vapi/packages/gdk-pixbuf-2.0/: diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 1e167bc..dd5f3e2 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -455,6 +455,14 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } } + if (m.is_abstract && m.body != null) { + Report.error (m.source_reference, "Abstract methods cannot have bodies"); + } else if ((m.external || current_source_file.external_package) && m.body != null) { + Report.error (m.source_reference, "Extern methods cannot have bodies"); + } else if (!m.is_abstract && !m.external && !current_source_file.external_package && m.body == null) { + Report.error (m.source_reference, "Non-abstract, non-extern methods must have bodies"); + } + var old_symbol = current_symbol; var old_return_type = current_return_type; current_symbol = m; -- 2.7.4