[vala/wip/ricotz/lsp-rev: 12/12] 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: 12/12] DON'T MERGE vala: Add sanity check for SourceReference
- Date: Wed, 29 Jan 2020 09:04:52 +0000 (UTC)
commit 505a1984d69019533d14fa3535c4544d199fde2a
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]