[vala] Replace SemanticAnalyzer with CodeContext in CodeNode.check parameter



commit fb3a31632feda7c36473037dd2e513850e7210de
Author: Jürg Billeter <j bitron ch>
Date:   Thu Oct 28 13:58:01 2010 +0200

    Replace SemanticAnalyzer with CodeContext in CodeNode.check parameter

 vala/valaaddressofexpression.vala         |    4 +-
 vala/valaarraycreationexpression.vala     |   16 +++---
 vala/valaarraytype.vala                   |    4 +-
 vala/valaassignment.vala                  |   38 ++++++------
 vala/valabaseaccess.vala                  |   16 +++---
 vala/valabinaryexpression.vala            |   90 ++++++++++++++--------------
 vala/valablock.vala                       |   18 +++---
 vala/valabooleanliteral.vala              |    4 +-
 vala/valacastexpression.vala              |    6 +-
 vala/valacatchclause.vala                 |   10 ++--
 vala/valacharacterliteral.vala            |   10 ++--
 vala/valaclass.vala                       |   56 +++++++++---------
 vala/valacodenode.vala                    |    2 +-
 vala/valaconditionalexpression.vala       |   18 +++---
 vala/valaconstant.vala                    |   26 ++++----
 vala/valaconstructor.vala                 |   12 ++--
 vala/valacreationmethod.vala              |   52 ++++++++--------
 vala/valadeclarationstatement.vala        |    4 +-
 vala/valadelegate.vala                    |   16 +++---
 vala/valadelegatetype.vala                |    4 +-
 vala/valadeletestatement.vala             |    4 +-
 vala/valadestructor.vala                  |   10 ++--
 vala/valadostatement.vala                 |    8 +-
 vala/valadynamicmethod.vala               |    2 +-
 vala/valadynamicproperty.vala             |    2 +-
 vala/valadynamicsignal.vala               |    2 +-
 vala/valaelementaccess.vala               |   14 ++--
 vala/valaenum.vala                        |   20 +++---
 vala/valaenumvalue.vala                   |    4 +-
 vala/valaerrorcode.vala                   |    4 +-
 vala/valaerrordomain.vala                 |    6 +-
 vala/valaerrortype.vala                   |    4 +-
 vala/valaexpressionstatement.vala         |    4 +-
 vala/valafield.vala                       |   20 +++---
 vala/valaforeachstatement.vala            |   40 ++++++------
 vala/valaforstatement.vala                |    6 +-
 vala/valaifstatement.vala                 |   12 ++--
 vala/valainitializerlist.vala             |    6 +-
 vala/valaintegerliteral.vala              |    6 +-
 vala/valainterface.vala                   |   38 ++++++------
 vala/valalambdaexpression.vala            |   22 ++++----
 vala/valalistliteral.vala                 |   10 ++--
 vala/valalocalvariable.vala               |   10 ++--
 vala/valalockstatement.vala               |    8 +-
 vala/valaloop.vala                        |    4 +-
 vala/valamapliteral.vala                  |    8 +-
 vala/valamemberaccess.vala                |   58 +++++++++---------
 vala/valamemberinitializer.vala           |    4 +-
 vala/valamethod.vala                      |   62 ++++++++++----------
 vala/valamethodcall.vala                  |   68 +++++++++++-----------
 vala/valanamedargument.vala               |    4 +-
 vala/valanamespace.vala                   |    4 +-
 vala/valanullliteral.vala                 |    2 +-
 vala/valaobjectcreationexpression.vala    |   38 ++++++------
 vala/valaobjecttype.vala                  |    6 +-
 vala/valaparameter.vala                   |   22 ++++----
 vala/valapointerindirection.vala          |    4 +-
 vala/valapointertype.vala                 |    4 +-
 vala/valapostfixexpression.vala           |    4 +-
 vala/valaproperty.vala                    |   24 ++++----
 vala/valapropertyaccessor.vala            |   20 +++---
 vala/valarealliteral.vala                 |    6 +-
 vala/valareferencetransferexpression.vala |    4 +-
 vala/valaregexliteral.vala                |    6 +-
 vala/valareturnstatement.vala             |   26 ++++----
 vala/valasemanticanalyzer.vala            |    8 +-
 vala/valasetliteral.vala                  |    6 +-
 vala/valasignal.vala                      |    8 +-
 vala/valasizeofexpression.vala            |    6 +-
 vala/valasliceexpression.vala             |   10 ++--
 vala/valasourcefile.vala                  |    4 +-
 vala/valastringliteral.vala               |    4 +-
 vala/valastruct.vala                      |   26 ++++----
 vala/valaswitchlabel.vala                 |    4 +-
 vala/valaswitchsection.vala               |   20 +++---
 vala/valaswitchstatement.vala             |    8 +-
 vala/valatemplate.vala                    |    8 +-
 vala/valathrowstatement.vala              |   10 ++--
 vala/valatrystatement.vala                |    8 +-
 vala/valatuple.vala                       |    8 +-
 vala/valatypecheck.vala                   |    8 +-
 vala/valatypeofexpression.vala            |    6 +-
 vala/valaunaryexpression.vala             |   10 ++--
 vala/valaunlockstatement.vala             |    6 +-
 vala/valavaluetype.vala                   |    4 +-
 vala/valawhilestatement.vala              |    4 +-
 vala/valayieldstatement.vala              |    6 +-
 87 files changed, 614 insertions(+), 614 deletions(-)
---
diff --git a/vala/valaaddressofexpression.vala b/vala/valaaddressofexpression.vala
index 1033ccc..7786cfd 100644
--- a/vala/valaaddressofexpression.vala
+++ b/vala/valaaddressofexpression.vala
@@ -72,14 +72,14 @@ public class Vala.AddressofExpression : Expression {
 		return inner.is_pure ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!inner.check (analyzer)) {
+		if (!inner.check (context)) {
 			error = true;
 			return false;
 		}
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index d8d0f2c..1c72d6b 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -128,11 +128,11 @@ public class Vala.ArrayCreationExpression : Expression {
 		}
 	}
 
-	private int create_sizes_from_initializer_list (SemanticAnalyzer analyzer, InitializerList il, int rank, List<Literal> sl) {
+	private int create_sizes_from_initializer_list (CodeContext context, InitializerList il, int rank, List<Literal> sl) {
 		if (sl.size == (this.rank - rank)) {
 			// only add size if this is the first initializer list of the current dimension
 			var init = new IntegerLiteral (il.size.to_string (), il.source_reference);
-			init.check (analyzer);
+			init.check (context);
 			sl.add (init);
 		}
 
@@ -145,7 +145,7 @@ public class Vala.ArrayCreationExpression : Expression {
 					Report.error (e.source_reference, "Expected array element, got array initializer list");
 					return -1;
 				}
-				int size = create_sizes_from_initializer_list (analyzer, (InitializerList) e, rank - 1, sl);
+				int size = create_sizes_from_initializer_list (context, (InitializerList) e, rank - 1, sl);
 				if (size == -1) {
 					return -1;
 				}
@@ -168,7 +168,7 @@ public class Vala.ArrayCreationExpression : Expression {
 		return il.size;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -179,20 +179,20 @@ public class Vala.ArrayCreationExpression : Expression {
 		var initlist = initializer_list;
 
 		if (element_type != null) {
-			element_type.check (analyzer);
+			element_type.check (context);
 		}
 
 		foreach (Expression e in sizes) {
-			e.check (analyzer);
+			e.check (context);
 		}
 
 		var calc_sizes = new ArrayList<Literal> ();
 		if (initlist != null) {
 			initlist.target_type = new ArrayType (element_type, rank, source_reference);
 
-			initlist.check (analyzer);
+			initlist.check (context);
 
-			var ret = create_sizes_from_initializer_list (analyzer, initlist, rank, calc_sizes);
+			var ret = create_sizes_from_initializer_list (context, initlist, rank, calc_sizes);
 			if (ret == -1) {
 				error = true;
 			}
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index bff5333..5ed4ff6 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -236,13 +236,13 @@ public class Vala.ArrayType : ReferenceType {
 		return element_type.is_accessible (sym);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (invalid_syntax) {
 			Report.error (source_reference, "syntax error, no expression allowed between array brackets");
 			error = true;
 			return false;
 		}
-		return element_type.check (analyzer);
+		return element_type.check (context);
 	}
 
 	public override string? get_type_id () {
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 993de9b..2af76b7 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -97,7 +97,7 @@ public class Vala.Assignment : Expression {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -109,15 +109,15 @@ public class Vala.Assignment : Expression {
 
 			var local = new LocalVariable (null, get_temp_name (), right, right.source_reference);
 			var decl = new DeclarationStatement (local, source_reference);
-			decl.check (analyzer);
-			insert_statement (analyzer.insert_block, decl);
+			decl.check (context);
+			insert_statement (context.analyzer.insert_block, decl);
 
 			int i = 0;
 			ExpressionStatement stmt = null;
 			foreach (var expr in tuple.get_expressions ()) {
 				if (stmt != null) {
-					stmt.check (analyzer);
-					insert_statement (analyzer.insert_block, stmt);
+					stmt.check (context);
+					insert_statement (context.analyzer.insert_block, stmt);
 				}
 
 				var temp_access = new MemberAccess.simple (local.name, right.source_reference);
@@ -129,14 +129,14 @@ public class Vala.Assignment : Expression {
 				i++;
 			}
 
-			analyzer.replaced_nodes.add (this);
+			context.analyzer.replaced_nodes.add (this);
 			parent_node.replace_expression (this, stmt.expression);
-			return stmt.expression.check (analyzer);
+			return stmt.expression.check (context);
 		}
 
 		left.lvalue = true;
 
-		if (!left.check (analyzer)) {
+		if (!left.check (context)) {
 			// skip on error in inner expression
 			error = true;
 			return false;
@@ -146,7 +146,7 @@ public class Vala.Assignment : Expression {
 			var ma = (MemberAccess) left;
 
 			if ((!(ma.symbol_reference is Signal || ma.symbol_reference is DynamicProperty) && ma.value_type == null) ||
-			    (ma.inner == null && ma.member_name == "this" && analyzer.is_in_instance_method ())) {
+			    (ma.inner == null && ma.member_name == "this" && context.analyzer.is_in_instance_method ())) {
 				error = true;
 				Report.error (source_reference, "unsupported lvalue in assignment");
 				return false;
@@ -165,11 +165,11 @@ public class Vala.Assignment : Expression {
 
 			if (ma.symbol_reference is DynamicSignal) {
 				// target_type not available for dynamic signals
-				if (!analyzer.context.deprecated) {
+				if (!context.deprecated) {
 					Report.warning (source_reference, "deprecated syntax, use `connect' method instead");
 				}
 			} else if (ma.symbol_reference is Signal) {
-				if (!analyzer.context.deprecated) {
+				if (!context.deprecated) {
 					Report.warning (source_reference, "deprecated syntax, use `connect' method instead");
 				}
 				var sig = (Signal) ma.symbol_reference;
@@ -181,7 +181,7 @@ public class Vala.Assignment : Expression {
 		} else if (left is ElementAccess) {
 			var ea = (ElementAccess) left;
 
-			if (ea.container.value_type.data_type == analyzer.string_type.data_type) {
+			if (ea.container.value_type.data_type == context.analyzer.string_type.data_type) {
 				error = true;
 				Report.error (ea.source_reference, "strings are immutable");
 				return false;
@@ -196,7 +196,7 @@ public class Vala.Assignment : Expression {
 				}
 				set_call.add_argument (right);
 				parent_node.replace_expression (this, set_call);
-				return set_call.check (analyzer);
+				return set_call.check (context);
 			} else {
 				right.target_type = left.value_type;
 			}
@@ -208,7 +208,7 @@ public class Vala.Assignment : Expression {
 			return false;
 		}
 
-		if (!right.check (analyzer)) {
+		if (!right.check (context)) {
 			// skip on error in inner expression
 			error = true;
 			return false;
@@ -252,7 +252,7 @@ public class Vala.Assignment : Expression {
 				}
 
 				right = bin;
-				right.check (analyzer);
+				right.check (context);
 
 				operator = AssignmentOperator.SIMPLE;
 			}
@@ -306,14 +306,14 @@ public class Vala.Assignment : Expression {
 				}
 
 				if (prop.set_accessor == null
-				    || (!prop.set_accessor.writable && !(analyzer.find_current_method () is CreationMethod || analyzer.is_in_constructor ()))) {
+				    || (!prop.set_accessor.writable && !(context.analyzer.find_current_method () is CreationMethod || context.analyzer.is_in_constructor ()))) {
 					ma.error = true;
 					Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ()));
 					return false;
-				} else if (!analyzer.context.deprecated
+				} else if (!context.deprecated
 				           && !prop.set_accessor.writable
-				           && analyzer.find_current_method () is CreationMethod) {
-					if (ma.inner.symbol_reference != analyzer.find_current_method ().this_parameter) {
+				           && context.analyzer.find_current_method () is CreationMethod) {
+					if (ma.inner.symbol_reference != context.analyzer.find_current_method ().this_parameter) {
 						// trying to set construct-only property in creation method for foreign instance
 						Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ()));
 						return false;
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index e03baf7..8058540 100644
--- a/vala/valabaseaccess.vala
+++ b/vala/valabaseaccess.vala
@@ -49,36 +49,36 @@ public class Vala.BaseAccess : Expression {
 		return true;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!analyzer.is_in_instance_method ()) {
+		if (!context.analyzer.is_in_instance_method ()) {
 			error = true;
 			Report.error (source_reference, "Base access invalid outside of instance methods");
 			return false;
 		}
 
-		if (analyzer.current_class == null) {
-			if (analyzer.current_struct == null) {
+		if (context.analyzer.current_class == null) {
+			if (context.analyzer.current_struct == null) {
 				error = true;
 				Report.error (source_reference, "Base access invalid outside of class and struct");
 				return false;
-			} else if (analyzer.current_struct.base_type == null) {
+			} else if (context.analyzer.current_struct.base_type == null) {
 				error = true;
 				Report.error (source_reference, "Base access invalid without base type");
 				return false;
 			}
-			value_type = analyzer.current_struct.base_type;
-		} else if (analyzer.current_class.base_class == null) {
+			value_type = context.analyzer.current_struct.base_type;
+		} else if (context.analyzer.current_class.base_class == null) {
 			error = true;
 			Report.error (source_reference, "Base access invalid without base class");
 			return false;
 		} else {
-			foreach (var base_type in analyzer.current_class.get_base_types ()) {
+			foreach (var base_type in context.analyzer.current_class.get_base_types ()) {
 				if (base_type.data_type is Class) {
 					value_type = base_type.copy ();
 					value_type.value_owned = false;
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 307d79d..9c7aedc 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -141,7 +141,7 @@ public class Vala.BinaryExpression : Expression {
 		return left.is_non_null () && right.is_non_null ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -150,14 +150,14 @@ public class Vala.BinaryExpression : Expression {
 
 		// some expressions are not in a block,
 		// for example, expressions in method contracts
-		if (analyzer.current_symbol is Block
+		if (context.analyzer.current_symbol is Block
 		    && (operator == BinaryOperator.AND || operator == BinaryOperator.OR)) {
 			// convert conditional expression into if statement
 			// required for flow analysis and exception handling
 
-			var local = new LocalVariable (analyzer.bool_type.copy (), get_temp_name (), null, source_reference);
+			var local = new LocalVariable (context.analyzer.bool_type.copy (), get_temp_name (), null, source_reference);
 			var decl = new DeclarationStatement (local, source_reference);
-			decl.check (analyzer);
+			decl.check (context);
 
 			var right_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple (local.name, right.source_reference), right, AssignmentOperator.SIMPLE, right.source_reference), right.source_reference);
 
@@ -176,17 +176,17 @@ public class Vala.BinaryExpression : Expression {
 
 			var if_stmt = new IfStatement (left, true_block, false_block, source_reference);
 
-			insert_statement (analyzer.insert_block, decl);
-			insert_statement (analyzer.insert_block, if_stmt);
+			insert_statement (context.analyzer.insert_block, decl);
+			insert_statement (context.analyzer.insert_block, if_stmt);
 
-			if (!if_stmt.check (analyzer)) {
+			if (!if_stmt.check (context)) {
 				error = true;
 				return false;
 			}
 
 			var ma = new MemberAccess.simple (local.name, source_reference);
 			ma.target_type = target_type;
-			ma.check (analyzer);
+			ma.check (context);
 
 			parent_node.replace_expression (this, ma);
 
@@ -196,7 +196,7 @@ public class Vala.BinaryExpression : Expression {
 		if (operator == BinaryOperator.COALESCE) {
 			var local = new LocalVariable (null, get_temp_name (), left, source_reference);
 			var decl = new DeclarationStatement (local, source_reference);
-			decl.check (analyzer);
+			decl.check (context);
 
 			var right_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple (local.name, right.source_reference), right, AssignmentOperator.SIMPLE, right.source_reference), right.source_reference);
 
@@ -208,24 +208,24 @@ public class Vala.BinaryExpression : Expression {
 
 			var if_stmt = new IfStatement (cond, true_block, null, source_reference);
 
-			insert_statement (analyzer.insert_block, decl);
-			insert_statement (analyzer.insert_block, if_stmt);
+			insert_statement (context.analyzer.insert_block, decl);
+			insert_statement (context.analyzer.insert_block, if_stmt);
 
-			if (!if_stmt.check (analyzer)) {
+			if (!if_stmt.check (context)) {
 				error = true;
 				return false;
 			}
 
 			var ma = new MemberAccess.simple (local.name, source_reference);
 			ma.target_type = target_type;
-			ma.check (analyzer);
+			ma.check (context);
 
 			parent_node.replace_expression (this, ma);
 
 			return true;
 		}
 
-		if (!left.check (analyzer) || !right.check (analyzer)) {
+		if (!left.check (context) || !right.check (context)) {
 			/* if there were any errors in inner expressions, skip type check */
 			error = true;
 			return false;
@@ -243,31 +243,31 @@ public class Vala.BinaryExpression : Expression {
 			return false;
 		}
 
-		if (left.value_type.data_type == analyzer.string_type.data_type
+		if (left.value_type.data_type == context.analyzer.string_type.data_type
 		    && operator == BinaryOperator.PLUS) {
 			// string concatenation
 
-			if (analyzer.context.profile == Profile.DOVA) {
+			if (context.profile == Profile.DOVA) {
 				var concat_call = new MethodCall (new MemberAccess (left, "concat", source_reference), source_reference);
 				concat_call.add_argument (right);
 				concat_call.target_type = target_type;
 				parent_node.replace_expression (this, concat_call);
-				return concat_call.check (analyzer);
+				return concat_call.check (context);
 			}
 
-			if (right.value_type == null || right.value_type.data_type != analyzer.string_type.data_type) {
+			if (right.value_type == null || right.value_type.data_type != context.analyzer.string_type.data_type) {
 				error = true;
 				Report.error (source_reference, "Operands must be strings");
 				return false;
 			}
 
-			value_type = analyzer.string_type.copy ();
+			value_type = context.analyzer.string_type.copy ();
 			if (left.is_constant () && right.is_constant ()) {
 				value_type.value_owned = false;
 			} else {
 				value_type.value_owned = true;
 			}
-		} else if (analyzer.context.profile == Profile.DOVA && left.value_type.data_type == analyzer.list_type.data_type
+		} else if (context.profile == Profile.DOVA && left.value_type.data_type == context.analyzer.list_type.data_type
 		    && operator == BinaryOperator.PLUS) {
 			// list concatenation
 
@@ -275,8 +275,8 @@ public class Vala.BinaryExpression : Expression {
 			concat_call.add_argument (right);
 			concat_call.target_type = target_type;
 			parent_node.replace_expression (this, concat_call);
-			return concat_call.check (analyzer);
-		} else if (analyzer.context.profile != Profile.DOVA && left.value_type is ArrayType && operator == BinaryOperator.PLUS) {
+			return concat_call.check (context);
+		} else if (context.profile != Profile.DOVA && left.value_type is ArrayType && operator == BinaryOperator.PLUS) {
 			// array concatenation
 
 			var array_type = (ArrayType) left.value_type;
@@ -313,16 +313,16 @@ public class Vala.BinaryExpression : Expression {
 					}
 				} else if (right.value_type is PointerType) {
 					// pointer arithmetic: pointer - pointer
-					if (analyzer.context.profile == Profile.DOVA) {
-						value_type = analyzer.long_type;
+					if (context.profile == Profile.DOVA) {
+						value_type = context.analyzer.long_type;
 					} else {
-						value_type = analyzer.size_t_type;
+						value_type = context.analyzer.size_t_type;
 					}
 				}
 			}
 
 			if (value_type == null) {
-				value_type = analyzer.get_arithmetic_result_type (left.value_type, right.value_type);
+				value_type = context.analyzer.get_arithmetic_result_type (left.value_type, right.value_type);
 			}
 
 			if (value_type == null) {
@@ -334,7 +334,7 @@ public class Vala.BinaryExpression : Expression {
 			   || operator == BinaryOperator.SHIFT_LEFT
 			   || operator == BinaryOperator.SHIFT_RIGHT
 			   || operator == BinaryOperator.BITWISE_XOR) {
-			value_type = analyzer.get_arithmetic_result_type (left.value_type, right.value_type);
+			value_type = context.analyzer.get_arithmetic_result_type (left.value_type, right.value_type);
 
 			if (value_type == null) {
 				error = true;
@@ -345,8 +345,8 @@ public class Vala.BinaryExpression : Expression {
 			   || operator == BinaryOperator.GREATER_THAN
 			   || operator == BinaryOperator.LESS_THAN_OR_EQUAL
 			   || operator == BinaryOperator.GREATER_THAN_OR_EQUAL) {
-			if (left.value_type.compatible (analyzer.string_type)
-			    && right.value_type.compatible (analyzer.string_type)) {
+			if (left.value_type.compatible (context.analyzer.string_type)
+			    && right.value_type.compatible (context.analyzer.string_type)) {
 				// string comparison
 				} else if (left.value_type is PointerType && right.value_type is PointerType) {
 					// pointer arithmetic
@@ -355,9 +355,9 @@ public class Vala.BinaryExpression : Expression {
 
 				if (chained) {
 					var lbe = (BinaryExpression) left;
-					resulting_type = analyzer.get_arithmetic_result_type (lbe.right.value_type, right.value_type);
+					resulting_type = context.analyzer.get_arithmetic_result_type (lbe.right.value_type, right.value_type);
 				} else {
-					resulting_type = analyzer.get_arithmetic_result_type (left.value_type, right.value_type);
+					resulting_type = context.analyzer.get_arithmetic_result_type (left.value_type, right.value_type);
 				}
 
 				if (resulting_type == null) {
@@ -374,7 +374,7 @@ public class Vala.BinaryExpression : Expression {
 				right.target_type.value_owned = false;
 			}
 
-			value_type = analyzer.bool_type;
+			value_type = context.analyzer.bool_type;
 		} else if (operator == BinaryOperator.EQUALITY
 			   || operator == BinaryOperator.INEQUALITY) {
 			/* relational operation */
@@ -400,10 +400,10 @@ public class Vala.BinaryExpression : Expression {
 				}
 			}
 
-			if (left.value_type.compatible (analyzer.string_type)
-			    && right.value_type.compatible (analyzer.string_type)) {
+			if (left.value_type.compatible (context.analyzer.string_type)
+			    && right.value_type.compatible (context.analyzer.string_type)) {
 				// string comparison
-				if (analyzer.context.profile == Profile.DOVA) {
+				if (context.profile == Profile.DOVA) {
 					var string_ma = new MemberAccess.simple ("string", source_reference);
 					string_ma.qualified = true;
 					var equals_call = new MethodCall (new MemberAccess (string_ma, "equals", source_reference), source_reference);
@@ -411,16 +411,16 @@ public class Vala.BinaryExpression : Expression {
 					equals_call.add_argument (right);
 					if (operator == BinaryOperator.EQUALITY) {
 						parent_node.replace_expression (this, equals_call);
-						return equals_call.check (analyzer);
+						return equals_call.check (context);
 					} else {
 						var not = new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, equals_call, source_reference);
 						parent_node.replace_expression (this, not);
-						return not.check (analyzer);
+						return not.check (context);
 					}
 				}
 			}
 
-			value_type = analyzer.bool_type;
+			value_type = context.analyzer.bool_type;
 		} else if (operator == BinaryOperator.BITWISE_AND
 			   || operator == BinaryOperator.BITWISE_OR) {
 			// integer type or flags type
@@ -428,15 +428,15 @@ public class Vala.BinaryExpression : Expression {
 			value_type = left.value_type;
 		} else if (operator == BinaryOperator.AND
 			   || operator == BinaryOperator.OR) {
-			if (!left.value_type.compatible (analyzer.bool_type) || !right.value_type.compatible (analyzer.bool_type)) {
+			if (!left.value_type.compatible (context.analyzer.bool_type) || !right.value_type.compatible (context.analyzer.bool_type)) {
 				error = true;
 				Report.error (source_reference, "Operands must be boolean");
 			}
 
-			value_type = analyzer.bool_type;
+			value_type = context.analyzer.bool_type;
 		} else if (operator == BinaryOperator.IN) {
-			if (left.value_type.compatible (analyzer.int_type)
-			    && right.value_type.compatible (analyzer.int_type)) {
+			if (left.value_type.compatible (context.analyzer.int_type)
+			    && right.value_type.compatible (context.analyzer.int_type)) {
 				// integers or enums
 			} else if (right.value_type is ArrayType) {
 				if (!left.value_type.compatible (((ArrayType) right.value_type).element_type)) {
@@ -455,7 +455,7 @@ public class Vala.BinaryExpression : Expression {
 					error = true;
 					return false;
 				}
-				if (!contains_method.return_type.compatible (analyzer.bool_type)) {
+				if (!contains_method.return_type.compatible (context.analyzer.bool_type)) {
 					Report.error (source_reference, "`%s' must return a boolean value".printf (contains_method.get_full_name ()));
 					error = true;
 					return false;
@@ -464,10 +464,10 @@ public class Vala.BinaryExpression : Expression {
 				var contains_call = new MethodCall (new MemberAccess (right, "contains"));
 				contains_call.add_argument (left);
 				parent_node.replace_expression (this, contains_call);
-				return contains_call.check (analyzer);
+				return contains_call.check (context);
 			}
 			
-			value_type = analyzer.bool_type;
+			value_type = context.analyzer.bool_type;
 			
 		} else {
 			assert_not_reached ();
diff --git a/vala/valablock.vala b/vala/valablock.vala
index c5b044d..de8a62a 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -135,22 +135,22 @@ public class Vala.Block : Symbol, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		owner = analyzer.current_symbol.scope;
+		owner = context.analyzer.current_symbol.scope;
 
-		var old_symbol = analyzer.current_symbol;
-		var old_insert_block = analyzer.insert_block;
-		analyzer.current_symbol = this;
-		analyzer.insert_block = this;
+		var old_symbol = context.analyzer.current_symbol;
+		var old_insert_block = context.analyzer.insert_block;
+		context.analyzer.current_symbol = this;
+		context.analyzer.insert_block = this;
 
 		for (int i = 0; i < statement_list.size; i++) {
-			statement_list[i].check (analyzer);
+			statement_list[i].check (context);
 		}
 
 		foreach (LocalVariable local in get_local_variables ()) {
@@ -166,8 +166,8 @@ public class Vala.Block : Symbol, Statement {
 			add_error_types (stmt.get_error_types ());
 		}
 
-		analyzer.current_symbol = old_symbol;
-		analyzer.insert_block = old_insert_block;
+		context.analyzer.current_symbol = old_symbol;
+		context.analyzer.insert_block = old_insert_block;
 
 		return !error;
 	}
diff --git a/vala/valabooleanliteral.vala b/vala/valabooleanliteral.vala
index e027944..1a1aee8 100644
--- a/vala/valabooleanliteral.vala
+++ b/vala/valabooleanliteral.vala
@@ -61,14 +61,14 @@ public class Vala.BooleanLiteral : Literal {
 		return true;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		value_type = analyzer.bool_type;
+		value_type = context.analyzer.bool_type;
 
 		return !error;
 	}
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 7018992..1b58b25 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -109,14 +109,14 @@ public class Vala.CastExpression : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!inner.check (analyzer)) {
+		if (!inner.check (context)) {
 			error = true;
 			return false;
 		}
@@ -133,7 +133,7 @@ public class Vala.CastExpression : Expression {
 			type_reference.nullable = false;
 		}
 
-		type_reference.check (analyzer);
+		type_reference.check (context);
 
 		// FIXME: check whether cast is allowed
 
diff --git a/vala/valacatchclause.vala b/vala/valacatchclause.vala
index b6d742e..72c9d84 100644
--- a/vala/valacatchclause.vala
+++ b/vala/valacatchclause.vala
@@ -109,7 +109,7 @@ public class Vala.CatchClause : CodeNode {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -125,16 +125,16 @@ public class Vala.CatchClause : CodeNode {
 			error_variable.checked = true;
 		} else {
 			// generic catch clause
-			if (analyzer.context.profile == Profile.GOBJECT) {
+			if (context.profile == Profile.GOBJECT) {
 				error_type = new ErrorType (null, null, source_reference);
 			} else {
-				error_type = analyzer.error_type;
+				error_type = context.analyzer.error_type;
 			}
 		}
 
-		error_type.check (analyzer);
+		error_type.check (context);
 
-		body.check (analyzer);
+		body.check (context);
 
 		return !error;
 	}
diff --git a/vala/valacharacterliteral.vala b/vala/valacharacterliteral.vala
index 91a3028..d38a0e6 100644
--- a/vala/valacharacterliteral.vala
+++ b/vala/valacharacterliteral.vala
@@ -83,20 +83,20 @@ public class Vala.CharacterLiteral : Literal {
 		return value;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (analyzer.context.profile == Profile.DOVA) {
-			value_type = new IntegerType ((Struct) analyzer.root_symbol.scope.lookup ("char"), get_char ().to_string (), "int");
+		if (context.profile == Profile.DOVA) {
+			value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("char"), get_char ().to_string (), "int");
 		} else {
 			if (get_char () < 128) {
-				value_type = new IntegerType ((Struct) analyzer.root_symbol.scope.lookup ("char"));
+				value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("char"));
 			} else {
-				value_type = new IntegerType ((Struct) analyzer.root_symbol.scope.lookup ("unichar"));
+				value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("unichar"));
 			}
 		}
 
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index ffb2265..0ba8032 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -995,7 +995,7 @@ public class Vala.Class : ObjectTypeSymbol {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -1004,16 +1004,16 @@ public class Vala.Class : ObjectTypeSymbol {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		foreach (DataType base_type_reference in get_base_types ()) {
-			if (!base_type_reference.check (analyzer)) {
+			if (!base_type_reference.check (context)) {
 				error = true;
 				return false;
 			}
@@ -1025,7 +1025,7 @@ public class Vala.Class : ObjectTypeSymbol {
 			}
 
 			// check whether base type is at least as accessible as the class
-			if (!analyzer.is_type_accessible (this, base_type_reference)) {
+			if (!context.analyzer.is_type_accessible (this, base_type_reference)) {
 				error = true;
 				Report.error (source_reference, "base type `%s` is less accessible than class `%s`".printf (base_type_reference.to_string (), get_full_name ()));
 				return false;
@@ -1045,72 +1045,72 @@ public class Vala.Class : ObjectTypeSymbol {
 		}
 
 		foreach (DataType type in base_types) {
-			type.check (analyzer);
+			type.check (context);
 		}
 
 		foreach (TypeParameter p in get_type_parameters ()) {
-			p.check (analyzer);
+			p.check (context);
 		}
 
 		/* process enums first to avoid order problems in C code */
 		foreach (Enum en in enums) {
-			en.check (analyzer);
+			en.check (context);
 		}
 
 		foreach (Field f in fields) {
-			f.check (analyzer);
+			f.check (context);
 		}
 		
 		foreach (Constant c in constants) {
-			c.check (analyzer);
+			c.check (context);
 		}
 		
 		foreach (Method m in methods) {
-			m.check (analyzer);
+			m.check (context);
 		}
 		
 		foreach (Property prop in properties) {
-			prop.check (analyzer);
+			prop.check (context);
 		}
 		
 		foreach (Signal sig in signals) {
-			sig.check (analyzer);
+			sig.check (context);
 		}
 		
 		if (constructor != null) {
-			constructor.check (analyzer);
+			constructor.check (context);
 		}
 
 		if (class_constructor != null) {
-			class_constructor.check (analyzer);
+			class_constructor.check (context);
 		}
 
 		if (static_constructor != null) {
-			static_constructor.check (analyzer);
+			static_constructor.check (context);
 		}
 
 		if (destructor != null) {
-			destructor.check (analyzer);
+			destructor.check (context);
 		}
 
 		if (static_destructor != null) {
-			static_destructor.check (analyzer);
+			static_destructor.check (context);
 		}
 		
 		if (class_destructor != null) {
-			class_destructor.check (analyzer);
+			class_destructor.check (context);
 		}
 		
 		foreach (Class cl in classes) {
-			cl.check (analyzer);
+			cl.check (context);
 		}
 		
 		foreach (Struct st in structs) {
-			st.check (analyzer);
+			st.check (context);
 		}
 
 		foreach (Delegate d in delegates) {
-			d.check (analyzer);
+			d.check (context);
 		}
 
 		/* compact classes cannot implement interfaces */
@@ -1229,7 +1229,7 @@ public class Vala.Class : ObjectTypeSymbol {
 				while (base_class != null && base_class.is_abstract) {
 					foreach (Method base_method in base_class.get_methods ()) {
 						if (base_method.is_abstract) {
-							var override_method = analyzer.symbol_lookup_inherited (this, base_method.name) as Method;
+							var override_method = context.analyzer.symbol_lookup_inherited (this, base_method.name) as Method;
 							if (override_method == null || !override_method.overrides) {
 								error = true;
 								Report.error (source_reference, "`%s' does not implement abstract method `%s'".printf (get_full_name (), base_method.get_full_name ()));
@@ -1238,7 +1238,7 @@ public class Vala.Class : ObjectTypeSymbol {
 					}
 					foreach (Property base_property in base_class.get_properties ()) {
 						if (base_property.is_abstract) {
-							var override_property = analyzer.symbol_lookup_inherited (this, base_property.name) as Property;
+							var override_property = context.analyzer.symbol_lookup_inherited (this, base_property.name) as Property;
 							if (override_property == null || !override_property.overrides) {
 								error = true;
 								Report.error (source_reference, "`%s' does not implement abstract property `%s'".printf (get_full_name (), base_property.get_full_name ()));
@@ -1250,8 +1250,8 @@ public class Vala.Class : ObjectTypeSymbol {
 			}
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valacodenode.vala b/vala/valacodenode.vala
index 62508c7..b1fc30e 100644
--- a/vala/valacodenode.vala
+++ b/vala/valacodenode.vala
@@ -121,7 +121,7 @@ public abstract class Vala.CodeNode {
 	public virtual void accept_children (CodeVisitor visitor) {
 	}
 
-	public virtual bool check (SemanticAnalyzer analyzer) {
+	public virtual bool check (CodeContext context) {
 		return true;
 	}
 
diff --git a/vala/valaconditionalexpression.vala b/vala/valaconditionalexpression.vala
index 25c3e27..c5fdfd6 100644
--- a/vala/valaconditionalexpression.vala
+++ b/vala/valaconditionalexpression.vala
@@ -100,14 +100,14 @@ public class Vala.ConditionalExpression : Expression {
 		return condition.is_pure () && true_expression.is_pure () && false_expression.is_pure ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!(analyzer.current_symbol is Block)) {
+		if (!(context.analyzer.current_symbol is Block)) {
 			Report.error (source_reference, "Conditional expressions may only be used in blocks");
 			error = true;
 			return false;
@@ -136,10 +136,10 @@ public class Vala.ConditionalExpression : Expression {
 
 		var if_stmt = new IfStatement (condition, true_block, false_block, source_reference);
 
-		insert_statement (analyzer.insert_block, decl);
-		insert_statement (analyzer.insert_block, if_stmt);
+		insert_statement (context.analyzer.insert_block, decl);
+		insert_statement (context.analyzer.insert_block, if_stmt);
 
-		if (!if_stmt.check (analyzer) || true_expression.error || false_expression.error) {
+		if (!if_stmt.check (context) || true_expression.error || false_expression.error) {
 			error = true;
 			return false;
 		}
@@ -163,23 +163,23 @@ public class Vala.ConditionalExpression : Expression {
 		value_type.value_owned = (true_expression.value_type.value_owned || false_expression.value_type.value_owned);
 
 		local.variable_type = value_type;
-		decl.check (analyzer);
+		decl.check (context);
 
 		true_expression.target_type = value_type;
 		false_expression.target_type = value_type;
 
 		var true_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple (local.name, true_expression.source_reference), true_expression, AssignmentOperator.SIMPLE, true_expression.source_reference), true_expression.source_reference);
-		true_stmt.check (analyzer);
+		true_stmt.check (context);
 
 		var false_stmt = new ExpressionStatement (new Assignment (new MemberAccess.simple (local.name, false_expression.source_reference), false_expression, AssignmentOperator.SIMPLE, false_expression.source_reference), false_expression.source_reference);
-		false_stmt.check (analyzer);
+		false_stmt.check (context);
 
 		true_block.replace_statement (true_decl, true_stmt);
 		false_block.replace_statement (false_decl, false_stmt);
 
 		var ma = new MemberAccess.simple (local.name, source_reference);
 		ma.target_type = target_type;
-		ma.check (analyzer);
+		ma.check (context);
 
 		parent_node.replace_expression (this, ma);
 
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 9860c3a..974fee4 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -163,7 +163,7 @@ public class Vala.Constant : Symbol, Lockable {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -172,17 +172,17 @@ public class Vala.Constant : Symbol, Lockable {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
-		type_reference.check (analyzer);
+		type_reference.check (context);
 
-		if (!check_const_type (type_reference, analyzer)) {
+		if (!check_const_type (type_reference, context)) {
 			error = true;
 			Report.error (source_reference, "`%s' not supported as type for constants".printf (type_reference.to_string ()));
 			return false;
@@ -195,7 +195,7 @@ public class Vala.Constant : Symbol, Lockable {
 			} else {
 				value.target_type = type_reference;
 
-				value.check (analyzer);
+				value.check (context);
 
 				if (!value.value_type.compatible (type_reference)) {
 					error = true;
@@ -214,21 +214,21 @@ public class Vala.Constant : Symbol, Lockable {
 			Report.warning (source_reference, "%s hides inherited constant `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ()));
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		active = true;
 
 		return !error;
 	}
 
-	bool check_const_type (DataType type, SemanticAnalyzer analyzer) {
+	bool check_const_type (DataType type, CodeContext context) {
 		if (type is ValueType) {
 			return true;
 		} else if (type is ArrayType) {
 			var array_type = type as ArrayType;
-			return check_const_type (array_type.element_type, analyzer);
-		} else if (type.data_type == analyzer.string_type.data_type) {
+			return check_const_type (array_type.element_type, context);
+		} else if (type.data_type == context.analyzer.string_type.data_type) {
 			return true;
 		} else {
 			return false;
diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala
index b3d88a6..05a8671 100644
--- a/vala/valaconstructor.vala
+++ b/vala/valaconstructor.vala
@@ -61,21 +61,21 @@ public class Vala.Constructor : Symbol {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		this_parameter = new Parameter ("this", new ObjectType (analyzer.current_class));
+		this_parameter = new Parameter ("this", new ObjectType (context.analyzer.current_class));
 		scope.add (this_parameter.name, this_parameter);
 
-		owner = analyzer.current_symbol.scope;
-		analyzer.current_symbol = this;
+		owner = context.analyzer.current_symbol.scope;
+		context.analyzer.current_symbol = this;
 
 		if (body != null) {
-			body.check (analyzer);
+			body.check (context);
 		}
 
 		foreach (DataType body_error_type in body.get_error_types ()) {
@@ -84,7 +84,7 @@ public class Vala.Constructor : Symbol {
 			}
 		}
 
-		analyzer.current_symbol = analyzer.current_symbol.parent_symbol;
+		context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
 
 		return !error;
 	}
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 22c243d..7958ec6 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -143,7 +143,7 @@ public class Vala.CreationMethod : Method {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -154,78 +154,78 @@ public class Vala.CreationMethod : Method {
 
 		if (class_name != null && class_name != parent_symbol.name) {
 			// class_name is null for constructors generated by GIdlParser
-			Report.error (source_reference, "missing return type in method `%s.%s´".printf (analyzer.current_symbol.get_full_name (), class_name));
+			Report.error (source_reference, "missing return type in method `%s.%s´".printf (context.analyzer.current_symbol.get_full_name (), class_name));
 			error = true;
 			return false;
 		}
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		foreach (Parameter param in get_parameters()) {
-			param.check (analyzer);
+			param.check (context);
 		}
 
 		foreach (DataType error_type in get_error_types ()) {
-			error_type.check (analyzer);
+			error_type.check (context);
 		}
 
 		foreach (Expression precondition in get_preconditions ()) {
-			precondition.check (analyzer);
+			precondition.check (context);
 		}
 
 		foreach (Expression postcondition in get_postconditions ()) {
-			postcondition.check (analyzer);
+			postcondition.check (context);
 		}
 
 		if (body != null) {
-			body.check (analyzer);
+			body.check (context);
 
 			var cl = parent_symbol as Class;
 
 			// ensure we chain up to base constructor
 			if (!chain_up && cl != null && cl.base_class != null) {
-				if (analyzer.context.profile == Profile.GOBJECT
+				if (context.profile == Profile.GOBJECT
 				    && cl.base_class.default_construction_method != null
 				    && !cl.base_class.default_construction_method.has_construct_function) {
 					// directly chain up to Object
-					var old_insert_block = analyzer.insert_block;
-					analyzer.current_symbol = body;
-					analyzer.insert_block = body;
+					var old_insert_block = context.analyzer.insert_block;
+					context.analyzer.current_symbol = body;
+					context.analyzer.insert_block = body;
 
 					var stmt = new ExpressionStatement (new MethodCall (new MemberAccess (new MemberAccess.simple ("GLib", source_reference), "Object", source_reference), source_reference), source_reference);
 					body.insert_statement (0, stmt);
-					stmt.check (analyzer);
+					stmt.check (context);
 
-					analyzer.current_symbol = this;
-					analyzer.insert_block = old_insert_block;
+					context.analyzer.current_symbol = this;
+					context.analyzer.insert_block = old_insert_block;
 				} else if (cl.base_class.default_construction_method == null
 				    || cl.base_class.default_construction_method.access == SymbolAccessibility.PRIVATE) {
 					Report.error (source_reference, "unable to chain up to private base constructor");
 				} else if (cl.base_class.default_construction_method.get_required_arguments () > 0) {
 					Report.error (source_reference, "unable to chain up to base constructor requiring arguments");
 				} else {
-					var old_insert_block = analyzer.insert_block;
-					analyzer.current_symbol = body;
-					analyzer.insert_block = body;
+					var old_insert_block = context.analyzer.insert_block;
+					context.analyzer.current_symbol = body;
+					context.analyzer.insert_block = body;
 
 					var stmt = new ExpressionStatement (new MethodCall (new BaseAccess (source_reference), source_reference), source_reference);
 					body.insert_statement (0, stmt);
-					stmt.check (analyzer);
+					stmt.check (context);
 
-					analyzer.current_symbol = this;
-					analyzer.insert_block = old_insert_block;
+					context.analyzer.current_symbol = this;
+					context.analyzer.insert_block = old_insert_block;
 				}
 			}
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		if (is_abstract || is_virtual || overrides) {
 			Report.error (source_reference, "The creation method `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ()));
diff --git a/vala/valadeclarationstatement.vala b/vala/valadeclarationstatement.vala
index 51d80fc..9eb8fff 100644
--- a/vala/valadeclarationstatement.vala
+++ b/vala/valadeclarationstatement.vala
@@ -62,14 +62,14 @@ public class Vala.DeclarationStatement : CodeNode, Statement {
 		declaration.accept (visitor);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		declaration.check (analyzer);
+		declaration.check (context);
 
 		var local = declaration as LocalVariable;
 		if (local != null && local.initializer != null) {
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 82ddc68..00d9b39 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -384,7 +384,7 @@ public class Vala.Delegate : TypeSymbol {
 		return str;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -393,27 +393,27 @@ public class Vala.Delegate : TypeSymbol {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
+		var old_source_file = context.analyzer.current_source_file;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
 
 		foreach (TypeParameter p in type_parameters) {
-			p.check (analyzer);
+			p.check (context);
 		}
 		
-		return_type.check (analyzer);
+		return_type.check (context);
 		
 		foreach (Parameter param in parameters) {
-			param.check (analyzer);
+			param.check (context);
 		}
 
 		foreach (DataType error_type in get_error_types ()) {
-			error_type.check (analyzer);
+			error_type.check (context);
 		}
 
-		analyzer.current_source_file = old_source_file;
+		context.analyzer.current_source_file = old_source_file;
 
 		return !error;
 	}
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index a355d79..c5f2ec8 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -101,8 +101,8 @@ public class Vala.DelegateType : DataType {
 		return "G_TYPE_POINTER";
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
-		return delegate_symbol.check (analyzer);
+	public override bool check (CodeContext context) {
+		return delegate_symbol.check (context);
 	}
 
 	public override bool is_disposable () {
diff --git a/vala/valadeletestatement.vala b/vala/valadeletestatement.vala
index ce76bfd..bb8da39 100644
--- a/vala/valadeletestatement.vala
+++ b/vala/valadeletestatement.vala
@@ -42,14 +42,14 @@ public class Vala.DeleteStatement : CodeNode, Statement {
 		expression.accept (visitor);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!expression.check (analyzer)) {
+		if (!expression.check (context)) {
 			// if there was an error in the inner expression, skip this check
 			return false;
 		}
diff --git a/vala/valadestructor.vala b/vala/valadestructor.vala
index 0ab2a74..79b93b5 100644
--- a/vala/valadestructor.vala
+++ b/vala/valadestructor.vala
@@ -61,21 +61,21 @@ public class Vala.Destructor : Symbol {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		owner = analyzer.current_symbol.scope;
-		analyzer.current_symbol = this;
+		owner = context.analyzer.current_symbol.scope;
+		context.analyzer.current_symbol = this;
 
 		if (body != null) {
-			body.check (analyzer);
+			body.check (context);
 		}
 
-		analyzer.current_symbol = analyzer.current_symbol.parent_symbol;
+		context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
 
 		return !error;
 	}
diff --git a/vala/valadostatement.vala b/vala/valadostatement.vala
index fa64f1f..6bf72c0 100644
--- a/vala/valadostatement.vala
+++ b/vala/valadostatement.vala
@@ -86,7 +86,7 @@ public class Vala.DoStatement : CodeNode, Statement {
 		return (literal != null && literal.value);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		// convert to simple loop
 
 		// do not generate variable and if block if condition is always true
@@ -96,12 +96,12 @@ public class Vala.DoStatement : CodeNode, Statement {
 			var parent_block = (Block) parent_node;
 			parent_block.replace_statement (this, loop);
 
-			return loop.check (analyzer);
+			return loop.check (context);
 		}
 
 		var block = new Block (source_reference);
 
-		var first_local = new LocalVariable (analyzer.bool_type.copy (), get_temp_name (), new BooleanLiteral (true, source_reference), source_reference);
+		var first_local = new LocalVariable (context.analyzer.bool_type.copy (), get_temp_name (), new BooleanLiteral (true, source_reference), source_reference);
 		block.add_statement (new DeclarationStatement (first_local, source_reference));
 
 		var if_condition = new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, condition, condition.source_reference);
@@ -121,6 +121,6 @@ public class Vala.DoStatement : CodeNode, Statement {
 		var parent_block = (Block) parent_node;
 		parent_block.replace_statement (this, block);
 
-		return block.check (analyzer);
+		return block.check (context);
 	}
 }
diff --git a/vala/valadynamicmethod.vala b/vala/valadynamicmethod.vala
index 361d4b2..3fc98f6 100644
--- a/vala/valadynamicmethod.vala
+++ b/vala/valadynamicmethod.vala
@@ -50,7 +50,7 @@ public class Vala.DynamicMethod : Method {
 		return cname;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		return true;
 	}
 }
diff --git a/vala/valadynamicproperty.vala b/vala/valadynamicproperty.vala
index 7155965..dc9acb5 100644
--- a/vala/valadynamicproperty.vala
+++ b/vala/valadynamicproperty.vala
@@ -37,7 +37,7 @@ public class Vala.DynamicProperty : Property {
 		return new ArrayList<string> ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		return true;
 	}
 }
diff --git a/vala/valadynamicsignal.vala b/vala/valadynamicsignal.vala
index dc1757e..c3cae8b 100644
--- a/vala/valadynamicsignal.vala
+++ b/vala/valadynamicsignal.vala
@@ -35,7 +35,7 @@ public class Vala.DynamicSignal : Signal {
 		this.dynamic_type = dynamic_type;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		return true;
 	}
 }
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index 1b60c6b..96ae508 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -96,14 +96,14 @@ public class Vala.ElementAccess : Expression {
 		return container.is_pure ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!container.check (analyzer)) {
+		if (!container.check (context)) {
 			/* don't proceed if a child expression failed */
 			error = true;
 			return false;
@@ -124,11 +124,11 @@ public class Vala.ElementAccess : Expression {
 				Report.error (source_reference, "Element access with more than one dimension is not supported for signals");
 				return false;
 			}
-			get_indices ().get (0).target_type = analyzer.string_type.copy ();
+			get_indices ().get (0).target_type = context.analyzer.string_type.copy ();
 		}
 
 		foreach (Expression index in get_indices ()) {
-			index.check (analyzer);
+			index.check (context);
 		}
 
 		bool index_int_type_check = true;
@@ -144,7 +144,7 @@ public class Vala.ElementAccess : Expression {
 			}
 		} else if (pointer_type != null && !pointer_type.base_type.is_reference_type_or_type_parameter ()) {
 			value_type = pointer_type.base_type.copy ();
-		} else if (analyzer.context.profile == Profile.DOVA && container_type == analyzer.tuple_type.data_type) {
+		} else if (context.profile == Profile.DOVA && container_type == context.analyzer.tuple_type.data_type) {
 			if (get_indices ().size != 1) {
 				error = true;
 				Report.error (source_reference, "Element access with more than one dimension is not supported for tuples");
@@ -177,7 +177,7 @@ public class Vala.ElementAccess : Expression {
 			get_call.add_argument (index);
 			get_call.target_type = this.target_type;
 			parent_node.replace_expression (this, get_call);
-			return get_call.check (analyzer);
+			return get_call.check (context);
 		} else if (container is MemberAccess && container.symbol_reference is Signal) {
 			index_int_type_check = false;
 
@@ -200,7 +200,7 @@ public class Vala.ElementAccess : Expression {
 					get_call.formal_target_type = this.formal_target_type;
 					get_call.target_type = this.target_type;
 					parent_node.replace_expression (this, get_call);
-					return get_call.check (analyzer);
+					return get_call.check (context);
 				}
 			}
 
diff --git a/vala/valaenum.vala b/vala/valaenum.vala
index 170d7e2..f5fca29 100644
--- a/vala/valaenum.vala
+++ b/vala/valaenum.vala
@@ -320,7 +320,7 @@ public class Vala.Enum : TypeSymbol {
 		return "0";
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -329,28 +329,28 @@ public class Vala.Enum : TypeSymbol {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		foreach (EnumValue value in values) {
-			value.check (analyzer);
+			value.check (context);
 		}
 
 		foreach (Method m in methods) {
-			m.check (analyzer);
+			m.check (context);
 		}
 
 		foreach (Constant c in constants) {
-			c.check (analyzer);
+			c.check (context);
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valaenumvalue.vala b/vala/valaenumvalue.vala
index 973bc55..4a04b85 100644
--- a/vala/valaenumvalue.vala
+++ b/vala/valaenumvalue.vala
@@ -79,7 +79,7 @@ public class Vala.EnumValue : Constant {
 		return "%s%s".printf (en.get_cprefix (), name);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -89,7 +89,7 @@ public class Vala.EnumValue : Constant {
 		process_attributes ();
 
 		if (value != null) {
-			value.check (analyzer);
+			value.check (context);
 		}
 
 		return !error;
diff --git a/vala/valaerrorcode.vala b/vala/valaerrorcode.vala
index 24d7f60..4102fed 100644
--- a/vala/valaerrorcode.vala
+++ b/vala/valaerrorcode.vala
@@ -77,7 +77,7 @@ public class Vala.ErrorCode : TypeSymbol {
 		return get_cname ().down ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -85,7 +85,7 @@ public class Vala.ErrorCode : TypeSymbol {
 		checked = true;
 
 		if (value != null) {
-			value.check (analyzer);
+			value.check (context);
 		}
 
 		return !error;
diff --git a/vala/valaerrordomain.vala b/vala/valaerrordomain.vala
index 40274f2..a17e4f8 100644
--- a/vala/valaerrordomain.vala
+++ b/vala/valaerrordomain.vala
@@ -217,7 +217,7 @@ public class Vala.ErrorDomain : TypeSymbol {
 		return "g_value_set_pointer";
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -227,11 +227,11 @@ public class Vala.ErrorDomain : TypeSymbol {
 		process_attributes ();
 
 		foreach (ErrorCode ecode in codes) {
-			ecode.check (analyzer);
+			ecode.check (context);
 		}
 
 		foreach (Method m in methods) {
-			m.check (analyzer);
+			m.check (context);
 		}
 
 		return !error;
diff --git a/vala/valaerrortype.vala b/vala/valaerrortype.vala
index f0e9ab2..33f5e41 100644
--- a/vala/valaerrortype.vala
+++ b/vala/valaerrortype.vala
@@ -147,9 +147,9 @@ public class Vala.ErrorType : ReferenceType {
 		return true;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (error_domain != null) {
-			return error_domain.check (analyzer);
+			return error_domain.check (context);
 		}
 		return true;
 	}
diff --git a/vala/valaexpressionstatement.vala b/vala/valaexpressionstatement.vala
index c6450c0..afca377 100644
--- a/vala/valaexpressionstatement.vala
+++ b/vala/valaexpressionstatement.vala
@@ -67,14 +67,14 @@ public class Vala.ExpressionStatement : CodeNode, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!expression.check (analyzer)) {
+		if (!expression.check (context)) {
 			// ignore inner error
 			error = true;
 			return false;
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 1fae0fe..6bf4868 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -260,20 +260,20 @@ public class Vala.Field : Variable, Lockable {
 		attr.add_argument ("type", "\"%s\"".printf (ctype));
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		if (variable_type is VoidType) {
 			error = true;
@@ -281,10 +281,10 @@ public class Vala.Field : Variable, Lockable {
 			return false;
 		}
 
-		variable_type.check (analyzer);
+		variable_type.check (context);
 
 		// check whether field type is at least as accessible as the field
-		if (!analyzer.is_type_accessible (this, variable_type)) {
+		if (!context.analyzer.is_type_accessible (this, variable_type)) {
 			error = true;
 			Report.error (source_reference, "field type `%s` is less accessible than field `%s`".printf (variable_type.to_string (), get_full_name ()));
 			return false;
@@ -295,7 +295,7 @@ public class Vala.Field : Variable, Lockable {
 		if (initializer != null) {
 			initializer.target_type = variable_type;
 
-			if (!initializer.check (analyzer)) {
+			if (!initializer.check (context)) {
 				error = true;
 				return false;
 			}
@@ -337,8 +337,8 @@ public class Vala.Field : Variable, Lockable {
 			Report.warning (source_reference, "%s hides inherited field `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ()));
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 469c51e..77d4f56 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -146,7 +146,7 @@ public class Vala.ForeachStatement : Block {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -154,7 +154,7 @@ public class Vala.ForeachStatement : Block {
 		checked = true;
 
 		// analyze collection expression first, used for type inference
-		if (!collection.check (analyzer)) {
+		if (!collection.check (context)) {
 			// ignore inner error
 			error = true;
 			return false;
@@ -167,29 +167,29 @@ public class Vala.ForeachStatement : Block {
 		var collection_type = collection.value_type.copy ();
 		collection.target_type = collection_type.copy ();
 		
-		if (analyzer.context.profile != Profile.DOVA && collection_type.is_array ()) {
+		if (context.profile != Profile.DOVA && collection_type.is_array ()) {
 			var array_type = (ArrayType) collection_type;
 
 			// can't use inline-allocated array for temporary variable
 			array_type.inline_allocated = false;
 
-			return check_without_iterator (analyzer, collection_type, array_type.element_type);
-		} else if (analyzer.context.profile == Profile.GOBJECT && (collection_type.compatible (analyzer.glist_type) || collection_type.compatible (analyzer.gslist_type))) {
+			return check_without_iterator (context, collection_type, array_type.element_type);
+		} else if (context.profile == Profile.GOBJECT && (collection_type.compatible (context.analyzer.glist_type) || collection_type.compatible (context.analyzer.gslist_type))) {
 			if (collection_type.get_type_arguments ().size != 1) {
 				error = true;
 				Report.error (collection.source_reference, "missing type argument for collection");
 				return false;
 			}
 
-			return check_without_iterator (analyzer, collection_type, collection_type.get_type_arguments ().get (0));
-		} else if (analyzer.context.profile == Profile.GOBJECT && collection_type.compatible (analyzer.gvaluearray_type)) {
-			return check_without_iterator (analyzer, collection_type, analyzer.gvalue_type);
+			return check_without_iterator (context, collection_type, collection_type.get_type_arguments ().get (0));
+		} else if (context.profile == Profile.GOBJECT && collection_type.compatible (context.analyzer.gvaluearray_type)) {
+			return check_without_iterator (context, collection_type, context.analyzer.gvalue_type);
 		} else {
-			return check_with_iterator (analyzer, collection_type);
+			return check_with_iterator (context, collection_type);
 		}
 	}
 
-	bool check_with_index (SemanticAnalyzer analyzer, DataType collection_type) {
+	bool check_with_index (CodeContext context, DataType collection_type) {
 		var get_method = collection_type.get_member ("get") as Method;
 		if (get_method == null) {
 			return false;
@@ -215,13 +215,13 @@ public class Vala.ForeachStatement : Block {
 		body.insert_statement (0, new DeclarationStatement (new LocalVariable (type_reference, variable_name, get_call, source_reference), source_reference));
 
 		checked = false;
-		return base.check (analyzer);
+		return base.check (context);
 	}
 
-	bool check_with_iterator (SemanticAnalyzer analyzer, DataType collection_type) {
+	bool check_with_iterator (CodeContext context, DataType collection_type) {
 		use_iterator = true;
 
-		if (check_with_index (analyzer, collection_type)) {
+		if (check_with_index (context, collection_type)) {
 			return true;
 		}
 
@@ -278,7 +278,7 @@ public class Vala.ForeachStatement : Block {
 				error = true;
 				return false;
 			}
-			if (!next_method.return_type.compatible (analyzer.bool_type)) {
+			if (!next_method.return_type.compatible (context.analyzer.bool_type)) {
 				Report.error (collection.source_reference, "`%s' must return a boolean value".printf (next_method.get_full_name ()));
 				error = true;
 				return false;
@@ -318,7 +318,7 @@ public class Vala.ForeachStatement : Block {
 		}
 
 		checked = false;
-		return base.check (analyzer);
+		return base.check (context);
 	}
 
 	bool analyze_element_type (DataType element_type) {
@@ -339,7 +339,7 @@ public class Vala.ForeachStatement : Block {
 		return true;
 	}
 
-	bool check_without_iterator (SemanticAnalyzer analyzer, DataType collection_type, DataType element_type) {
+	bool check_without_iterator (CodeContext context, DataType collection_type, DataType element_type) {
 		// analyze element type
 		if (type_reference == null) {
 			// var type
@@ -359,16 +359,16 @@ public class Vala.ForeachStatement : Block {
 		element_variable.checked = true;
 
 		// analyze body
-		owner = analyzer.current_symbol.scope;
-		analyzer.current_symbol = this;
+		owner = context.analyzer.current_symbol.scope;
+		context.analyzer.current_symbol = this;
 
-		body.check (analyzer);
+		body.check (context);
 
 		foreach (LocalVariable local in get_local_variables ()) {
 			local.active = false;
 		}
 
-		analyzer.current_symbol = analyzer.current_symbol.parent_symbol;
+		context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
 
 		collection_variable = new LocalVariable (collection_type, "%s_collection".printf (variable_name));
 
diff --git a/vala/valaforstatement.vala b/vala/valaforstatement.vala
index 6e8be3d..555dc62 100644
--- a/vala/valaforstatement.vala
+++ b/vala/valaforstatement.vala
@@ -146,7 +146,7 @@ public class Vala.ForStatement : CodeNode, Statement {
 		return (literal != null && !literal.value);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		// convert to simple loop
 
 		var block = new Block (source_reference);
@@ -171,7 +171,7 @@ public class Vala.ForStatement : CodeNode, Statement {
 		}
 
 		// iterator
-		var first_local = new LocalVariable (analyzer.bool_type.copy (), get_temp_name (), new BooleanLiteral (true, source_reference), source_reference);
+		var first_local = new LocalVariable (context.analyzer.bool_type.copy (), get_temp_name (), new BooleanLiteral (true, source_reference), source_reference);
 		block.add_statement (new DeclarationStatement (first_local, source_reference));
 
 		var iterator_block = new Block (source_reference);
@@ -188,6 +188,6 @@ public class Vala.ForStatement : CodeNode, Statement {
 		var parent_block = (Block) parent_node;
 		parent_block.replace_statement (this, block);
 
-		return block.check (analyzer);
+		return block.check (context);
 	}
 }
diff --git a/vala/valaifstatement.vala b/vala/valaifstatement.vala
index 8cb1bac..7655ffd 100644
--- a/vala/valaifstatement.vala
+++ b/vala/valaifstatement.vala
@@ -102,20 +102,20 @@ public class Vala.IfStatement : CodeNode, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		condition.target_type = analyzer.bool_type.copy ();
+		condition.target_type = context.analyzer.bool_type.copy ();
 
-		condition.check (analyzer);
+		condition.check (context);
 
-		true_statement.check (analyzer);
+		true_statement.check (context);
 		if (false_statement != null) {
-			false_statement.check (analyzer);
+			false_statement.check (context);
 		}
 
 		if (condition.error) {
@@ -124,7 +124,7 @@ public class Vala.IfStatement : CodeNode, Statement {
 			return false;
 		}
 
-		if (condition.value_type == null || !condition.value_type.compatible (analyzer.bool_type)) {
+		if (condition.value_type == null || !condition.value_type.compatible (context.analyzer.bool_type)) {
 			error = true;
 			Report.error (condition.source_reference, "Condition must be boolean");
 			return false;
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index 5028caf..5ed9ba8 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -93,7 +93,7 @@ public class Vala.InitializerList : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -123,7 +123,7 @@ public class Vala.InitializerList : Expression {
 				old_parent_node.replace_expression (this, array_creation);
 
 				checked = false;
-				return array_creation.check (analyzer);
+				return array_creation.check (context);
 			}
 
 			DataType inner_target_type;
@@ -171,7 +171,7 @@ public class Vala.InitializerList : Expression {
 		}
 
 		foreach (Expression expr in initializers) {
-			expr.check (analyzer);
+			expr.check (context);
 		}
 
 		bool error = false;
diff --git a/vala/valaintegerliteral.vala b/vala/valaintegerliteral.vala
index 35f794f..4a5295b 100644
--- a/vala/valaintegerliteral.vala
+++ b/vala/valaintegerliteral.vala
@@ -59,7 +59,7 @@ public class Vala.IntegerLiteral : Literal {
 		return true;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -122,9 +122,9 @@ public class Vala.IntegerLiteral : Literal {
 			}
 		}
 
-		var st = (Struct) analyzer.root_symbol.scope.lookup (type_name);
+		var st = (Struct) context.analyzer.root_symbol.scope.lookup (type_name);
 		// ensure attributes are already processed in case of bootstrapping dova-core
-		st.check (analyzer);
+		st.check (context);
 
 		value_type = new IntegerType (st, value, type_name);
 
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index a7aa6e8..f5f9d08 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -585,7 +585,7 @@ public class Vala.Interface : ObjectTypeSymbol {
 		return null;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -594,17 +594,17 @@ public class Vala.Interface : ObjectTypeSymbol {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		foreach (DataType prerequisite_reference in get_prerequisites ()) {
 			// check whether prerequisite is at least as accessible as the interface
-			if (!analyzer.is_type_accessible (this, prerequisite_reference)) {
+			if (!context.analyzer.is_type_accessible (this, prerequisite_reference)) {
 				error = true;
 				Report.error (source_reference, "prerequisite `%s` is less accessible than interface `%s`".printf (prerequisite_reference.to_string (), get_full_name ()));
 				return false;
@@ -640,51 +640,51 @@ public class Vala.Interface : ObjectTypeSymbol {
 		}
 
 		foreach (DataType type in prerequisites) {
-			type.check (analyzer);
+			type.check (context);
 		}
 
 		foreach (TypeParameter p in get_type_parameters ()) {
-			p.check (analyzer);
+			p.check (context);
 		}
 
 		foreach (Enum en in enums) {
-			en.check (analyzer);
+			en.check (context);
 		}
 
 		foreach (Method m in methods) {
-			m.check (analyzer);
+			m.check (context);
 		}
 		
 		foreach (Field f in fields) {
-			f.check (analyzer);
+			f.check (context);
 		}
 
 		foreach (Constant c in constants) {
-			c.check (analyzer);
+			c.check (context);
 		}
 
 		foreach (Property prop in properties) {
-			prop.check (analyzer);
+			prop.check (context);
 		}
 		
 		foreach (Signal sig in signals) {
-			sig.check (analyzer);
+			sig.check (context);
 		}
 		
 		foreach (Class cl in classes) {
-			cl.check (analyzer);
+			cl.check (context);
 		}
 		
 		foreach (Struct st in structs) {
-			st.check (analyzer);
+			st.check (context);
 		}
 
 		foreach (Delegate d in delegates) {
-			d.check (analyzer);
+			d.check (context);
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index ac702ac..3831033 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -111,15 +111,15 @@ public class Vala.LambdaExpression : Expression {
 		return false;
 	}
 
-	string get_lambda_name (SemanticAnalyzer analyzer) {
-		var result = "_lambda%d_".printf (analyzer.next_lambda_id);
+	string get_lambda_name (CodeContext context) {
+		var result = "_lambda%d_".printf (context.analyzer.next_lambda_id);
 
-		analyzer.next_lambda_id++;
+		context.analyzer.next_lambda_id++;
 
 		return result;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -134,15 +134,15 @@ public class Vala.LambdaExpression : Expression {
 
 		var cb = (Delegate) ((DelegateType) target_type).delegate_symbol;
 		var return_type = cb.return_type.get_actual_type (target_type, null, this);
-		method = new Method (get_lambda_name (analyzer), return_type, source_reference);
+		method = new Method (get_lambda_name (context), return_type, source_reference);
 		// track usage for flow analyzer
 		method.used = true;
 		method.check_deprecated (source_reference);
 
-		if (!cb.has_target || !analyzer.is_in_instance_method ()) {
+		if (!cb.has_target || !context.analyzer.is_in_instance_method ()) {
 			method.binding = MemberBinding.STATIC;
 		} else {
-			var sym = analyzer.current_symbol;
+			var sym = context.analyzer.current_symbol;
 			while (method.this_parameter == null) {
 				if (sym is Property) {
 					var prop = (Property) sym;
@@ -161,7 +161,7 @@ public class Vala.LambdaExpression : Expression {
 				sym = sym.parent_symbol;
 			}
 		}
-		method.owner = analyzer.current_symbol.scope;
+		method.owner = context.analyzer.current_symbol.scope;
 
 		if (!(method.return_type is VoidType) && CodeContext.get ().profile == Profile.DOVA) {
 			method.result_var = new LocalVariable (method.return_type.copy (), "result", null, source_reference);
@@ -208,7 +208,7 @@ public class Vala.LambdaExpression : Expression {
 			block.scope.parent_scope = method.scope;
 
 			if (method.return_type.data_type != null) {
-				if (analyzer.context.profile == Profile.DOVA) {
+				if (context.profile == Profile.DOVA) {
 					block.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("result", source_reference), expression_body, AssignmentOperator.SIMPLE, source_reference), source_reference));
 					block.add_statement (new ReturnStatement (null, source_reference));
 				} else {
@@ -225,7 +225,7 @@ public class Vala.LambdaExpression : Expression {
 		method.body.owner = method.scope;
 
 		// support use of generics in closures
-		var m = analyzer.find_parent_method (analyzer.current_symbol);
+		var m = context.analyzer.find_parent_method (context.analyzer.current_symbol);
 		if (m != null) {
 			foreach (var type_param in m.get_type_parameters ()) {
 				method.add_type_parameter (new TypeParameter (type_param.name, type_param.source_reference));
@@ -238,7 +238,7 @@ public class Vala.LambdaExpression : Expression {
 		/* lambda expressions should be usable like MemberAccess of a method */
 		symbol_reference = method;
 
-		method.check (analyzer);
+		method.check (context);
 
 		value_type = new MethodType (method);
 		value_type.value_owned = target_type.value_owned;
diff --git a/vala/valalistliteral.vala b/vala/valalistliteral.vala
index e3c6d6d..b8759d6 100644
--- a/vala/valalistliteral.vala
+++ b/vala/valalistliteral.vala
@@ -62,7 +62,7 @@ public class Vala.ListLiteral : Literal {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -80,12 +80,12 @@ public class Vala.ListLiteral : Literal {
 				initializer.append (expr);
 			}
 
-			analyzer.replaced_nodes.add (this);
+			context.analyzer.replaced_nodes.add (this);
 			parent_node.replace_expression (this, initializer);
-			return initializer.check (analyzer);
+			return initializer.check (context);
 		}
 
-		var list_type = new ObjectType ((Class) analyzer.context.root.scope.lookup ("Dova").scope.lookup ("List"));
+		var list_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("List"));
 		list_type.value_owned = true;
 
 		bool fixed_element_type = false;
@@ -101,7 +101,7 @@ public class Vala.ListLiteral : Literal {
 			if (fixed_element_type) {
 				expr.target_type = element_type;
 			}
-			if (!expr.check (analyzer)) {
+			if (!expr.check (context)) {
 				return false;
 			}
 
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index 4ed1ec2..4fd8daf 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -77,7 +77,7 @@ public class Vala.LocalVariable : Variable {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -90,13 +90,13 @@ public class Vala.LocalVariable : Variable {
 				Report.error (source_reference, "'void' not supported as variable type");
 				return false;
 			}
-			variable_type.check (analyzer);
+			variable_type.check (context);
 		}
 
 		if (initializer != null) {
 			initializer.target_type = variable_type;
 
-			initializer.check (analyzer);
+			initializer.check (context);
 		}
 
 		if (variable_type == null) {
@@ -171,11 +171,11 @@ public class Vala.LocalVariable : Variable {
 			}
 		}
 
-		analyzer.current_symbol.scope.add (name, this);
+		context.analyzer.current_symbol.scope.add (name, this);
 
 		// current_symbol is a Method if this is the `result'
 		// variable used for postconditions
-		var block = analyzer.current_symbol as Block;
+		var block = context.analyzer.current_symbol as Block;
 		if (block != null) {
 			block.add_local_variable (this);
 		}
diff --git a/vala/valalockstatement.vala b/vala/valalockstatement.vala
index 39ad4e0..e0d4216 100644
--- a/vala/valalockstatement.vala
+++ b/vala/valalockstatement.vala
@@ -57,7 +57,7 @@ public class Vala.LockStatement : CodeNode, Statement {
 		visitor.visit_lock_statement (this);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (body != null) {
 			// if the statement isn't empty, it is converted into a try statement
 
@@ -71,7 +71,7 @@ public class Vala.LockStatement : CodeNode, Statement {
 			var parent_block = (Block) parent_node;
 			parent_block.replace_statement (this, block);
 
-			return block.check (analyzer);
+			return block.check (context);
 		}
 
 		if (checked) {
@@ -80,7 +80,7 @@ public class Vala.LockStatement : CodeNode, Statement {
 
 		checked = true;
 
-		resource.check (analyzer);
+		resource.check (context);
 
 		/* resource must be a member access and denote a Lockable */
 		if (!(resource is MemberAccess && resource.symbol_reference is Lockable)) {
@@ -91,7 +91,7 @@ public class Vala.LockStatement : CodeNode, Statement {
 		}
 
 		/* parent symbol must be the current class */
-		if (resource.symbol_reference.parent_symbol != analyzer.current_class) {
+		if (resource.symbol_reference.parent_symbol != context.analyzer.current_class) {
 			error = true;
 			resource.error = true;
 			Report.error (resource.source_reference, "Only members of the current class are lockable");
diff --git a/vala/valaloop.vala b/vala/valaloop.vala
index e73174d..5782070 100644
--- a/vala/valaloop.vala
+++ b/vala/valaloop.vala
@@ -61,14 +61,14 @@ public class Vala.Loop : CodeNode, Statement {
 		body.accept (visitor);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		body.check (analyzer);
+		body.check (context);
 
 		add_error_types (body.get_error_types ());
 
diff --git a/vala/valamapliteral.vala b/vala/valamapliteral.vala
index 9d4fe10..3d1170d 100644
--- a/vala/valamapliteral.vala
+++ b/vala/valamapliteral.vala
@@ -77,14 +77,14 @@ public class Vala.MapLiteral : Literal {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		var map_type = new ObjectType ((Class) analyzer.context.root.scope.lookup ("Dova").scope.lookup ("Map"));
+		var map_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("Map"));
 		map_type.value_owned = true;
 
 		bool fixed_element_type = false;
@@ -101,10 +101,10 @@ public class Vala.MapLiteral : Literal {
 				keys[i].target_type = map_key_type;
 				values[i].target_type = map_value_type;
 			}
-			if (!keys[i].check (analyzer)) {
+			if (!keys[i].check (context)) {
 				return false;
 			}
-			if (!values[i].check (analyzer)) {
+			if (!values[i].check (context)) {
 				return false;
 			}
 			if (map_key_type == null) {
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index e029552..e898318 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -182,7 +182,7 @@ public class Vala.MemberAccess : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -190,11 +190,11 @@ public class Vala.MemberAccess : Expression {
 		checked = true;
 
 		if (inner != null) {
-			inner.check (analyzer);
+			inner.check (context);
 		}
 		
 		foreach (DataType type_arg in type_argument_list) {
-			type_arg.check (analyzer);
+			type_arg.check (context);
 		}
 
 		Symbol base_symbol = null;
@@ -205,24 +205,24 @@ public class Vala.MemberAccess : Expression {
 		symbol_reference = null;
 
 		if (qualified) {
-			base_symbol = analyzer.root_symbol;
-			symbol_reference = analyzer.root_symbol.scope.lookup (member_name);
+			base_symbol = context.analyzer.root_symbol;
+			symbol_reference = context.analyzer.root_symbol.scope.lookup (member_name);
 		} else if (inner == null) {
 			if (member_name == "this") {
-				if (!analyzer.is_in_instance_method ()) {
+				if (!context.analyzer.is_in_instance_method ()) {
 					error = true;
 					Report.error (source_reference, "This access invalid outside of instance methods");
 					return false;
 				}
 			}
 
-			base_symbol = analyzer.current_symbol;
+			base_symbol = context.analyzer.current_symbol;
 
 			// track whether method has been found to make sure that access
 			// to instance member is denied from within static lambda expressions
 			bool method_found = false;
 
-			var sym = analyzer.current_symbol;
+			var sym = context.analyzer.current_symbol;
 			while (sym != null && symbol_reference == null) {
 				if (!method_found) {
 					if (sym is CreationMethod) {
@@ -258,7 +258,7 @@ public class Vala.MemberAccess : Expression {
 					}
 				}
 
-				symbol_reference = analyzer.symbol_lookup_inherited (sym, member_name);
+				symbol_reference = context.analyzer.symbol_lookup_inherited (sym, member_name);
 
 				if (symbol_reference == null) {
 					if (sym is TypeSymbol) {
@@ -297,7 +297,7 @@ public class Vala.MemberAccess : Expression {
 				if (pointer_type != null && pointer_type.base_type is ValueType) {
 					// transform foo->bar to (*foo).bar
 					inner = new PointerIndirection (inner, source_reference);
-					inner.check (analyzer);
+					inner.check (context);
 					pointer_member_access = false;
 				}
 			}
@@ -446,17 +446,17 @@ public class Vala.MemberAccess : Expression {
 		bool klass = false;
 		bool generics = false;
 
-		if (!member.check (analyzer)) {
+		if (!member.check (context)) {
 			return false;
 		}
 
 		if (member is LocalVariable) {
 			var local = (LocalVariable) member;
 			var block = local.parent_symbol as Block;
-			if (block != null && analyzer.find_parent_method_or_property_accessor (block) != analyzer.current_method_or_property_accessor) {
+			if (block != null && context.analyzer.find_parent_method_or_property_accessor (block) != context.analyzer.current_method_or_property_accessor) {
 				// mark all methods between current method and the captured
 				// block as closures (to support nested closures)
-				Symbol sym = analyzer.current_method_or_property_accessor;
+				Symbol sym = context.analyzer.current_method_or_property_accessor;
 				while (sym != block) {
 					var method = sym as Method;
 					if (method != null) {
@@ -474,10 +474,10 @@ public class Vala.MemberAccess : Expression {
 		} else if (member is Parameter) {
 			var param = (Parameter) member;
 			var m = param.parent_symbol as Method;
-			if (m != null && m != analyzer.current_method_or_property_accessor && param != m.this_parameter) {
+			if (m != null && m != context.analyzer.current_method_or_property_accessor && param != m.this_parameter) {
 				// mark all methods between current method and the captured
 				// parameter as closures (to support nested closures)
-				Symbol sym = analyzer.current_method_or_property_accessor;
+				Symbol sym = context.analyzer.current_method_or_property_accessor;
 				while (sym != m) {
 					var method = sym as Method;
 					if (method != null) {
@@ -495,10 +495,10 @@ public class Vala.MemberAccess : Expression {
 				}
 			} else {
 				var acc = param.parent_symbol.parent_symbol as PropertyAccessor;
-				if (acc != null && acc != analyzer.current_method_or_property_accessor && param != acc.prop.this_parameter) {
+				if (acc != null && acc != context.analyzer.current_method_or_property_accessor && param != acc.prop.this_parameter) {
 					// mark all methods between current method and the captured
 					// parameter as closures (to support nested closures)
-					Symbol sym = analyzer.current_method_or_property_accessor;
+					Symbol sym = context.analyzer.current_method_or_property_accessor;
 					while (sym != m) {
 						var method = sym as Method;
 						if (method != null) {
@@ -530,10 +530,10 @@ public class Vala.MemberAccess : Expression {
 			if (m.is_async_callback) {
 				// ensure to use right callback method for virtual/abstract async methods
 				// and also for lambda expressions within async methods
-				var async_method = analyzer.current_async_method;
+				var async_method = context.analyzer.current_async_method;
 
-				if (async_method != analyzer.current_method) {
-					Symbol sym = analyzer.current_method;
+				if (async_method != context.analyzer.current_method) {
+					Symbol sym = context.analyzer.current_method;
 					while (sym != async_method) {
 						var method = sym as Method;
 						if (method != null) {
@@ -587,7 +587,7 @@ public class Vala.MemberAccess : Expression {
 			}
 		} else if (member is Property) {
 			var prop = (Property) member;
-			if (!prop.check (analyzer)) {
+			if (!prop.check (context)) {
 				error = true;
 				return false;
 			}
@@ -647,7 +647,7 @@ public class Vala.MemberAccess : Expression {
 			var target_type = (TypeSymbol) member.parent_symbol;
 
 			bool in_subtype = false;
-			for (Symbol this_symbol = analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
+			for (Symbol this_symbol = context.analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
 				if (this_symbol == target_type) {
 					// required for interfaces with non-abstract methods
 					// accessing protected interface members
@@ -671,7 +671,7 @@ public class Vala.MemberAccess : Expression {
 			var target_type = member.parent_symbol;
 
 			bool in_target_type = false;
-			for (Symbol this_symbol = analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
+			for (Symbol this_symbol = context.analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
 				if (target_type == this_symbol) {
 					in_target_type = true;
 					break;
@@ -711,7 +711,7 @@ public class Vala.MemberAccess : Expression {
 				// also set static type for prototype access
 				// required when using instance methods as delegates in constants
 				// TODO replace by MethodPrototype
-				value_type = analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
+				value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
 			} else if (symbol_reference is Field) {
 				value_type = new FieldPrototype ((Field) symbol_reference);
 			} else {
@@ -729,12 +729,12 @@ public class Vala.MemberAccess : Expression {
 				inner.symbol_reference = this_parameter;
 			}
 
-			if (analyzer.context.experimental_non_null && instance && inner.value_type.nullable &&
+			if (context.experimental_non_null && instance && inner.value_type.nullable &&
 			    !(inner.value_type is PointerType) && !(inner.value_type is GenericType)) {
 				Report.error (source_reference, "Access to instance member `%s' from nullable reference denied".printf (symbol_reference.get_full_name ()));
 			}
 
-			formal_value_type = analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
+			formal_value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
 			if (inner != null && formal_value_type != null) {
 				value_type = formal_value_type.get_actual_type (inner.value_type, null, this);
 			} else {
@@ -758,7 +758,7 @@ public class Vala.MemberAccess : Expression {
 				}
 
 				if (instance && base_method.parent_symbol is TypeSymbol) {
-					inner.target_type = analyzer.get_data_type_for_symbol ((TypeSymbol) base_method.parent_symbol);
+					inner.target_type = context.analyzer.get_data_type_for_symbol ((TypeSymbol) base_method.parent_symbol);
 				}
 			} else if (symbol_reference is Property) {
 				var prop = (Property) symbol_reference;
@@ -773,12 +773,12 @@ public class Vala.MemberAccess : Expression {
 				}
 
 				if (instance && base_property.parent_symbol != null) {
-					inner.target_type = analyzer.get_data_type_for_symbol ((TypeSymbol) base_property.parent_symbol);
+					inner.target_type = context.analyzer.get_data_type_for_symbol ((TypeSymbol) base_property.parent_symbol);
 				}
 			} else if ((symbol_reference is Field
 			            || symbol_reference is Signal)
 			           && instance && symbol_reference.parent_symbol != null) {
-				inner.target_type = analyzer.get_data_type_for_symbol ((TypeSymbol) symbol_reference.parent_symbol);
+				inner.target_type = context.analyzer.get_data_type_for_symbol ((TypeSymbol) symbol_reference.parent_symbol);
 			}
 		}
 
diff --git a/vala/valamemberinitializer.vala b/vala/valamemberinitializer.vala
index afcb230..c5e5d82 100644
--- a/vala/valamemberinitializer.vala
+++ b/vala/valamemberinitializer.vala
@@ -68,8 +68,8 @@ public class Vala.MemberInitializer : CodeNode {
 		initializer.accept (visitor);
 	}
 	
-	public override bool check (SemanticAnalyzer analyzer) {
-		return initializer.check (analyzer);
+	public override bool check (CodeContext context) {
+		return initializer.check (context);
 	}
 
 	public override void emit (CodeGenerator codegen) {
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index dcdbdeb..f8fe916 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -786,7 +786,7 @@ public class Vala.Method : Symbol {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -846,21 +846,21 @@ public class Vala.Method : Symbol {
 			Report.error (source_reference, "Non-abstract, non-extern methods must have bodies");
 		}
 
-		if (coroutine && !external_package && !analyzer.context.has_package ("gio-2.0")) {
+		if (coroutine && !external_package && !context.has_package ("gio-2.0")) {
 			error = true;
 			Report.error (source_reference, "gio-2.0 package required for async methods");
 			return false;
 		}
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
-		return_type.check (analyzer);
+		return_type.check (context);
 
 		var init_attr = get_attribute ("ModuleInit");
 		if (init_attr != null) {
@@ -868,7 +868,7 @@ public class Vala.Method : Symbol {
 		}
 
 		if (return_type != null) {
-			return_type.check (analyzer);
+			return_type.check (context);
 		}
 
 		if (parameters.size == 1 && parameters[0].ellipsis && body != null) {
@@ -878,7 +878,7 @@ public class Vala.Method : Symbol {
 		}
 
 		foreach (Parameter param in parameters) {
-			param.check (analyzer);
+			param.check (context);
 			if (coroutine && param.direction == ParameterDirection.REF) {
 				error = true;
 				Report.error (param.source_reference, "Reference parameters are not supported for async methods");
@@ -886,10 +886,10 @@ public class Vala.Method : Symbol {
 		}
 
 		foreach (DataType error_type in get_error_types ()) {
-			error_type.check (analyzer);
+			error_type.check (context);
 
 			// check whether error type is at least as accessible as the method
-			if (!analyzer.is_type_accessible (this, error_type)) {
+			if (!context.analyzer.is_type_accessible (this, error_type)) {
 				error = true;
 				Report.error (source_reference, "error type `%s` is less accessible than method `%s`".printf (error_type.to_string (), get_full_name ()));
 				return false;
@@ -897,29 +897,29 @@ public class Vala.Method : Symbol {
 		}
 
 		if (result_var != null) {
-			result_var.check (analyzer);
+			result_var.check (context);
 		}
 
 		if (preconditions != null) {
 			foreach (Expression precondition in preconditions) {
-				precondition.check (analyzer);
+				precondition.check (context);
 			}
 		}
 
 		if (postconditions != null) {
 			foreach (Expression postcondition in postconditions) {
-				postcondition.check (analyzer);
+				postcondition.check (context);
 			}
 		}
 
 		if (body != null) {
-			body.check (analyzer);
+			body.check (context);
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
-		if (analyzer.current_struct != null) {
+		if (context.analyzer.current_struct != null) {
 			if (is_abstract || is_virtual || overrides) {
 				error = true;
 				Report.error (source_reference, "A struct member `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ()));
@@ -938,7 +938,7 @@ public class Vala.Method : Symbol {
 		}
 
 		// check whether return type is at least as accessible as the method
-		if (!analyzer.is_type_accessible (this, return_type)) {
+		if (!context.analyzer.is_type_accessible (this, return_type)) {
 			error = true;
 			Report.error (source_reference, "return type `%s` is less accessible than method `%s`".printf (return_type.to_string (), get_full_name ()));
 			return false;
@@ -951,7 +951,7 @@ public class Vala.Method : Symbol {
 				return false;
 			}
 
-			if (!precondition.value_type.compatible (analyzer.bool_type)) {
+			if (!precondition.value_type.compatible (context.analyzer.bool_type)) {
 				error = true;
 				Report.error (precondition.source_reference, "Precondition must be boolean");
 				return false;
@@ -965,7 +965,7 @@ public class Vala.Method : Symbol {
 				return false;
 			}
 
-			if (!postcondition.value_type.compatible (analyzer.bool_type)) {
+			if (!postcondition.value_type.compatible (context.analyzer.bool_type)) {
 				error = true;
 				Report.error (postcondition.source_reference, "Postcondition must be boolean");
 				return false;
@@ -988,16 +988,16 @@ public class Vala.Method : Symbol {
 			}
 		}
 
-		if (is_possible_entry_point (analyzer)) {
-			if (analyzer.context.entry_point != null) {
+		if (is_possible_entry_point (context)) {
+			if (context.entry_point != null) {
 				error = true;
-				Report.error (source_reference, "program already has an entry point `%s'".printf (analyzer.context.entry_point.get_full_name ()));
+				Report.error (source_reference, "program already has an entry point `%s'".printf (context.entry_point.get_full_name ()));
 				return false;
 			}
 			entry_point = true;
-			analyzer.context.entry_point = this;
+			context.entry_point = this;
 
-			if (tree_can_fail && analyzer.context.profile != Profile.DOVA) {
+			if (tree_can_fail && context.profile != Profile.DOVA) {
 				Report.error (source_reference, "\"main\" method cannot throw errors");
 			}
 		}
@@ -1005,19 +1005,19 @@ public class Vala.Method : Symbol {
 		return !error;
 	}
 
-	bool is_possible_entry_point (SemanticAnalyzer analyzer) {
+	bool is_possible_entry_point (CodeContext context) {
 		if (external_package) {
 			return false;
 		}
 
-		if (analyzer.context.entry_point_name == null) {
+		if (context.entry_point_name == null) {
 			if (name == null || name != "main") {
 				// method must be called "main"
 				return false;
 			}
 		} else {
 			// custom entry point name
-			if (get_full_name () != analyzer.context.entry_point_name) {
+			if (get_full_name () != context.entry_point_name) {
 				return false;
 			}
 		}
@@ -1028,7 +1028,7 @@ public class Vala.Method : Symbol {
 		}
 		
 		if (return_type is VoidType) {
-		} else if (return_type.data_type == analyzer.int_type.data_type) {
+		} else if (return_type.data_type == context.analyzer.int_type.data_type) {
 		} else {
 			// return type must be void or int
 			return false;
@@ -1060,7 +1060,7 @@ public class Vala.Method : Symbol {
 		}
 		
 		var array_type = (ArrayType) param.variable_type;
-		if (array_type.element_type.data_type != analyzer.string_type.data_type) {
+		if (array_type.element_type.data_type != context.analyzer.string_type.data_type) {
 			// parameter must be an array of strings
 			return false;
 		}
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 6709fc0..ea3c556 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -128,14 +128,14 @@ public class Vala.MethodCall : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!call.check (analyzer)) {
+		if (!call.check (context)) {
 			/* if method resolving didn't succeed, skip this check */
 			error = true;
 			return false;
@@ -166,9 +166,9 @@ public class Vala.MethodCall : Expression {
 
 		var mtype = call.value_type;
 
-		if (mtype is ObjectType || (analyzer.context.profile == Profile.GOBJECT && call.symbol_reference == analyzer.object_type)) {
+		if (mtype is ObjectType || (context.profile == Profile.GOBJECT && call.symbol_reference == context.analyzer.object_type)) {
 			// constructor chain-up
-			var cm = analyzer.find_current_method () as CreationMethod;
+			var cm = context.analyzer.find_current_method () as CreationMethod;
 			if (cm == null) {
 				error = true;
 				Report.error (source_reference, "invocation not supported in this context");
@@ -196,12 +196,12 @@ public class Vala.MethodCall : Expression {
 			} else {
 				// GObject chain up
 				var cl = cm.parent_symbol as Class;
-				if (cl == null || !cl.is_subtype_of (analyzer.object_type)) {
+				if (cl == null || !cl.is_subtype_of (context.analyzer.object_type)) {
 					error = true;
 					Report.error (source_reference, "chain up to `GLib.Object' not supported");
 					return false;
 				}
-				call.value_type = new ObjectType (analyzer.object_type);
+				call.value_type = new ObjectType (context.analyzer.object_type);
 				mtype = call.value_type;
 			}
 		}
@@ -219,7 +219,7 @@ public class Vala.MethodCall : Expression {
 			}
 
 			if (is_chainup ()) {
-				var cm = analyzer.find_current_method () as CreationMethod;
+				var cm = context.analyzer.find_current_method () as CreationMethod;
 				if (cm != null) {
 					if (cm.chain_up) {
 						error = true;
@@ -235,14 +235,14 @@ public class Vala.MethodCall : Expression {
 				struct_creation_expression.add_argument (arg);
 			}
 			struct_creation_expression.target_type = target_type;
-			analyzer.replaced_nodes.add (this);
+			context.analyzer.replaced_nodes.add (this);
 			parent_node.replace_expression (this, struct_creation_expression);
-			struct_creation_expression.check (analyzer);
+			struct_creation_expression.check (context);
 			return true;
 		} else if (call is MemberAccess
 		           && call.symbol_reference is CreationMethod) {
 			// constructor chain-up
-			var cm = analyzer.find_current_method () as CreationMethod;
+			var cm = context.analyzer.find_current_method () as CreationMethod;
 			if (cm == null) {
 				error = true;
 				Report.error (source_reference, "use `new' operator to create new objects");
@@ -365,7 +365,7 @@ public class Vala.MethodCall : Expression {
 				if (format_literal == null && args.size == params.size - 1) {
 					// insert "%s" to avoid issues with embedded %
 					format_literal = new StringLiteral ("\"%s\"");
-					format_literal.target_type = analyzer.string_type.copy ();
+					format_literal.target_type = context.analyzer.string_type.copy ();
 					argument_list.insert (args.size - 1, format_literal);
 
 					// recreate iterator and skip to right position
@@ -444,36 +444,36 @@ public class Vala.MethodCall : Expression {
 					if (c == 'd' || c == 'i' || c == 'c') {
 						// integer
 						if (length == -2) {
-							param_type = analyzer.int8_type;
+							param_type = context.analyzer.int8_type;
 						} else if (length == -1) {
-							param_type = analyzer.short_type;
+							param_type = context.analyzer.short_type;
 						} else if (length == 0) {
-							param_type = analyzer.int_type;
+							param_type = context.analyzer.int_type;
 						} else if (length == 1) {
-							param_type = analyzer.long_type;
+							param_type = context.analyzer.long_type;
 						} else if (length == 2) {
-							param_type = analyzer.ssize_t_type;
+							param_type = context.analyzer.ssize_t_type;
 						}
 					} else if (c == 'o' || c == 'u' || c == 'x' || c == 'X') {
 						// unsigned integer
 						if (length == -2) {
-							param_type = analyzer.uchar_type;
+							param_type = context.analyzer.uchar_type;
 						} else if (length == -1) {
-							param_type = analyzer.ushort_type;
+							param_type = context.analyzer.ushort_type;
 						} else if (length == 0) {
-							param_type = analyzer.uint_type;
+							param_type = context.analyzer.uint_type;
 						} else if (length == 1) {
-							param_type = analyzer.ulong_type;
+							param_type = context.analyzer.ulong_type;
 						} else if (length == 2) {
-							param_type = analyzer.size_t_type;
+							param_type = context.analyzer.size_t_type;
 						}
 					} else if (c == 'e' || c == 'E' || c == 'f' || c == 'F'
 					           || c == 'g' || c == 'G' || c == 'a' || c == 'A') {
 						// double
-						param_type = analyzer.double_type;
+						param_type = context.analyzer.double_type;
 					} else if (c == 's') {
 						// string
-						param_type = analyzer.string_type;
+						param_type = context.analyzer.string_type;
 					} else if (c == 'p') {
 						// pointer
 						param_type = new PointerType (new VoidType ());
@@ -506,7 +506,7 @@ public class Vala.MethodCall : Expression {
 		}
 
 		foreach (Expression arg in get_argument_list ()) {
-			arg.check (analyzer);
+			arg.check (context);
 		}
 
 		if (ret_type is VoidType) {
@@ -534,11 +534,11 @@ public class Vala.MethodCall : Expression {
 					error = true;
 					Report.error (source_reference, "yield expression requires async method");
 				}
-				if (analyzer.current_method == null || !analyzer.current_method.coroutine) {
+				if (context.analyzer.current_method == null || !context.analyzer.current_method.coroutine) {
 					error = true;
 					Report.error (source_reference, "yield expression not available outside async method");
 				}
-				analyzer.current_method.yield_count++;
+				context.analyzer.current_method.yield_count++;
 			}
 			if (m != null && m.coroutine && !is_yield_expression && ((MemberAccess) call).member_name != "end") {
 				// .begin call of async method, no error can happen here
@@ -662,7 +662,7 @@ public class Vala.MethodCall : Expression {
 			}
 		}
 
-		if (!analyzer.check_arguments (this, mtype, params, get_argument_list ())) {
+		if (!context.analyzer.check_arguments (this, mtype, params, get_argument_list ())) {
 			error = true;
 			return false;
 		}
@@ -670,8 +670,8 @@ public class Vala.MethodCall : Expression {
 		if (may_throw) {
 			if (parent_node is LocalVariable || parent_node is ExpressionStatement) {
 				// simple statements, no side effects after method call
-			} else if (!(analyzer.current_symbol is Block)) {
-				if (analyzer.context.profile != Profile.DOVA) {
+			} else if (!(context.analyzer.current_symbol is Block)) {
+				if (context.profile != Profile.DOVA) {
 					// can't handle errors in field initializers
 					Report.error (source_reference, "Field initializers must not throw errors");
 				}
@@ -684,22 +684,22 @@ public class Vala.MethodCall : Expression {
 				local.floating = true;
 				var decl = new DeclarationStatement (local, source_reference);
 
-				insert_statement (analyzer.insert_block, decl);
+				insert_statement (context.analyzer.insert_block, decl);
 
 				Expression temp_access = new MemberAccess.simple (local.name, source_reference);
 				temp_access.target_type = target_type;
 
 				// don't set initializer earlier as this changes parent_node and parent_statement
 				local.initializer = this;
-				decl.check (analyzer);
-				temp_access.check (analyzer);
+				decl.check (context);
+				temp_access.check (context);
 
 				// move temp variable to insert block to ensure the
 				// variable is in the same block as the declaration
 				// otherwise there will be scoping issues in the generated code
-				var block = (Block) analyzer.current_symbol;
+				var block = (Block) context.analyzer.current_symbol;
 				block.remove_local_variable (local);
-				analyzer.insert_block.add_local_variable (local);
+				context.analyzer.insert_block.add_local_variable (local);
 
 				old_parent_node.replace_expression (this, temp_access);
 			}
diff --git a/vala/valanamedargument.vala b/vala/valanamedargument.vala
index 6b67649..c88e8fc 100644
--- a/vala/valanamedargument.vala
+++ b/vala/valanamedargument.vala
@@ -61,7 +61,7 @@ public class Vala.NamedArgument : Expression {
 		return inner.is_pure ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -70,7 +70,7 @@ public class Vala.NamedArgument : Expression {
 
 		inner.target_type = target_type;
 
-		if (!inner.check (analyzer)) {
+		if (!inner.check (context)) {
 			error = true;
 			return false;
 		}
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 38bf996..45abd68 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -606,7 +606,7 @@ public class Vala.Namespace : Symbol {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -616,7 +616,7 @@ public class Vala.Namespace : Symbol {
 		process_attributes ();
 
 		foreach (Namespace ns in namespaces) {
-			ns.check (analyzer);
+			ns.check (context);
 		}
 
 		return !error;
diff --git a/vala/valanullliteral.vala b/vala/valanullliteral.vala
index 94be504..b5f95d0 100644
--- a/vala/valanullliteral.vala
+++ b/vala/valanullliteral.vala
@@ -50,7 +50,7 @@ public class Vala.NullLiteral : Literal {
 		return true;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index f95aba8..dac7d74 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -143,7 +143,7 @@ public class Vala.ObjectCreationExpression : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -151,7 +151,7 @@ public class Vala.ObjectCreationExpression : Expression {
 		checked = true;
 
 		if (member_name != null) {
-			member_name.check (analyzer);
+			member_name.check (context);
 		}
 
 		TypeSymbol type = null;
@@ -260,7 +260,7 @@ public class Vala.ObjectCreationExpression : Expression {
 
 			if (symbol_reference != null && symbol_reference.access == SymbolAccessibility.PRIVATE) {
 				bool in_target_type = false;
-				for (Symbol this_symbol = analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
+				for (Symbol this_symbol = context.analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
 					if (this_symbol == cl) {
 						in_target_type = true;
 						break;
@@ -287,7 +287,7 @@ public class Vala.ObjectCreationExpression : Expression {
 
 			expected_num_type_args = st.get_type_parameters ().size;
 
-			if (!struct_creation && !analyzer.context.deprecated) {
+			if (!struct_creation && !context.deprecated) {
 				Report.warning (source_reference, "deprecated syntax, don't use `new' to initialize structs");
 			}
 
@@ -333,10 +333,10 @@ public class Vala.ObjectCreationExpression : Expression {
 			}
 
 			foreach (Expression arg in args) {
-				arg.check (analyzer);
+				arg.check (context);
 			}
 
-			analyzer.check_arguments (this, new MethodType (m), m.get_parameters (), args);
+			context.analyzer.check_arguments (this, new MethodType (m), m.get_parameters (), args);
 
 			foreach (DataType error_type in m.get_error_types ()) {
 				may_throw = true;
@@ -349,19 +349,19 @@ public class Vala.ObjectCreationExpression : Expression {
 			}
 		} else if (type_reference is ErrorType) {
 			if (type_reference != null) {
-				type_reference.check (analyzer);
+				type_reference.check (context);
 			}
 
 			if (member_name != null) {
-				member_name.check (analyzer);
+				member_name.check (context);
 			}
 		
 			foreach (Expression arg in argument_list) {
-				arg.check (analyzer);
+				arg.check (context);
 			}
 
 			foreach (MemberInitializer init in object_initializer) {
-				init.check (analyzer);
+				init.check (context);
 			}
 
 			if (get_argument_list ().size == 0) {
@@ -371,7 +371,7 @@ public class Vala.ObjectCreationExpression : Expression {
 				Iterator<Expression> arg_it = get_argument_list ().iterator ();
 				arg_it.next ();
 				var ex = arg_it.get ();
-				if (ex.value_type == null || !ex.value_type.compatible (analyzer.string_type)) {
+				if (ex.value_type == null || !ex.value_type.compatible (context.analyzer.string_type)) {
 					error = true;
 					Report.error (source_reference, "Invalid type for argument 1");
 				}
@@ -379,14 +379,14 @@ public class Vala.ObjectCreationExpression : Expression {
 		}
 
 		foreach (MemberInitializer init in get_object_initializer ()) {
-			analyzer.visit_member_initializer (init, type_reference);
+			context.analyzer.visit_member_initializer (init, type_reference);
 		}
 
 		if (may_throw) {
 			if (parent_node is LocalVariable || parent_node is ExpressionStatement) {
 				// simple statements, no side effects after method call
-			} else if (!(analyzer.current_symbol is Block)) {
-				if (analyzer.context.profile != Profile.DOVA) {
+			} else if (!(context.analyzer.current_symbol is Block)) {
+				if (context.profile != Profile.DOVA) {
 					// can't handle errors in field initializers
 					Report.error (source_reference, "Field initializers must not throw errors");
 				}
@@ -399,22 +399,22 @@ public class Vala.ObjectCreationExpression : Expression {
 				local.floating = true;
 				var decl = new DeclarationStatement (local, source_reference);
 
-				insert_statement (analyzer.insert_block, decl);
+				insert_statement (context.analyzer.insert_block, decl);
 
 				Expression temp_access = new MemberAccess.simple (local.name, source_reference);
 				temp_access.target_type = target_type;
 
 				// don't set initializer earlier as this changes parent_node and parent_statement
 				local.initializer = this;
-				decl.check (analyzer);
-				temp_access.check (analyzer);
+				decl.check (context);
+				temp_access.check (context);
 
 				// move temp variable to insert block to ensure the
 				// variable is in the same block as the declaration
 				// otherwise there will be scoping issues in the generated code
-				var block = (Block) analyzer.current_symbol;
+				var block = (Block) context.analyzer.current_symbol;
 				block.remove_local_variable (local);
-				analyzer.insert_block.add_local_variable (local);
+				context.analyzer.insert_block.add_local_variable (local);
 
 				old_parent_node.replace_expression (this, temp_access);
 			}
diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala
index ad37f62..4218756 100644
--- a/vala/valaobjecttype.vala
+++ b/vala/valaobjecttype.vala
@@ -105,12 +105,12 @@ public class Vala.ObjectType : ReferenceType {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
-		if (!type_symbol.check (analyzer)) {
+	public override bool check (CodeContext context) {
+		if (!type_symbol.check (context)) {
 			return false;
 		}
 
-		if (analyzer.context.profile == Profile.DOVA && type_symbol.get_full_name () == "Dova.Tuple") {
+		if (context.profile == Profile.DOVA && type_symbol.get_full_name () == "Dova.Tuple") {
 			// tuples have variadic generics
 			return true;
 		}
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 9d17377..d73e25c 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -216,7 +216,7 @@ public class Vala.Parameter : Variable {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -225,13 +225,13 @@ public class Vala.Parameter : Variable {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = parent_symbol;
+		context.analyzer.current_symbol = parent_symbol;
 
 		if (variable_type != null) {
 			if (variable_type is VoidType) {
@@ -239,11 +239,11 @@ public class Vala.Parameter : Variable {
 				Report.error (source_reference, "'void' not supported as parameter type");
 				return false;
 			}
-			variable_type.check (analyzer);
+			variable_type.check (context);
 		}
 
 		if (!ellipsis) {
-			variable_type.check (analyzer);
+			variable_type.check (context);
 			
 			if (params_array && !(variable_type is ArrayType)) {
 				error = true;
@@ -253,7 +253,7 @@ public class Vala.Parameter : Variable {
 
 			if (initializer != null) {
 				initializer.target_type = variable_type.copy ();
-				initializer.check (analyzer);
+				initializer.check (context);
 			}
 		}
 
@@ -267,14 +267,14 @@ public class Vala.Parameter : Variable {
 
 		if (!ellipsis) {
 			// check whether parameter type is at least as accessible as the method
-			if (!analyzer.is_type_accessible (this, variable_type)) {
+			if (!context.analyzer.is_type_accessible (this, variable_type)) {
 				error = true;
 				Report.error (source_reference, "parameter type `%s` is less accessible than method `%s`".printf (variable_type.to_string (), parent_symbol.get_full_name ()));
 			}
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala
index 17295e4..424958b 100644
--- a/vala/valapointerindirection.vala
+++ b/vala/valapointerindirection.vala
@@ -69,14 +69,14 @@ public class Vala.PointerIndirection : Expression {
 		return inner.is_pure ();
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!inner.check (analyzer)) {
+		if (!inner.check (context)) {
 			return false;
 		}
 		if (inner.value_type == null) {
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index 9d11d8d..d7da3d8 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -140,8 +140,8 @@ public class Vala.PointerType : DataType {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
-		error = !base_type.check (analyzer);
+	public override bool check (CodeContext context) {
+		error = !base_type.check (context);
 		return !error;
 	}
 }
diff --git a/vala/valapostfixexpression.vala b/vala/valapostfixexpression.vala
index 57969b0..065381a 100644
--- a/vala/valapostfixexpression.vala
+++ b/vala/valapostfixexpression.vala
@@ -64,14 +64,14 @@ public class Vala.PostfixExpression : Expression {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!inner.check (analyzer)) {
+		if (!inner.check (context)) {
 			error = true;
 			return false;
 		}
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index ae2d022..467cdf8 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -419,7 +419,7 @@ public class Vala.Property : Symbol, Lockable {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -470,13 +470,13 @@ public class Vala.Property : Symbol, Lockable {
 			}
 		}
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		if (property_type is VoidType) {
 			error = true;
@@ -484,21 +484,21 @@ public class Vala.Property : Symbol, Lockable {
 			return false;
 		}
 
-		property_type.check (analyzer);
+		property_type.check (context);
 
 		if (get_accessor != null) {
-			get_accessor.check (analyzer);
+			get_accessor.check (context);
 		}
 		if (set_accessor != null) {
-			set_accessor.check (analyzer);
+			set_accessor.check (context);
 		}
 
 		if (initializer != null) {
-			initializer.check (analyzer);
+			initializer.check (context);
 		}
 
 		// check whether property type is at least as accessible as the property
-		if (!analyzer.is_type_accessible (this, property_type)) {
+		if (!context.analyzer.is_type_accessible (this, property_type)) {
 			error = true;
 			Report.error (source_reference, "property type `%s` is less accessible than property `%s`".printf (property_type.to_string (), get_full_name ()));
 		}
@@ -524,8 +524,8 @@ public class Vala.Property : Symbol, Lockable {
 			Report.error (initializer.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), initializer.value_type.to_string ()));
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 2b5ed82..5579e8b 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -170,7 +170,7 @@ public class Vala.PropertyAccessor : Symbol {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -179,14 +179,14 @@ public class Vala.PropertyAccessor : Symbol {
 
 		process_attributes ();
 
-		if (!value_type.check (analyzer)) {
+		if (!value_type.check (context)) {
 			error = true;
 			return false;
 		}
 
-		var old_symbol = analyzer.current_symbol;
+		var old_symbol = context.analyzer.current_symbol;
 
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		if (prop.source_type == SourceFileType.SOURCE) {
 			if (body == null && !prop.interface_only && !prop.is_abstract) {
@@ -201,7 +201,7 @@ public class Vala.PropertyAccessor : Symbol {
 				body = new Block (source_reference);
 				var ma = new MemberAccess.simple ("_%s".printf (prop.name), source_reference);
 				if (readable) {
-					if (analyzer.context.profile == Profile.DOVA) {
+					if (context.profile == Profile.DOVA) {
 						body.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("result", source_reference), ma, AssignmentOperator.SIMPLE, source_reference), source_reference));
 						body.add_statement (new ReturnStatement (null, source_reference));
 					} else {
@@ -215,19 +215,19 @@ public class Vala.PropertyAccessor : Symbol {
 		}
 
 		if (body != null) {
-			if (readable && analyzer.context.profile == Profile.DOVA) {
+			if (readable && context.profile == Profile.DOVA) {
 				result_var = new LocalVariable (value_type.copy (), "result", null, source_reference);
 				result_var.is_result = true;
 
-				result_var.check (analyzer);
+				result_var.check (context);
 			} else if (writable || construction) {
 				value_parameter = new Parameter ("value", value_type, source_reference);
 				body.scope.add (value_parameter.name, value_parameter);
 			}
 
-			body.check (analyzer);
+			body.check (context);
 
-			if (analyzer.context.profile != Profile.DOVA) {
+			if (context.profile != Profile.DOVA) {
 				foreach (DataType body_error_type in body.get_error_types ()) {
 					if (!((ErrorType) body_error_type).dynamic_error) {
 						Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string()));
@@ -236,7 +236,7 @@ public class Vala.PropertyAccessor : Symbol {
 			}
 		}
 
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valarealliteral.vala b/vala/valarealliteral.vala
index f45560f..0acfb88 100644
--- a/vala/valarealliteral.vala
+++ b/vala/valarealliteral.vala
@@ -70,16 +70,16 @@ public class Vala.RealLiteral : Literal {
 		return value;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		var st = (Struct) analyzer.root_symbol.scope.lookup (get_type_name ());
+		var st = (Struct) context.analyzer.root_symbol.scope.lookup (get_type_name ());
 		// ensure attributes are already processed in case of bootstrapping dova-core
-		st.check (analyzer);
+		st.check (context);
 
 		value_type = new FloatingType (st);
 
diff --git a/vala/valareferencetransferexpression.vala b/vala/valareferencetransferexpression.vala
index 945593f..5e34282 100644
--- a/vala/valareferencetransferexpression.vala
+++ b/vala/valareferencetransferexpression.vala
@@ -71,7 +71,7 @@ public class Vala.ReferenceTransferExpression : Expression {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -80,7 +80,7 @@ public class Vala.ReferenceTransferExpression : Expression {
 
 		inner.lvalue = true;
 
-		inner.check (analyzer);
+		inner.check (context);
 
 		if (inner.error) {
 			/* if there was an error in the inner expression, skip type check */
diff --git a/vala/valaregexliteral.vala b/vala/valaregexliteral.vala
index 8e4cdc6..e8c9fa8 100644
--- a/vala/valaregexliteral.vala
+++ b/vala/valaregexliteral.vala
@@ -62,14 +62,14 @@ public class Vala.RegexLiteral : Literal {
 		return value;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!analyzer.context.experimental) {
+		if (!context.experimental) {
 			Report.warning (source_reference, "regular expression literals are experimental");
 		}
 
@@ -82,7 +82,7 @@ public class Vala.RegexLiteral : Literal {
 			return false;
 		}
 
-		value_type = analyzer.regex_type.copy ();
+		value_type = context.analyzer.regex_type.copy ();
 
 		return !error;
 	}
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index b8b2e83..39aff82 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -70,7 +70,7 @@ public class Vala.ReturnStatement : CodeNode, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -78,35 +78,35 @@ public class Vala.ReturnStatement : CodeNode, Statement {
 		checked = true;
 
 		if (return_expression != null) {
-			return_expression.target_type = analyzer.current_return_type;
+			return_expression.target_type = context.analyzer.current_return_type;
 		}
 
-		if (return_expression != null && !return_expression.check (analyzer)) {
+		if (return_expression != null && !return_expression.check (context)) {
 			// ignore inner error
 			error = true;
 			return false;
 		}
 
-		if (analyzer.current_return_type == null) {
+		if (context.analyzer.current_return_type == null) {
 			error = true;
 			Report.error (source_reference, "Return not allowed in this context");
 			return false;
 		}
 
-		if (analyzer.context.profile == Profile.DOVA) {
+		if (context.profile == Profile.DOVA) {
 			// no return expressions in Dova profile
 			return !error;
 		}
 
 		if (return_expression == null) {
-			if (!(analyzer.current_return_type is VoidType)) {
+			if (!(context.analyzer.current_return_type is VoidType)) {
 				error = true;
 				Report.error (source_reference, "Return without value in non-void function");
 			}
 			return !error;
 		}
 
-		if (analyzer.current_return_type is VoidType) {
+		if (context.analyzer.current_return_type is VoidType) {
 			Report.error (source_reference, "Return with value in void function");
 			return false;
 		}
@@ -117,14 +117,14 @@ public class Vala.ReturnStatement : CodeNode, Statement {
 			return false;
 		}
 
-		if (!return_expression.value_type.compatible (analyzer.current_return_type)) {
+		if (!return_expression.value_type.compatible (context.analyzer.current_return_type)) {
 			error = true;
-			Report.error (source_reference, "Return: Cannot convert from `%s' to `%s'".printf (return_expression.value_type.to_string (), analyzer.current_return_type.to_string ()));
+			Report.error (source_reference, "Return: Cannot convert from `%s' to `%s'".printf (return_expression.value_type.to_string (), context.analyzer.current_return_type.to_string ()));
 			return false;
 		}
 
 		if (return_expression.value_type.is_disposable () &&
-		    !analyzer.current_return_type.value_owned) {
+		    !context.analyzer.current_return_type.value_owned) {
 			error = true;
 			Report.error (source_reference, "Return value transfers ownership but method return type hasn't been declared to transfer ownership");
 			return false;
@@ -132,15 +132,15 @@ public class Vala.ReturnStatement : CodeNode, Statement {
 
 		var local = return_expression.symbol_reference as LocalVariable;
 		if (local != null && local.variable_type.is_disposable () &&
-		    !analyzer.current_return_type.value_owned) {
+		    !context.analyzer.current_return_type.value_owned) {
 			error = true;
 			Report.error (source_reference, "Local variable with strong reference used as return value and method return type has not been declared to transfer ownership");
 			return false;
 		}
 
 		if (return_expression is NullLiteral
-		    && !analyzer.current_return_type.nullable) {
-			Report.warning (source_reference, "`null' incompatible with return type `%s`".printf (analyzer.current_return_type.to_string ()));
+		    && !context.analyzer.current_return_type.nullable) {
+			Report.warning (source_reference, "`null' incompatible with return type `%s`".printf (context.analyzer.current_return_type.to_string ()));
 		}
 
 		add_error_types (return_expression.get_error_types ());
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 32709cc..7891bc5 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -232,14 +232,14 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 		}
 
 		current_symbol = root_symbol;
-		context.root.check (this);
+		context.root.check (context);
 		context.accept (this);
 	}
 
 	public override void visit_source_file (SourceFile file) {
 		current_source_file = file;
 
-		file.check (this);
+		file.check (context);
 	}
 
 	// check whether type is at least as accessible as the specified symbol
@@ -387,7 +387,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 		bool ellipsis = false;
 		int i = 0;
 		foreach (Parameter param in params) {
-			if (!param.check (this)) {
+			if (!param.check (context)) {
 				return false;
 			}
 
@@ -799,7 +799,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 		init.initializer.formal_target_type = member_type;
 		init.initializer.target_type = init.initializer.formal_target_type.get_actual_type (type, null, init);;
 
-		init.check (this);
+		init.check (context);
 
 		if (init.initializer.value_type == null || !init.initializer.value_type.compatible (init.initializer.target_type)) {
 			init.error = true;
diff --git a/vala/valasetliteral.vala b/vala/valasetliteral.vala
index 5ae8e94..d0f1228 100644
--- a/vala/valasetliteral.vala
+++ b/vala/valasetliteral.vala
@@ -62,14 +62,14 @@ public class Vala.SetLiteral : Literal {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		var set_type = new ObjectType ((Class) analyzer.context.root.scope.lookup ("Dova").scope.lookup ("Set"));
+		var set_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("Set"));
 		set_type.value_owned = true;
 
 		bool fixed_element_type = false;
@@ -85,7 +85,7 @@ public class Vala.SetLiteral : Literal {
 			if (fixed_element_type) {
 				expr.target_type = element_type;
 			}
-			if (!expr.check (analyzer)) {
+			if (!expr.check (context)) {
 				return false;
 			}
 
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 7e2a01a..6530c44 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -266,7 +266,7 @@ public class Vala.Signal : Symbol, Lockable {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -275,10 +275,10 @@ public class Vala.Signal : Symbol, Lockable {
 
 		process_attributes ();
 
-		return_type.check (analyzer);
+		return_type.check (context);
 		
 		foreach (Parameter param in parameters) {
-			param.check (analyzer);
+			param.check (context);
 		}
 
 		if (!is_virtual && body != null) {
@@ -305,7 +305,7 @@ public class Vala.Signal : Symbol, Lockable {
 			var cl = parent_symbol as ObjectTypeSymbol;
 
 			cl.add_hidden_method (default_handler);
-			default_handler.check (analyzer);
+			default_handler.check (context);
 		}
 
 
diff --git a/vala/valasizeofexpression.vala b/vala/valasizeofexpression.vala
index 1064389..01fda86 100644
--- a/vala/valasizeofexpression.vala
+++ b/vala/valasizeofexpression.vala
@@ -71,16 +71,16 @@ public class Vala.SizeofExpression : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		type_reference.check (analyzer);
+		type_reference.check (context);
 
-		value_type = analyzer.ulong_type;
+		value_type = context.analyzer.ulong_type;
 
 		return !error;
 	}
diff --git a/vala/valasliceexpression.vala b/vala/valasliceexpression.vala
index 77c5743..4680a1b 100644
--- a/vala/valasliceexpression.vala
+++ b/vala/valasliceexpression.vala
@@ -98,24 +98,24 @@ public class Vala.SliceExpression : Expression {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!container.check (analyzer)) {
+		if (!container.check (context)) {
 			error = true;
 			return false;
 		}
 
-		if (!start.check (analyzer)) {
+		if (!start.check (context)) {
 			error = true;
 			return false;
 		}
 
-		if (!stop.check (analyzer)) {
+		if (!stop.check (context)) {
 			error = true;
 			return false;
 		}
@@ -153,7 +153,7 @@ public class Vala.SliceExpression : Expression {
 				slice_call.add_argument (stop);
 				slice_call.target_type = this.target_type;
 				parent_node.replace_expression (this, slice_call);
-				return slice_call.check (analyzer);
+				return slice_call.check (context);
 			}
 
 			error = true;
diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala
index 9043358..931f020 100644
--- a/vala/valasourcefile.vala
+++ b/vala/valasourcefile.vala
@@ -312,9 +312,9 @@ public class Vala.SourceFile {
 		return mapped_file.get_length ();
 	}
 
-	public bool check (SemanticAnalyzer analyzer) {
+	public bool check (CodeContext context) {
 		foreach (CodeNode node in nodes) {
-			node.check (analyzer);
+			node.check (context);
 		}
 		return true;
 	}
diff --git a/vala/valastringliteral.vala b/vala/valastringliteral.vala
index e0234bd..69fc4d7 100644
--- a/vala/valastringliteral.vala
+++ b/vala/valastringliteral.vala
@@ -77,14 +77,14 @@ public class Vala.StringLiteral : Literal {
 		return value;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		value_type = analyzer.string_type.copy ();
+		value_type = context.analyzer.string_type.copy ();
 
 		return !error;
 	}
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 906ce41..cab1b82 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -817,7 +817,7 @@ public class Vala.Struct : TypeSymbol {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -826,16 +826,16 @@ public class Vala.Struct : TypeSymbol {
 
 		process_attributes ();
 
-		var old_source_file = analyzer.current_source_file;
-		var old_symbol = analyzer.current_symbol;
+		var old_source_file = context.analyzer.current_source_file;
+		var old_symbol = context.analyzer.current_symbol;
 
 		if (source_reference != null) {
-			analyzer.current_source_file = source_reference.file;
+			context.analyzer.current_source_file = source_reference.file;
 		}
-		analyzer.current_symbol = this;
+		context.analyzer.current_symbol = this;
 
 		if (base_type != null) {
-			base_type.check (analyzer);
+			base_type.check (context);
 
 			if (!(base_type is ValueType)) {
 				error = true;
@@ -845,11 +845,11 @@ public class Vala.Struct : TypeSymbol {
 		}
 
 		foreach (TypeParameter p in type_parameters) {
-			p.check (analyzer);
+			p.check (context);
 		}
 
 		foreach (Field f in fields) {
-			f.check (analyzer);
+			f.check (context);
 
 			if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (f.variable_type)) {
 				error = true;
@@ -865,15 +865,15 @@ public class Vala.Struct : TypeSymbol {
 		}
 
 		foreach (Constant c in constants) {
-			c.check (analyzer);
+			c.check (context);
 		}
 
 		foreach (Method m in methods) {
-			m.check (analyzer);
+			m.check (context);
 		}
 
 		foreach (Property prop in properties) {
-			prop.check (analyzer);
+			prop.check (context);
 		}
 
 		if (!external && !external_package) {
@@ -891,8 +891,8 @@ public class Vala.Struct : TypeSymbol {
 			}
 		}
 
-		analyzer.current_source_file = old_source_file;
-		analyzer.current_symbol = old_symbol;
+		context.analyzer.current_source_file = old_source_file;
+		context.analyzer.current_symbol = old_symbol;
 
 		return !error;
 	}
diff --git a/vala/valaswitchlabel.vala b/vala/valaswitchlabel.vala
index 2a15d96..9468b0e 100644
--- a/vala/valaswitchlabel.vala
+++ b/vala/valaswitchlabel.vala
@@ -67,9 +67,9 @@ public class Vala.SwitchLabel : CodeNode {
 		}
 	}
 	
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (expression != null) {
-			expression.check (analyzer);
+			expression.check (context);
 
 			var switch_statement = (SwitchStatement) section.parent_node;
 			if (!expression.is_constant ()) {
diff --git a/vala/valaswitchsection.vala b/vala/valaswitchsection.vala
index c8faae5..ce81805 100644
--- a/vala/valaswitchsection.vala
+++ b/vala/valaswitchsection.vala
@@ -81,7 +81,7 @@ public class Vala.SwitchSection : Block {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -89,18 +89,18 @@ public class Vala.SwitchSection : Block {
 		checked = true;
 
 		foreach (SwitchLabel label in get_labels ()) {
-			label.check (analyzer);
+			label.check (context);
 		}
 
-		owner = analyzer.current_symbol.scope;
+		owner = context.analyzer.current_symbol.scope;
 
-		var old_symbol = analyzer.current_symbol;
-		var old_insert_block = analyzer.insert_block;
-		analyzer.current_symbol = this;
-		analyzer.insert_block = this;
+		var old_symbol = context.analyzer.current_symbol;
+		var old_insert_block = context.analyzer.insert_block;
+		context.analyzer.current_symbol = this;
+		context.analyzer.insert_block = this;
 
 		foreach (Statement st in get_statements ()) {
-			st.check (analyzer);
+			st.check (context);
 		}
 
 		foreach (LocalVariable local in get_local_variables ()) {
@@ -112,8 +112,8 @@ public class Vala.SwitchSection : Block {
 			add_error_types (stmt.get_error_types ());
 		}
 
-		analyzer.current_symbol = old_symbol;
-		analyzer.insert_block = old_insert_block;
+		context.analyzer.current_symbol = old_symbol;
+		context.analyzer.insert_block = old_insert_block;
 
 		return !error;
 	}
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index c2066c5..6509d49 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -93,14 +93,14 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 		}
 	}
 	
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (!expression.check (analyzer)) {
+		if (!expression.check (context)) {
 			error = true;
 			return false;
 		}
@@ -108,7 +108,7 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 		if (expression.value_type == null ||
 		    (!(expression.value_type is IntegerType) &&
 		     !(expression.value_type is EnumValueType) &&
-		     !expression.value_type.compatible (analyzer.string_type))) {
+		     !expression.value_type.compatible (context.analyzer.string_type))) {
 			Report.error (expression.source_reference, "Integer or string expression expected");
 			error = true;
 			return false;
@@ -119,7 +119,7 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 
 		var labelset = new HashSet<string> (str_hash, str_equal);
 		foreach (SwitchSection section in sections) {
-			section.check (analyzer);
+			section.check (context);
 
 			// check for duplicate literal case labels
 			// FIXME: make it work for all constant expressions
diff --git a/vala/valatemplate.vala b/vala/valatemplate.vala
index c329c5c..d11c0c8 100644
--- a/vala/valatemplate.vala
+++ b/vala/valatemplate.vala
@@ -58,7 +58,7 @@ public class Vala.Template : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -72,7 +72,7 @@ public class Vala.Template : Expression {
 		} else {
 			expr = stringify (expression_list[0]);
 			if (expression_list.size > 1) {
-				if (analyzer.context.profile == Profile.DOVA) {
+				if (context.profile == Profile.DOVA) {
 					// varargs concat not yet supported
 					for (int i = 1; i < expression_list.size; i++) {
 						expr = new BinaryExpression (BinaryOperator.PLUS, expr, stringify (expression_list[i]), source_reference);
@@ -88,9 +88,9 @@ public class Vala.Template : Expression {
 		}
 		expr.target_type = target_type;
 
-		analyzer.replaced_nodes.add (this);
+		context.analyzer.replaced_nodes.add (this);
 		parent_node.replace_expression (this, expr);
-		return expr.check (analyzer);
+		return expr.check (context);
 	}
 }
 
diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala
index 444df3c..2667db6 100644
--- a/vala/valathrowstatement.vala
+++ b/vala/valathrowstatement.vala
@@ -72,22 +72,22 @@ public class Vala.ThrowStatement : CodeNode, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (analyzer.context.profile == Profile.GOBJECT) {
+		if (context.profile == Profile.GOBJECT) {
 			error_expression.target_type = new ErrorType (null, null, source_reference);
 		} else {
-			error_expression.target_type = analyzer.error_type.copy ();
+			error_expression.target_type = context.analyzer.error_type.copy ();
 		}
 		error_expression.target_type.value_owned = true;
 
 		if (error_expression != null) {
-			if (!error_expression.check (analyzer)) {
+			if (!error_expression.check (context)) {
 				error = true;
 				return false;
 			}
@@ -98,7 +98,7 @@ public class Vala.ThrowStatement : CodeNode, Statement {
 				return false;
 			}
 
-			if (analyzer.context.profile == Profile.GOBJECT && !(error_expression.value_type is ErrorType)) {
+			if (context.profile == Profile.GOBJECT && !(error_expression.value_type is ErrorType)) {
 				Report.error (error_expression.source_reference, "`%s' is not an error type".printf (error_expression.value_type.to_string ()));
 				error = true;
 				return false;
diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala
index e5d3b2e..38000f5 100644
--- a/vala/valatrystatement.vala
+++ b/vala/valatrystatement.vala
@@ -104,14 +104,14 @@ public class Vala.TryStatement : CodeNode, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		body.check (analyzer);
+		body.check (context);
 
 		var error_types = new ArrayList<DataType> ();
 		foreach (DataType body_error_type in body.get_error_types ()) {
@@ -130,14 +130,14 @@ public class Vala.TryStatement : CodeNode, Statement {
 			}
 			handled_error_types.clear ();
 
-			clause.check (analyzer);
+			clause.check (context);
 			foreach (DataType body_error_type in clause.body.get_error_types ()) {
 				error_types.add (body_error_type);
 			}
 		}
 
 		if (finally_body != null) {
-			finally_body.check (analyzer);
+			finally_body.check (context);
 			foreach (DataType body_error_type in finally_body.get_error_types ()) {
 				error_types.add (body_error_type);
 			}
diff --git a/vala/valatuple.vala b/vala/valatuple.vala
index 2fcc45d..852215a 100644
--- a/vala/valatuple.vala
+++ b/vala/valatuple.vala
@@ -64,24 +64,24 @@ public class Vala.Tuple : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		if (analyzer.context.profile != Profile.DOVA) {
+		if (context.profile != Profile.DOVA) {
 			Report.error (source_reference, "tuples are not supported");
 			error = true;
 			return false;
 		}
 
-		value_type = new ObjectType ((Class) analyzer.context.root.scope.lookup ("Dova").scope.lookup ("Tuple"));
+		value_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("Tuple"));
 		value_type.value_owned = true;
 
 		foreach (var expr in expression_list) {
-			if (!expr.check (analyzer)) {
+			if (!expr.check (context)) {
 				return false;
 			}
 			value_type.add_type_argument (expr.value_type.copy ());
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index 9208812..749401d 100644
--- a/vala/valatypecheck.vala
+++ b/vala/valatypecheck.vala
@@ -93,16 +93,16 @@ public class Vala.TypeCheck : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		expression.check (analyzer);
+		expression.check (context);
 		
-		type_reference.check (analyzer);
+		type_reference.check (context);
 
 		if (type_reference.data_type == null) {
 			/* if type resolving didn't succeed, skip this check */
@@ -110,7 +110,7 @@ public class Vala.TypeCheck : Expression {
 			return false;
 		}
 
-		value_type = analyzer.bool_type;
+		value_type = context.analyzer.bool_type;
 
 		return !error;
 	}
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index d85f186..9efb1f5 100644
--- a/vala/valatypeofexpression.vala
+++ b/vala/valatypeofexpression.vala
@@ -71,16 +71,16 @@ public class Vala.TypeofExpression : Expression {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		type_reference.check (analyzer);
+		type_reference.check (context);
 
-		value_type = analyzer.type_type;
+		value_type = context.analyzer.type_type;
 
 		return !error;
 	}
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index 51206c1..661a8fb 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -137,7 +137,7 @@ public class Vala.UnaryExpression : Expression {
 		return null;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
@@ -149,7 +149,7 @@ public class Vala.UnaryExpression : Expression {
 			inner.target_type = target_type;
 		}
 
-		if (!inner.check (analyzer)) {
+		if (!inner.check (context)) {
 			/* if there was an error in the inner expression, skip type check */
 			error = true;
 			return false;
@@ -172,7 +172,7 @@ public class Vala.UnaryExpression : Expression {
 			value_type = inner.value_type;
 		} else if (operator == UnaryOperator.LOGICAL_NEGATION) {
 			// boolean type
-			if (!inner.value_type.compatible (analyzer.bool_type)) {
+			if (!inner.value_type.compatible (context.analyzer.bool_type)) {
 				error = true;
 				Report.error (source_reference, "Operator not supported for `%s'".printf (inner.value_type.to_string ()));
 				return false;
@@ -209,9 +209,9 @@ public class Vala.UnaryExpression : Expression {
 
 			var assignment = new Assignment (ma, bin, AssignmentOperator.SIMPLE, source_reference);
 			assignment.target_type = target_type;
-			analyzer.replaced_nodes.add (this);
+			context.analyzer.replaced_nodes.add (this);
 			parent_node.replace_expression (this, assignment);
-			assignment.check (analyzer);
+			assignment.check (context);
 			return true;
 		} else if (operator == UnaryOperator.REF || operator == UnaryOperator.OUT) {
 			var ea = inner as ElementAccess;
diff --git a/vala/valaunlockstatement.vala b/vala/valaunlockstatement.vala
index f862955..ff2f401 100644
--- a/vala/valaunlockstatement.vala
+++ b/vala/valaunlockstatement.vala
@@ -40,14 +40,14 @@ public class Vala.UnlockStatement : CodeNode, Statement {
 		visitor.visit_unlock_statement (this);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (checked) {
 			return !error;
 		}
 
 		checked = true;
 
-		resource.check (analyzer);
+		resource.check (context);
 
 		/* resource must be a member access and denote a Lockable */
 		if (!(resource is MemberAccess && resource.symbol_reference is Lockable)) {
@@ -58,7 +58,7 @@ public class Vala.UnlockStatement : CodeNode, Statement {
 		}
 
 		/* parent symbol must be the current class */
-		if (resource.symbol_reference.parent_symbol != analyzer.current_class) {
+		if (resource.symbol_reference.parent_symbol != context.analyzer.current_class) {
 			error = true;
 			resource.error = true;
 			Report.error (resource.source_reference, "Only members of the current class are lockable");
diff --git a/vala/valavaluetype.vala b/vala/valavaluetype.vala
index c881c1e..baec19e 100644
--- a/vala/valavaluetype.vala
+++ b/vala/valavaluetype.vala
@@ -62,7 +62,7 @@ public abstract class Vala.ValueType : DataType {
 		return false;
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
-		return type_symbol.check (analyzer);
+	public override bool check (CodeContext context) {
+		return type_symbol.check (context);
 	}
 }
diff --git a/vala/valawhilestatement.vala b/vala/valawhilestatement.vala
index 8df427d..267e35e 100644
--- a/vala/valawhilestatement.vala
+++ b/vala/valawhilestatement.vala
@@ -91,7 +91,7 @@ public class Vala.WhileStatement : CodeNode, Statement {
 		return (literal != null && !literal.value);
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		// convert to simple loop
 
 		if (always_true (condition)) {
@@ -112,7 +112,7 @@ public class Vala.WhileStatement : CodeNode, Statement {
 		var parent_block = (Block) parent_node;
 		parent_block.replace_statement (this, loop);
 
-		return loop.check (analyzer);
+		return loop.check (context);
 	}
 }
 
diff --git a/vala/valayieldstatement.vala b/vala/valayieldstatement.vala
index 0fd6e34..8b2069f 100644
--- a/vala/valayieldstatement.vala
+++ b/vala/valayieldstatement.vala
@@ -69,13 +69,13 @@ public class Vala.YieldStatement : CodeNode, Statement {
 		}
 	}
 
-	public override bool check (SemanticAnalyzer analyzer) {
+	public override bool check (CodeContext context) {
 		if (yield_expression != null) {
-			yield_expression.check (analyzer);
+			yield_expression.check (context);
 			error = yield_expression.error;
 		}
 
-		analyzer.current_method.yield_count++;
+		context.analyzer.current_method.yield_count++;
 
 		return !error;
 	}



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