]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Report unused fields, methods, and local variables
authorJürg Billeter <j@bitron.ch>
Fri, 14 Nov 2008 17:41:23 +0000 (17:41 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 14 Nov 2008 17:41:23 +0000 (17:41 +0000)
2008-11-14  Jürg Billeter  <j@bitron.ch>

* vala/valacfgbuilder.vala:
* vala/valamemberaccess.vala:
* vala/valamethod.vala:
* vala/valasymbol.vala:
* gobject/valaccodemethodmodule.vala:

Report unused fields, methods, and local variables

* vala/valacodecontext.vala:
* vala/valadynamicproperty.vala:
* vala/valaenum.vala:
* vala/valagenieparser.vala:
* vala/valainterfacewriter.vala:
* vala/valaparser.vala:
* vala/valastruct.vala:
* vala/valaunresolvedtype.vala:
* gobject/valaccodearraymodule.vala:
* gobject/valaccodeassignmentmodule.vala:
* gobject/valaccodebasemodule.vala:
* gobject/valaccodeinvocationexpressionmodule.vala:
* gobject/valaccodememberaccessmodule.vala:
* gobject/valadbusservermodule.vala:
* gobject/valagobjectmodule.vala:
* vapigen/valagirparser.vala:
* vapigen/valamarkupreader.vala:

Remove unused symbols

svn path=/trunk/; revision=2016

23 files changed:
ChangeLog
gobject/valaccodearraymodule.vala
gobject/valaccodeassignmentmodule.vala
gobject/valaccodebasemodule.vala
gobject/valaccodeinvocationexpressionmodule.vala
gobject/valaccodememberaccessmodule.vala
gobject/valaccodemethodmodule.vala
gobject/valadbusservermodule.vala
gobject/valagobjectmodule.vala
vala/valacfgbuilder.vala
vala/valacodecontext.vala
vala/valadynamicproperty.vala
vala/valaenum.vala
vala/valagenieparser.vala
vala/valainterfacewriter.vala
vala/valamemberaccess.vala
vala/valamethod.vala
vala/valaparser.vala
vala/valastruct.vala
vala/valasymbol.vala
vala/valaunresolvedtype.vala
vapigen/valagirparser.vala
vapigen/valamarkupreader.vala

index 905f8845a3db2707a55f50c6985202ccf00861f3..6e272da77a5b561d2edbb4e4acfec5e77e89ea46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2008-11-14  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valacfgbuilder.vala:
+       * vala/valamemberaccess.vala:
+       * vala/valamethod.vala:
+       * vala/valasymbol.vala:
+       * gobject/valaccodemethodmodule.vala:
+
+       Report unused fields, methods, and local variables
+
+       * vala/valacodecontext.vala:
+       * vala/valadynamicproperty.vala:
+       * vala/valaenum.vala:
+       * vala/valagenieparser.vala:
+       * vala/valainterfacewriter.vala:
+       * vala/valaparser.vala:
+       * vala/valastruct.vala:
+       * vala/valaunresolvedtype.vala:
+       * gobject/valaccodearraymodule.vala:
+       * gobject/valaccodeassignmentmodule.vala:
+       * gobject/valaccodebasemodule.vala:
+       * gobject/valaccodeinvocationexpressionmodule.vala:
+       * gobject/valaccodememberaccessmodule.vala:
+       * gobject/valadbusservermodule.vala:
+       * gobject/valagobjectmodule.vala:
+       * vapigen/valagirparser.vala:
+       * vapigen/valamarkupreader.vala:
+
+       Remove unused symbols
+
 2008-11-14  Jürg Billeter  <j@bitron.ch>
 
        * tests/Makefile.am:
index 55e5fa6bd7549117f9d317380aa651297c34aeb6..8754a657a532c1a26c9f2d4c360bc0499e8241aa 100644 (file)
@@ -178,8 +178,6 @@ public class Vala.CCodeArrayModule : CCodeInvocationExpressionModule {
                                                }
 
                                                var length_cname = get_array_length_cname (field.name, dim);
-                                               var instance_expression_type = get_data_type_for_symbol (base_type);
-                                               var instance_target_type = get_data_type_for_symbol ((TypeSymbol) field.parent_symbol);
                                                CCodeExpression typed_inst = (CCodeExpression) get_ccodenode (ma.inner);
 
                                                CCodeExpression inst;
index c1e6a3f587051afb72096957a6f1e6e6af17008a..a1262b28d9273cf85e3f07d715d7974a060f389a 100644 (file)
@@ -167,7 +167,6 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                                        ccomma.append_expression (new CCodeAssignment (lhs_array_len, rhs_array_len));
                                }
                        } else if (instance_delegate) {
-                               var delegate_type = (DelegateType) assignment.left.value_type;
                                var lhs_delegate_target = get_delegate_target_cexpression (assignment.left);
                                var rhs_delegate_target = get_delegate_target_cexpression (assignment.right);
                                ccomma.append_expression (new CCodeAssignment (lhs_delegate_target, rhs_delegate_target));
index a4af096de512d2c79055b5b5d4f484411b49f1db..f95fc7d8c7f2170dbcd11852a074892d32441635 100644 (file)
@@ -1592,8 +1592,6 @@ public class Vala.CCodeBaseModule : CCodeModule {
                var function = new CCodeFunction (destroy_func, "void");
                function.modifiers = CCodeModifiers.STATIC;
 
-               var cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
-
                function.add_parameter (new CCodeFormalParameter ("self", list_type.get_cname ()));
 
                // definition
index 0f620bd9b06c000cf1382996a6195303b2d68495..fb993e1ff58b6721fcafcc14ea4c565092d326f7 100644 (file)
@@ -169,7 +169,6 @@ public class Vala.CCodeInvocationExpressionModule : CCodeAssignmentModule {
                Iterator<FormalParameter> params_it = params.iterator ();
                foreach (Expression arg in expr.get_argument_list ()) {
                        CCodeExpression cexpr = (CCodeExpression) arg.ccodenode;
-                       Gee.List<CCodeExpression> extra_args = new ArrayList<CCodeExpression> ();
                        if (params_it.next ()) {
                                var param = params_it.get ();
                                ellipsis = param.ellipsis;
index bc77bb1a0f3a36e58c3e37338ba8599f65b21e8a..cb22da5e4c1afea85f3f50ee83ba790f7a080232 100644 (file)
@@ -89,7 +89,6 @@ public class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                } else if (expr.symbol_reference is Field) {
                        var f = (Field) expr.symbol_reference;
                        if (f.binding == MemberBinding.INSTANCE) {
-                               var instance_expression_type = base_type;
                                var instance_target_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
 
                                var cl = instance_target_type.data_type as Class;
index a201ef974c50065b969abd649084511e0e7faa1a..2394f9ced498368835e46ced8178e14dbbb88cbb 100644 (file)
@@ -555,8 +555,6 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
                                var vfunc = new CCodeFunction (m.get_cname (), creturn_type.get_cname ());
                                vfunc.line = function.line;
 
-                               ReferenceType this_type = new ObjectType ((Class) m.parent_symbol);
-
                                cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
                                var carg_map = new HashMap<int,CCodeExpression> (direct_hash, direct_equal);
 
@@ -609,9 +607,7 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
                        }
                }
                
-               bool return_value = true;
-               bool args_parameter = true;
-               if (is_possible_entry_point (m, ref return_value, ref args_parameter)) {
+               if (m.entry_point) {
                        // m is possible entry point, add appropriate startup code
                        var cmain = new CCodeFunction ("main", "int");
                        cmain.line = function.line;
@@ -631,15 +627,11 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
                        main_block.add_statement (type_init_call);
 
                        var main_call = new CCodeFunctionCall (new CCodeIdentifier (function.name));
-                       if (args_parameter) {
+                       if (m.get_parameters ().size == 1) {
                                main_call.add_argument (new CCodeIdentifier ("argv"));
                                main_call.add_argument (new CCodeIdentifier ("argc"));
                        }
-                       if (return_value) {
-                               var main_stmt = new CCodeReturnStatement (main_call);
-                               main_stmt.line = cmain.line;
-                               main_block.add_statement (main_stmt);
-                       } else {
+                       if (m.return_type is VoidType) {
                                // method returns void, always use 0 as exit code
                                var main_stmt = new CCodeExpressionStatement (main_call);
                                main_stmt.line = cmain.line;
@@ -647,6 +639,10 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
                                var ret_stmt = new CCodeReturnStatement (new CCodeConstant ("0"));
                                ret_stmt.line = cmain.line;
                                main_block.add_statement (ret_stmt);
+                       } else {
+                               var main_stmt = new CCodeReturnStatement (main_call);
+                               main_stmt.line = cmain.line;
+                               main_block.add_statement (main_stmt);
                        }
                        cmain.block = main_block;
                        source_type_member_definition.append (cmain);
@@ -833,62 +829,6 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
                return null;
        }
 
-       private bool is_possible_entry_point (Method m, ref bool return_value, ref bool args_parameter) {
-               if (m.name == null || m.name != "main") {
-                       // method must be called "main"
-                       return false;
-               }
-               
-               if (m.binding == MemberBinding.INSTANCE) {
-                       // method must be static
-                       return false;
-               }
-               
-               if (m.return_type.data_type == null) {
-                       return_value = false;
-               } else if (m.return_type.data_type == int_type.data_type) {
-                       return_value = true;
-               } else {
-                       // return type must be void or int
-                       return false;
-               }
-               
-               var params = m.get_parameters ();
-               if (params.size == 0) {
-                       // method may have no parameters
-                       args_parameter = false;
-                       return true;
-               }
-
-               if (params.size > 1) {
-                       // method must not have more than one parameter
-                       return false;
-               }
-               
-               Iterator<FormalParameter> params_it = params.iterator ();
-               params_it.next ();
-               var param = params_it.get ();
-
-               if (param.direction == ParameterDirection.OUT) {
-                       // parameter must not be an out parameter
-                       return false;
-               }
-               
-               if (!(param.parameter_type is ArrayType)) {
-                       // parameter must be an array
-                       return false;
-               }
-               
-               var array_type = (ArrayType) param.parameter_type;
-               if (array_type.element_type.data_type != string_type.data_type) {
-                       // parameter must be an array of strings
-                       return false;
-               }
-               
-               args_parameter = true;
-               return true;
-       }
-
        private void add_object_creation (CCodeBlock b, bool has_params) {
                var cl = (Class) current_type_symbol;
 
index 67c16e2e96d83b6af38266d4d130467aae601556..1c5b2265a49cb761f6c7de790da3fa0e84b5d6d7 100644 (file)
@@ -365,7 +365,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (param.parameter_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table output parameter
                                var type_args = param.parameter_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
@@ -393,7 +392,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (m.return_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table output parameter
                                var type_args = m.return_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
@@ -436,7 +434,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (param.parameter_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table output parameter
                                var type_args = param.parameter_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
@@ -462,7 +459,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (m.return_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table return value
                                var type_args = m.return_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
@@ -524,7 +520,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (param.parameter_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table output parameter
                                var type_args = param.parameter_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
@@ -552,7 +547,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (m.return_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table output parameter
                                var type_args = m.return_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
@@ -583,7 +577,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                                } else if (param.parameter_type.get_type_signature ().has_prefix ("a{")) {
                                        // hash table output parameter
                                        var type_args = param.parameter_type.get_type_arguments ();
-                                       var key_type = type_args.get (0);
                                        var value_type = type_args.get (1);
                                        if (value_type.get_type_signature ().has_prefix ("(")) {
                                                // values are structs
@@ -635,7 +628,6 @@ public class Vala.DBusServerModule : DBusClientModule {
                        } else if (m.return_type.get_type_signature ().has_prefix ("a{")) {
                                // hash table output parameter
                                var type_args = m.return_type.get_type_arguments ();
-                               var key_type = type_args.get (0);
                                var value_type = type_args.get (1);
                                if (value_type.get_type_signature ().has_prefix ("(")) {
                                        // values are structs
index dee9668ca10fd0edcd305f04a5b872880f045b56..68f97d19cbea4ca41579be29a7c28d9a4e98c4d3 100644 (file)
@@ -306,9 +306,11 @@ public class Vala.GObjectModule : GTypeModule {
                        source_type_member_definition.append (function);
                }
 
+               current_symbol = old_symbol;
                current_type_symbol = old_type_symbol;
                current_class = old_class;
                instance_struct = old_instance_struct;
+               param_spec_struct = old_param_spec_struct;
                type_struct = old_type_struct;
                instance_priv_struct = old_instance_priv_struct;
                prop_enum = old_prop_enum;
index 64a138f316f60b7d3f8fa66d8662fdb0aa73aca0..fe65091e7ef7e3f0cc5bf4f9600e96152c8d8435 100644 (file)
@@ -118,7 +118,21 @@ public class Vala.CFGBuilder : CodeVisitor {
                ed.accept_children (this);
        }
 
+       public override void visit_field (Field f) {
+               if (f.access != SymbolAccessibility.PUBLIC
+                   && f.access != SymbolAccessibility.PROTECTED
+                   && !f.used) {
+                       Report.warning (f.source_reference, "field `%s' never used".printf (f.get_full_name ()));
+               }
+       }
+
        public override void visit_method (Method m) {
+               if (m.access != SymbolAccessibility.PUBLIC
+                   && m.access != SymbolAccessibility.PROTECTED
+                   && !m.used && !m.entry_point) {
+                       Report.warning (m.source_reference, "method `%s' never used".printf (m.get_full_name ()));
+               }
+
                if (m.body == null) {
                        return;
                }
@@ -189,6 +203,10 @@ public class Vala.CFGBuilder : CodeVisitor {
                        return;
                }
 
+               if (!stmt.declaration.used) {
+                       Report.warning (stmt.declaration.source_reference, "local variable `%s' declared but never used".printf (stmt.declaration.name));
+               }
+
                current_block.add_node (stmt);
 
                var local = stmt.declaration as LocalVariable;
index 67252c63157f7f7d8331ec461d853f7698d8d755..1654d1c089c6b910e7d26a6640cec20df1fdf997 100644 (file)
@@ -345,7 +345,7 @@ public class Vala.CodeContext {
                                                continue;
                                        }
                                        
-                                       if (cycle_file.cycle != null) {
+                                       if (ref_cycle_file_cycle != null) {
                                                /* file already in a cycle */
                                                
                                                if (cycle_file.cycle == cycle) {
index cc092c26b2559b65a479bdb9cc7703fed74f9134..c7ee1253a44fe63c2f25f57bea05be0bc39ca34d 100644 (file)
@@ -29,8 +29,6 @@ using Gee;
 public class Vala.DynamicProperty : Property {
        public DataType dynamic_type { get; set; }
 
-       private string cname;
-
        public DynamicProperty (DataType dynamic_type, string name, SourceReference? source_reference = null) {
                base (name, null, null, null, source_reference);
                this.dynamic_type = dynamic_type;
index d1da55e682941c598b82e74580e2b05e93957f65..56eca2b2f9ee2a50dd141204bee5901244f03c01 100644 (file)
@@ -160,11 +160,7 @@ public class Vala.Enum : TypeSymbol {
        public override bool is_reference_type () {
                return false;
        }
-       
-       private void set_cname (string cname) {
-               this.cname = cname;
-       }
-       
+
        /**
         * Returns the string to be prepended to the name of members of this
         * enum when used in C code.
index 60595ceb81faa3ab91869fe72d265d8dc29fb9a4..d004710afb020f429c634a085bf21afbff0534a9 100644 (file)
@@ -201,12 +201,6 @@ public class Vala.Genie.Parser : CodeVisitor {
                return new SourceReference (scanner.source_file, tokens[index].begin.line, tokens[index].begin.column, tokens[index].end.line, tokens[index].end.column);
        }
 
-       SourceReference get_last_src () {
-               int last_index = (index + BUFFER_SIZE - 1) % BUFFER_SIZE;
-
-               return new SourceReference (scanner.source_file, tokens[last_index].begin.line, tokens[last_index].begin.column, tokens[last_index].end.line, tokens[last_index].end.column);
-       }
-
        void rollback (SourceLocation location) {
                while (tokens[index].begin.pos != location.pos) {
                        prev ();
@@ -1684,7 +1678,6 @@ public class Vala.Genie.Parser : CodeVisitor {
 
        Block parse_block () throws ParseError {
                var begin = get_location ();
-               Gee.List<Statement> list = new ArrayList<Statement> ();
                expect (TokenType.INDENT);
                var block = new Block (get_src_com (begin));
                parse_statements (block);
@@ -1715,8 +1708,6 @@ public class Vala.Genie.Parser : CodeVisitor {
        }
 
        void parse_local_variable_declarations (Block block) throws ParseError {
-               var begin = get_location ();
-
                if (accept (TokenType.VAR)) {
                        /* support block vars */
                        if (accept (TokenType.EOL) && accept (TokenType.INDENT)) {
@@ -2342,10 +2333,7 @@ public class Vala.Genie.Parser : CodeVisitor {
        }
 
        void parse_using_directives () throws ParseError {
-               var begin = get_location ();
                while (accept (TokenType.USES)) {
-                       var begin = get_location ();
-
                        if (accept_block ()) {
                                expect (TokenType.INDENT);
 
@@ -2793,7 +2781,6 @@ public class Vala.Genie.Parser : CodeVisitor {
                        while (current () != TokenType.DEDENT) {
                                var accessor_begin = get_location ();
                                parse_attributes ();
-                               var accessor_access = SymbolAccessibility.PUBLIC;
                                if (accept (TokenType.GET)) {
                                        if (prop.get_accessor != null) {
                                                throw new ParseError.SYNTAX (get_error ("property get accessor already defined"));
@@ -3296,7 +3283,7 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                expect (TokenType.CONSTRUCT);
 
-               var flags = parse_member_declaration_modifiers ();
+               parse_member_declaration_modifiers ();
 
 
                if (accept (TokenType.OPEN_PARENS)) {
@@ -3480,27 +3467,5 @@ public class Vala.Genie.Parser : CodeVisitor {
                } while (accept (TokenType.DOT));
                return expr;
        }
-
-       bool is_declaration_keyword (TokenType type) {
-               switch (type) {
-               case TokenType.CLASS:
-               case TokenType.CONST:
-               case TokenType.DEF:
-               case TokenType.DELEGATE:
-               case TokenType.ENUM:
-               case TokenType.ERRORDOMAIN:
-               case TokenType.EVENT:
-               case TokenType.FINAL:
-               case TokenType.INIT:
-               case TokenType.INTERFACE:
-               case TokenType.NAMESPACE:
-               case TokenType.OVERRIDE:
-               case TokenType.PROP:
-               case TokenType.STRUCT:
-                       return true;
-               default:
-                       return false;
-               }
-       }
 }
 
index 970f5dca4932b87ff651b16800252cd98ca35d75..f2cfcfe56ef7007e346daf3f25e4d1fadee7459d 100644 (file)
@@ -36,8 +36,6 @@ public class Vala.InterfaceWriter : CodeVisitor {
        /* at begin of line */
        bool bol = true;
 
-       string current_cheader_filename;
-
        Scope current_scope;
 
        /**
index 7d5bacf42d6d0f6a2b60fd9a203498227f8db997..6ced16f4c494ed7e93e6379998315a62fb2a86c1 100644 (file)
@@ -444,6 +444,8 @@ public class Vala.MemberAccess : Expression {
                        instance = true;
                }
 
+               member.used = true;
+
                if (access == SymbolAccessibility.PRIVATE) {
                        var target_type = member.parent_symbol;
 
index a91412ac87594e7638631fb0bcb3eba4ec136897..8dd2ccd24fc5cb0502a2fa69866343236cced4df 100644 (file)
@@ -145,7 +145,9 @@ public class Vala.Method : Member {
                        return _base_interface_method;
                }
        }
-       
+
+       public bool entry_point { get; private set; }
+
        /**
         * Specifies the generated `this' parameter for instance methods.
         */
@@ -768,6 +770,62 @@ public class Vala.Method : Member {
                        }
                }
 
+               if (is_possible_entry_point (analyzer)) {
+                       entry_point = true;
+               }
+
                return !error;
        }
+
+       bool is_possible_entry_point (SemanticAnalyzer analyzer) {
+               if (name == null || name != "main") {
+                       // method must be called "main"
+                       return false;
+               }
+               
+               if (binding == MemberBinding.INSTANCE) {
+                       // method must be static
+                       return false;
+               }
+               
+               if (return_type is VoidType) {
+               } else if (return_type.data_type == analyzer.int_type.data_type) {
+               } else {
+                       // return type must be void or int
+                       return false;
+               }
+               
+               var params = get_parameters ();
+               if (params.size == 0) {
+                       // method may have no parameters
+                       return true;
+               }
+
+               if (params.size > 1) {
+                       // method must not have more than one parameter
+                       return false;
+               }
+               
+               Iterator<FormalParameter> params_it = params.iterator ();
+               params_it.next ();
+               var param = params_it.get ();
+
+               if (param.direction == ParameterDirection.OUT) {
+                       // parameter must not be an out parameter
+                       return false;
+               }
+               
+               if (!(param.parameter_type is ArrayType)) {
+                       // parameter must be an array
+                       return false;
+               }
+               
+               var array_type = (ArrayType) param.parameter_type;
+               if (array_type.element_type.data_type != analyzer.string_type.data_type) {
+                       // parameter must be an array of strings
+                       return false;
+               }
+               
+               return true;
+       }
 }
index b49d39d5501ae5ccb69a227d843b0fdb99bad078..9fce44012387a06b5538248dccd55ed3d6bd7dad 100644 (file)
@@ -1341,7 +1341,6 @@ public class Vala.Parser : CodeVisitor {
 
        Block parse_block () throws ParseError {
                var begin = get_location ();
-               Gee.List<Statement> list = new ArrayList<Statement> ();
                expect (TokenType.OPEN_BRACE);
                var block = new Block (get_src_com (begin));
                parse_statements (block);
@@ -1365,7 +1364,6 @@ public class Vala.Parser : CodeVisitor {
        }
 
        void parse_local_variable_declarations (Block block) throws ParseError {
-               var begin = get_location ();
                DataType variable_type;
                if (accept (TokenType.VAR)) {
                        variable_type = null;
@@ -1929,8 +1927,6 @@ public class Vala.Parser : CodeVisitor {
 
        void parse_using_directives () throws ParseError {
                while (accept (TokenType.USING)) {
-                       var begin = get_location ();
-
                        do {
                                var begin = get_location ();
                                var sym = parse_symbol_name ();
index 7efc9500ed09b81b7f3c16c20a77c950dd9ff041..daab55369c2da318e38c5128c1efdc1536d7c4ae 100644 (file)
@@ -36,8 +36,6 @@ public class Vala.Struct : TypeSymbol {
        
        private string cname;
        private string const_cname;
-       private string dup_function;
-       private string free_function;
        private string type_id;
        private string lower_case_cprefix;
        private string lower_case_csuffix;
@@ -222,10 +220,6 @@ public class Vala.Struct : TypeSymbol {
                return "%s%s".printf (parent_symbol.get_cprefix (), name);
        }
 
-       private void set_cname (string cname) {
-               this.cname = cname;
-       }
-       
        private void set_const_cname (string cname) {
                this.const_cname = cname;
        }
index b9ccd7e94ee3f1557b0ce3002c576c3662dceb90..ac0ec44c58af771393a115abdd6c9f4d3e162ca4 100644 (file)
@@ -68,6 +68,11 @@ public abstract class Vala.Symbol : CodeNode {
         */
        public bool active { get; set; default = true; }
 
+       /**
+        * Specifies whether this symbol has been accessed.
+        */
+       public bool used { get; set; }
+
        /**
         * Specifies the accessibility of this symbol. Public accessibility
         * doesn't limit access. Default accessibility limits access to this
index bde88516c53f9a21a5dd93b05bd85af5d4923703..a651c47d496346d86be2ae560afede68ff247cb8 100644 (file)
@@ -56,8 +56,6 @@ public class Vala.UnresolvedType : DataType {
         * @return       newly created type reference
         */
        public static UnresolvedType? new_from_expression (Expression expr) {
-               string ns = null;
-               string type_name = null;
                if (expr is MemberAccess) {
                        UnresolvedType type_ref = null;
                
index 09571e24928f123b987d1bce3585550a9ffacb26..a8b6fc20d130b18161f721180679e74cb95dc3f9 100644 (file)
@@ -670,7 +670,7 @@ public class Vala.GirParser : CodeVisitor {
                string name = reader.get_attribute ("name");
                next ();
 
-               var return_type = parse_return_value ();
+               parse_return_value ();
 
                var m = new CreationMethod (null, name, get_current_src ());
                m.access = SymbolAccessibility.PUBLIC;
index 81b2b443c5a44ebb6b0d3f066352191c3c11462a..3c308d04f7548a4b6df9606ae141031b2fb20fe0 100644 (file)
@@ -189,7 +189,7 @@ public class Vala.MarkupReader : Object {
                                return read_token (out token_begin, out token_end);
                        }
                        type = MarkupTokenType.TEXT;
-                       string text = ((string) text_begin).ndup (current - text_begin);
+                       // string text = ((string) text_begin).ndup (current - text_begin);
                }
 
                column += (int) (current - begin);