[vala/wip/ricotz/lsp-rev: 15/15] 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: 15/15] DON'T MERGE vala: Add sanity check for SourceReference
- Date: Tue, 21 Jan 2020 07:15:47 +0000 (UTC)
commit e8b9209e7c05fe08537149f10899c25eeb1a4512
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 746fb37ed..b39deeccf 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]