[vala/wip/ricotz/lsp-rev: 9/9] 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: 9/9] DON'T MERGE vala: Add sanity check for SourceReference
- Date: Tue, 21 Jan 2020 14:38:30 +0000 (UTC)
commit 86c4a3ceae26a9eb2817895a7961716dd1e2c635
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]