[anjuta] vala language support: update to Vala 0.18



commit 63d60f62495a94d7743c0328315a91abb3703f31
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Jun 22 01:27:21 2012 -0400

    vala language support: update to Vala 0.18
    
    Add support for vala-0.18, dropping support for vala-0.14 (to keep the
    logic simple).  Vala 0.16 is still supported.
    
    There is an API incompatibility between libvala 0.16 and 0.18 with
    respect to source references.  Use #if VALA_0_18 to deal with that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678589

 configure.ac                                |   13 +++++--------
 plugins/language-support-vala/locator.vala  |   10 ++++++++++
 plugins/language-support-vala/provider.vala |    4 ++++
 plugins/language-support-vala/report.vala   |   13 +++++++++++++
 4 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f2fe703..3baf1ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,9 +52,6 @@ LIBDEVHELP_REQUIRED=3.0.0
 dnl Glade
 GLADEUI_REQUIRED=3.11.0
 
-dnl Vala
-VALA14_REQUIRED=0.13.3
-
 dnl Introspection
 GI_REQUIRED=0.9.5
 
@@ -263,10 +260,10 @@ if test "$user_disabled_vala" = 1; then
 else
         AC_MSG_RESULT(no)
 	AC_MSG_CHECKING(if libvala is available)
-	PKG_CHECK_EXISTS([ libvala-0.16 ],
-			 [ valaver="-0.16" ],
-			 [ PKG_CHECK_EXISTS([ libvala-0.14 >= $VALA14_REQUIRED ],
-					    [ valaver="-0.14" ],
+	PKG_CHECK_EXISTS([ libvala-0.18 ],
+			 [ valaver="-0.18" ],
+			 [ PKG_CHECK_EXISTS([ libvala-0.16 ],
+					    [ valaver="-0.16" ],
 					    [ valaver="" ])
 			 ])
 	if test "x$valaver" != "x"; then
@@ -277,7 +274,7 @@ else
 	else
 		AC_MSG_RESULT(no)
 		enable_vala="no"
-		VALA_REQUIRED=$VALA14_REQUIRED
+		VALA_REQUIRED=0.16.0
 	fi
 	AC_SUBST(LIBVALA)
 fi
diff --git a/plugins/language-support-vala/locator.vala b/plugins/language-support-vala/locator.vala
index 7cfbe87..15d628b 100644
--- a/plugins/language-support-vala/locator.vala
+++ b/plugins/language-support-vala/locator.vala
@@ -25,8 +25,13 @@ public class BlockLocator : Vala.CodeVisitor {
 			this.column = column;
 		}
 		public bool inside (Vala.SourceReference src) {
+#if VALA_0_18
+			var begin = Location (src.begin.line, src.begin.column);
+			var end = Location (src.end.line, src.end.column);
+#else
 			var begin = Location (src.first_line, src.first_column);
 			var end = Location (src.last_line, src.last_column);
+#endif
 
 			return begin.before (this) && this.before(end);
 		}
@@ -55,8 +60,13 @@ public class BlockLocator : Vala.CodeVisitor {
 		if (!location.inside (s.source_reference))
 			return false;
 
+#if VALA_0_18
+		var begin = Location (s.source_reference.begin.line, s.source_reference.begin.column);
+		var end = Location (s.source_reference.end.line, s.source_reference.end.column);
+#else
 		var begin = Location (s.source_reference.first_line, s.source_reference.first_column);
 		var end = Location (s.source_reference.last_line, s.source_reference.last_column);
+#endif
 
 		if (innermost == null || (innermost_begin.before(begin) && end.before(innermost_end))) {
 				innermost = s;
diff --git a/plugins/language-support-vala/provider.vala b/plugins/language-support-vala/provider.vala
index 15f327e..30ebf5d 100644
--- a/plugins/language-support-vala/provider.vala
+++ b/plugins/language-support-vala/provider.vala
@@ -69,7 +69,11 @@ public class ValaProvider : Object, IAnjuta.Provider {
 		var proposals = new GLib.List<IAnjuta.EditorAssistProposal?>();
 		foreach (var symbol in syms) {
 			if (symbol is Vala.LocalVariable
+#if VALA_0_18
+			    && symbol.source_reference.begin.line > editor.get_lineno())
+#else
 			    && symbol.source_reference.first_line > editor.get_lineno())
+#endif
 				continue;
 
 			var prop = IAnjuta.EditorAssistProposal();
diff --git a/plugins/language-support-vala/report.vala b/plugins/language-support-vala/report.vala
index a18c3e8..7a26196 100644
--- a/plugins/language-support-vala/report.vala
+++ b/plugins/language-support-vala/report.vala
@@ -41,17 +41,30 @@ public class AnjutaReport : Vala.Report {
 			if (e.source.file.filename.has_suffix (((IAnjuta.Document)editor).get_filename ())) {
 				if (ind != null) {
 					/* begin_iter should be one cell before to select the first character */
+#if VALA_0_18
+					var begin_iter = editor.get_line_begin_position (e.source.begin.line);
+					for (var i = 1; i < e.source.begin.column; i++)
+						begin_iter.next ();
+					var end_iter = editor.get_line_begin_position (e.source.end.line);
+					for (var i = 0; i < e.source.end.column; i++)
+						end_iter.next ();
+#else
 					var begin_iter = editor.get_line_begin_position (e.source.first_line);
 					for (var i = 1; i < e.source.first_column; i++)
 						begin_iter.next ();
 					var end_iter = editor.get_line_begin_position (e.source.last_line);
 					for (var i = 0; i < e.source.last_column; i++)
 						end_iter.next ();
+#endif
 					ind.set(begin_iter, end_iter, e.error ? IAnjuta.IndicableIndicator.CRITICAL :
 					                                        IAnjuta.IndicableIndicator.WARNING);
 				}
 				if (editor is IAnjuta.Markable) {
+#if VALA_0_18
+					mark.mark(e.source.begin.line, IAnjuta.MarkableMarker.MESSAGE, e.message);
+#else
 					mark.mark(e.source.first_line, IAnjuta.MarkableMarker.MESSAGE, e.message);
+#endif
 				}
 			}
 



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