[gnome-builder/wip/libide: 198/237] libide: use first source range if no source location was set



commit 684afa977a304ce201cc69b8f3b4bf56e84a74cd
Author: Christian Hergert <christian hergert me>
Date:   Sun Feb 15 00:18:02 2015 -0800

    libide: use first source range if no source location was set

 libide/ide-diagnostic.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-diagnostic.c b/libide/ide-diagnostic.c
index c2124a8..20055fa 100644
--- a/libide/ide-diagnostic.c
+++ b/libide/ide-diagnostic.c
@@ -111,7 +111,18 @@ ide_diagnostic_get_location (IdeDiagnostic *self)
 {
   g_return_val_if_fail (self, NULL);
 
-  return self->location;
+  if (self->location)
+    return self->location;
+
+  if (self->ranges && self->ranges->len > 0)
+    {
+      IdeSourceRange *range;
+
+      range = ide_diagnostic_get_range (self, 0);
+      return ide_source_range_get_begin (range);
+    }
+
+  return NULL;
 }
 
 IdeDiagnostic *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]