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



commit 5d851f436595c38ce3ae5929cb4a4f92f76ebeac
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 |  180 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 180 insertions(+), 0 deletions(-)
---
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 5b2ba32..d502401 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);
@@ -91,6 +95,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);
@@ -110,6 +118,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);
@@ -134,6 +146,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);
@@ -142,6 +158,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);
@@ -150,6 +170,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);
@@ -158,6 +182,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
@@ -170,6 +198,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);
@@ -178,6 +210,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);
@@ -186,34 +222,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);
 	}
 
@@ -396,6 +456,9 @@ public class Vala.SymbolResolver : CodeVisitor {
 	}
 
 	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
@@ -412,158 +475,275 @@ 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);
 	}
 
 	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_list_literal (ListLiteral lit) {
+		if (lit.checked) {
+			return;
+		}
 		lit.accept_children (this);
 	}
 
 	public override void visit_set_literal (SetLiteral lit) {
+		if (lit.checked) {
+			return;
+		}
 		lit.accept_children (this);
 	}
 
 	public override void visit_map_literal (MapLiteral lit) {
+		if (lit.checked) {
+			return;
+		}
 		lit.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]