[gnome-builder/gnome-builder-3-34] vala-pack: Fix a few compiler warnings



commit 900c9a14d0901082b0f70b20f16dfa4623401c93
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Sep 30 15:12:05 2019 +0200

    vala-pack: Fix a few compiler warnings

 src/plugins/vala-pack/ide-vala-completion-provider.vala |  2 +-
 src/plugins/vala-pack/ide-vala-symbol-tree.vala         |  4 ++--
 src/plugins/vala-pack/lang-server/ide-utils.vala        | 12 ++++++------
 src/plugins/vala-pack/lang-server/ide-vala-locator.vala | 14 ++++++++------
 4 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/vala-pack/ide-vala-completion-provider.vala 
b/src/plugins/vala-pack/ide-vala-completion-provider.vala
index 3a067468a..af5671819 100644
--- a/src/plugins/vala-pack/ide-vala-completion-provider.vala
+++ b/src/plugins/vala-pack/ide-vala-completion-provider.vala
@@ -47,7 +47,7 @@ namespace Ide
                public bool refilter (Ide.CompletionContext context,
                                      GLib.ListModel proposals)
                {
-                       (proposals as ValaCompletionResults).refilter (context.get_word ());
+                       ((ValaCompletionResults) proposals).refilter (context.get_word ());
                        return true;
                }
 
diff --git a/src/plugins/vala-pack/ide-vala-symbol-tree.vala b/src/plugins/vala-pack/ide-vala-symbol-tree.vala
index 5278fe27b..eba9488a5 100644
--- a/src/plugins/vala-pack/ide-vala-symbol-tree.vala
+++ b/src/plugins/vala-pack/ide-vala-symbol-tree.vala
@@ -34,7 +34,7 @@ namespace Ide
                public uint get_n_children (Ide.SymbolNode? node)
                {
                        if (node != null)
-                               return (node as ValaSymbolNode).n_children;
+                               return ((ValaSymbolNode) node).n_children;
 
                        return (uint)tree.n_children ();
                }
@@ -42,7 +42,7 @@ namespace Ide
                public Ide.SymbolNode? get_nth_child (Ide.SymbolNode? node, uint nth)
                {
                        if (node != null)
-                               return (node as ValaSymbolNode).get_nth_child (nth);
+                               return ((ValaSymbolNode) node).get_nth_child (nth);
 
                        var child_val = tree.get_child_value (nth);
                        return new ValaSymbolNode (child_val);
diff --git a/src/plugins/vala-pack/lang-server/ide-utils.vala 
b/src/plugins/vala-pack/lang-server/ide-utils.vala
index b1adb8968..b6baf1afc 100644
--- a/src/plugins/vala-pack/lang-server/ide-utils.vala
+++ b/src/plugins/vala-pack/lang-server/ide-utils.vala
@@ -16,7 +16,7 @@ namespace Ide {
                                name = vala_symbol_name (symbol);
                        } else {
                                if (symbol is Vala.CreationMethod) {
-                                       name = (symbol as Vala.CreationMethod).class_name;
+                                       name = ((Vala.CreationMethod) symbol).class_name;
                                } else {
                                        name = symbol.name;
                                }
@@ -94,9 +94,9 @@ namespace Ide {
                } else if (symbol is Vala.Property) {
                        return symbol.name;
                } else if (symbol is Vala.CreationMethod) {
-                       return (symbol as Vala.CreationMethod).class_name;
+                       return ((Vala.CreationMethod) symbol).class_name;
                } else if (symbol is Vala.Method) {
-                       var type = new Vala.MethodType (symbol as Vala.Method);
+                       var type = new Vala.MethodType ((Vala.Method) symbol);
                        return type.to_prototype_string (null);
                }
 
@@ -123,11 +123,11 @@ namespace Ide {
        public static Vala.Symbol? vala_symbol_from_code_node (Vala.CodeNode node)
        {
                if (node is Vala.Expression)
-                       return (node as Vala.Expression).symbol_reference;
+                       return ((Vala.Expression) node).symbol_reference;
                else if (node is Vala.MethodCall)
-                       return (node as Vala.MethodCall).call.symbol_reference;
+                       return ((Vala.MethodCall) node).call.symbol_reference;
                else if (node is Vala.MemberAccess)
-                       return (node as Vala.MemberAccess).symbol_reference;
+                       return ((Vala.MemberAccess) node).symbol_reference;
                else
                        return (node as Vala.Symbol);
        }
diff --git a/src/plugins/vala-pack/lang-server/ide-vala-locator.vala 
b/src/plugins/vala-pack/lang-server/ide-vala-locator.vala
index a6a9ba378..6e8df59ef 100644
--- a/src/plugins/vala-pack/lang-server/ide-vala-locator.vala
+++ b/src/plugins/vala-pack/lang-server/ide-vala-locator.vala
@@ -257,11 +257,12 @@ namespace Ide {
 
                public override void visit_end_full_expression (Vala.Expression expr) {
                        if (expr is Vala.LambdaExpression) {
-                               if ((expr as Vala.LambdaExpression).method != null)
-                                       visit_method ((expr as Vala.LambdaExpression).method);
+                               unowned Vala.LambdaExpression lambda_expr = (Vala.LambdaExpression) expr;
+                               if (lambda_expr.method != null)
+                                       visit_method (lambda_expr.method);
                        }
                        if (expr is Vala.MethodCall) {
-                               foreach (Vala.Expression e in (expr as Vala.MethodCall).get_argument_list()) {
+                               foreach (Vala.Expression e in ((Vala.MethodCall) expr).get_argument_list()) {
                                        visit_expression (e);
                                }
                        }
@@ -269,8 +270,9 @@ namespace Ide {
 
                public override void visit_expression (Vala.Expression expr) {
                        if (expr is Vala.LambdaExpression) {
-                               if ((expr as Vala.LambdaExpression).method != null)
-                                       visit_method ((expr as Vala.LambdaExpression).method);
+                               unowned Vala.LambdaExpression lambda_expr = (Vala.LambdaExpression) expr;
+                               if (lambda_expr.method != null)
+                                       visit_method (lambda_expr.method);
                        }
                        /*if (expr is Vala.MethodCall) {
                                update_location (expr);
@@ -279,7 +281,7 @@ namespace Ide {
 
                        }*/
                        if (expr is Vala.Assignment) {
-                               (expr as Vala.Assignment).accept_children (this);
+                               ((Vala.Assignment) expr).accept_children (this);
                        }
                }
        }


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