[vala/wip/ricotz/lsp-rev: 14/14] DON'T MERGE vala: Add sanity check for SourceReference
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz/lsp-rev: 14/14] DON'T MERGE vala: Add sanity check for SourceReference
- Date: Mon, 3 Feb 2020 13:37:40 +0000 (UTC)
commit 41142de2086bbf188148378e5bf763dd07a11edb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 18 20:03:37 2020 +0100
DON'T MERGE vala: Add sanity check for SourceReference
vala/valasourcereference.vala | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/vala/valasourcereference.vala b/vala/valasourcereference.vala
index 24aeeda45..f44c776a6 100644
--- a/vala/valasourcereference.vala
+++ b/vala/valasourcereference.vala
@@ -64,6 +64,15 @@ public class Vala.SourceReference {
* @return human-readable string
*/
public string to_string () {
+ // FIXME DON'T MERGE THIS
+ if (begin.line > end.line) {
+ Report.error (null, "bad line reference");
+ } else if (begin.line == end.line && begin.column > end.column) {
+ Report.error (null, "bad column reference");
+ } else if (begin.pos > end.pos) {
+ Report.error (null, "bad file position reference");
+ }
+
return ("%s:%d.%d-%d.%d".printf (file.get_relative_filename (), begin.line, begin.column,
end.line, end.column));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]