[vala/0.14] girparser: Warn when signals don't match emitter methods
- From: JÃrg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.14] girparser: Warn when signals don't match emitter methods
- Date: Wed, 30 Nov 2011 14:24:45 +0000 (UTC)
commit 7ee481d5204c4510b1dda80f891a1c598b6b9f97
Author: Luca Bruno <lucabru src gnome org>
Date: Fri Oct 21 18:01:39 2011 +0200
girparser: Warn when signals don't match emitter methods
vala/valagirparser.vala | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 3597b26..f3a4728 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -568,6 +568,22 @@ public class Vala.GirParser : CodeVisitor {
}
}
+ public string get_full_name () {
+ if (parent == null) {
+ return name;
+ }
+
+ if (name == null) {
+ return parent.get_full_name ();
+ }
+
+ if (parent.get_full_name () == null) {
+ return name;
+ }
+
+ return "%s.%s".printf (parent.get_full_name (), name);
+ }
+
public string get_gir_name () {
var gir_name = girdata["name"];
if (gir_name == null) {
@@ -743,6 +759,7 @@ public class Vala.GirParser : CodeVisitor {
// assume method is getter
merged = true;
} else if (sym is Signal) {
+ node.process (parser);
var sig = (Signal) sym;
if (m.is_virtual || m.is_abstract) {
sig.is_virtual = true;
@@ -750,6 +767,9 @@ public class Vala.GirParser : CodeVisitor {
sig.set_attribute ("HasEmitter", true);
}
parser.assume_parameter_names (sig, m, false);
+ if (m.get_parameters().size != sig.get_parameters().size) {
+ Report.warning (symbol.source_reference, "Signal `%s' conflicts with method of the same name".printf (get_full_name ()));
+ }
merged = true;
} else if (sym is Method && !(sym is CreationMethod) && node != this) {
if (m.is_virtual || m.is_abstract) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]