[vala/wip/transform: 44/99] Don't navigate the resolver tree if a node has been checked already



commit 47fc064e3992a6bb6267da23b41246da483c1129
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jan 5 15:56:43 2012 +0100

    Don't navigate the resolver tree if a node has been checked already

 vala/valasymbolresolver.vala |  174 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 174 insertions(+), 0 deletions(-)
---
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 4fbe850..608e262 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -54,6 +54,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
        
        public override void visit_class (Class cl) {
+               if (cl.checked) {
+                       return;
+               }
+
                current_scope = cl.scope;
 
                cl.accept_children (this);
@@ -79,6 +83,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_struct (Struct st) {
+               if (st.checked) {
+                       return;
+               }
+
                current_scope = st.scope;
 
                st.accept_children (this);
@@ -98,6 +106,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_interface (Interface iface) {
+               if (iface.checked) {
+                       return;
+               }
+
                current_scope = iface.scope;
 
                iface.accept_children (this);
@@ -114,6 +126,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_enum (Enum en) {
+               if (en.checked) {
+                       return;
+               }
+
                current_scope = en.scope;
 
                en.accept_children (this);
@@ -122,6 +138,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_error_domain (ErrorDomain ed) {
+               if (ed.checked) {
+                       return;
+               }
+
                current_scope = ed.scope;
 
                ed.accept_children (this);
@@ -130,6 +150,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_delegate (Delegate cb) {
+               if (cb.checked) {
+                       return;
+               }
+
                current_scope = cb.scope;
 
                cb.accept_children (this);
@@ -138,6 +162,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_constant (Constant c) {
+               if (c.checked) {
+                       return;
+               }
+
                var old_scope = current_scope;
                if (!(c.parent_symbol is Block)) {
                        // non-local constant
@@ -150,6 +178,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_field (Field f) {
+               if (f.checked) {
+                       return;
+               }
+
                current_scope = f.scope;
 
                f.accept_children (this);
@@ -158,6 +190,10 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_method (Method m) {
+               if (m.checked) {
+                       return;
+               }
+
                current_scope = m.scope;
 
                m.accept_children (this);
@@ -166,34 +202,58 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_creation_method (CreationMethod m) {
+               if (m.checked) {
+                       return;
+               }
                m.accept_children (this);
        }
 
        public override void visit_formal_parameter (Parameter p) {
+               if (p.checked) {
+                       return;
+               }
                p.accept_children (this);
        }
 
        public override void visit_property (Property prop) {
+               if (prop.checked) {
+                       return;
+               }
                prop.accept_children (this);
        }
 
        public override void visit_property_accessor (PropertyAccessor acc) {
+               if (acc.checked) {
+                       return;
+               }
                acc.accept_children (this);
        }
 
        public override void visit_signal (Signal sig) {
+               if (sig.checked) {
+                       return;
+               }
                sig.accept_children (this);
        }
 
        public override void visit_constructor (Constructor c) {
+               if (c.checked) {
+                       return;
+               }
                c.accept_children (this);
        }
 
        public override void visit_destructor (Destructor d) {
+               if (d.checked) {
+                       return;
+               }
                d.accept_children (this);
        }
 
        public override void visit_block (Block b) {
+               if (b.checked) {
+                       return;
+               }
                b.accept_children (this);
        }
 
@@ -372,10 +432,16 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_declaration_statement (DeclarationStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_local_variable (LocalVariable local) {
+               if (local.checked) {
+                       return;
+               }
                local.accept_children (this);
                if (!context.experimental_non_null) {
                        // local reference variables are considered nullable
@@ -392,62 +458,107 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_initializer_list (InitializerList list) {
+               if (list.checked) {
+                       return;
+               }
                list.accept_children (this);
        }
 
        public override void visit_expression_statement (ExpressionStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_if_statement (IfStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_switch_statement (SwitchStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_switch_section (SwitchSection section) {
+               if (section.checked) {
+                       return;
+               }
                section.accept_children (this);
        }
 
        public override void visit_switch_label (SwitchLabel label) {
+               if (label.checked) {
+                       return;
+               }
                label.accept_children (this);
        }
 
        public override void visit_loop (Loop stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_while_statement (WhileStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_do_statement (DoStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_for_statement (ForStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_foreach_statement (ForeachStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_return_statement (ReturnStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_yield_statement (YieldStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_throw_statement (ThrowStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
        public override void visit_try_statement (TryStatement stmt) {
+               if (stmt.checked) {
+                       return;
+               }
                stmt.accept_children (this);
        }
 
@@ -456,86 +567,149 @@ public class Vala.SymbolResolver : CodeVisitor {
        }
 
        public override void visit_catch_clause (CatchClause clause) {
+               if (clause.checked) {
+                       return;
+               }
                clause.accept_children (this);
        }
 
        public override void visit_array_creation_expression (ArrayCreationExpression e) {
+               if (e.checked) {
+                       return;
+               }
                e.accept_children (this);
        }
 
        public override void visit_template (Template tmpl) {
+               if (tmpl.checked) {
+                       return;
+               }
                tmpl.accept_children (this);
        }
 
        public override void visit_tuple (Tuple tuple) {
+               if (tuple.checked) {
+                       return;
+               }
                tuple.accept_children (this);
        }
 
        public override void visit_member_access (MemberAccess expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_method_call (MethodCall expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_element_access (ElementAccess expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_slice_expression (SliceExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_postfix_expression (PostfixExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_object_creation_expression (ObjectCreationExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_sizeof_expression (SizeofExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_typeof_expression (TypeofExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_unary_expression (UnaryExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_cast_expression (CastExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_addressof_expression (AddressofExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_reference_transfer_expression (ReferenceTransferExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_binary_expression (BinaryExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_type_check (TypeCheck expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_conditional_expression (ConditionalExpression expr) {
+               if (expr.checked) {
+                       return;
+               }
                expr.accept_children (this);
        }
 
        public override void visit_lambda_expression (LambdaExpression l) {
+               if (l.checked) {
+                       return;
+               }
                l.accept_children (this);
        }
 
        public override void visit_assignment (Assignment a) {
+               if (a.checked) {
+                       return;
+               }
                a.accept_children (this);
        }
 }


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