summaryrefslogtreecommitdiff
path: root/vala/valareport.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-03-22 21:21:13 +0100
committerJürg Billeter <j@bitron.ch>2010-03-22 21:21:13 +0100
commit8d62a1e81f114861b0dc51b9c0cbfa94c95070c7 (patch)
treed83326b08623349f0131a8c5dbdd3768773e694b /vala/valareport.vala
parentf91a04666caee7768c0a9dbb4b8eb62c9a767aab (diff)
downloadvala-8d62a1e81f114861b0dc51b9c0cbfa94c95070c7.tar.gz
Improve error message on duplicate definition
Display location of previous definition. Fixes bug 591977.
Diffstat (limited to 'vala/valareport.vala')
-rw-r--r--vala/valareport.vala26
1 files changed, 25 insertions, 1 deletions
diff --git a/vala/valareport.vala b/vala/valareport.vala
index 22d689d41..14e358376 100644
--- a/vala/valareport.vala
+++ b/vala/valareport.vala
@@ -1,6 +1,6 @@
/* valareport.vala
*
- * Copyright (C) 2006-2008 Jürg Billeter
+ * Copyright (C) 2006-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -93,6 +93,27 @@ public class Vala.Report : Object {
}
/**
+ * Reports the specified message as note.
+ *
+ * @param source reference to source code
+ * @param message note message
+ */
+ public virtual void note (SourceReference? source, string message) {
+ if (!enable_warnings) {
+ return;
+ }
+
+ if (source == null) {
+ stderr.printf ("note: %s\n", message);
+ } else {
+ stderr.printf ("%s: note: %s\n", source.to_string (), message);
+ if (verbose_errors) {
+ report_source (source);
+ }
+ }
+ }
+
+ /**
* Reports the specified message as warning.
*
* @param source reference to source code
@@ -133,6 +154,9 @@ public class Vala.Report : Object {
}
/* Convenience methods calling warn and err on correct instance */
+ public static void notice (SourceReference? source, string message) {
+ CodeContext.get ().report.note (source, message);
+ }
public static void warning (SourceReference? source, string message) {
CodeContext.get ().report.warn (source, message);
}