]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Replace SemanticAnalyzer with CodeContext in CodeNode.check parameter
authorJürg Billeter <j@bitron.ch>
Thu, 28 Oct 2010 11:58:01 +0000 (13:58 +0200)
committerJürg Billeter <j@bitron.ch>
Thu, 28 Oct 2010 14:20:17 +0000 (16:20 +0200)
87 files changed:
vala/valaaddressofexpression.vala
vala/valaarraycreationexpression.vala
vala/valaarraytype.vala
vala/valaassignment.vala
vala/valabaseaccess.vala
vala/valabinaryexpression.vala
vala/valablock.vala
vala/valabooleanliteral.vala
vala/valacastexpression.vala
vala/valacatchclause.vala
vala/valacharacterliteral.vala
vala/valaclass.vala
vala/valacodenode.vala
vala/valaconditionalexpression.vala
vala/valaconstant.vala
vala/valaconstructor.vala
vala/valacreationmethod.vala
vala/valadeclarationstatement.vala
vala/valadelegate.vala
vala/valadelegatetype.vala
vala/valadeletestatement.vala
vala/valadestructor.vala
vala/valadostatement.vala
vala/valadynamicmethod.vala
vala/valadynamicproperty.vala
vala/valadynamicsignal.vala
vala/valaelementaccess.vala
vala/valaenum.vala
vala/valaenumvalue.vala
vala/valaerrorcode.vala
vala/valaerrordomain.vala
vala/valaerrortype.vala
vala/valaexpressionstatement.vala
vala/valafield.vala
vala/valaforeachstatement.vala
vala/valaforstatement.vala
vala/valaifstatement.vala
vala/valainitializerlist.vala
vala/valaintegerliteral.vala
vala/valainterface.vala
vala/valalambdaexpression.vala
vala/valalistliteral.vala
vala/valalocalvariable.vala
vala/valalockstatement.vala
vala/valaloop.vala
vala/valamapliteral.vala
vala/valamemberaccess.vala
vala/valamemberinitializer.vala
vala/valamethod.vala
vala/valamethodcall.vala
vala/valanamedargument.vala
vala/valanamespace.vala
vala/valanullliteral.vala
vala/valaobjectcreationexpression.vala
vala/valaobjecttype.vala
vala/valaparameter.vala
vala/valapointerindirection.vala
vala/valapointertype.vala
vala/valapostfixexpression.vala
vala/valaproperty.vala
vala/valapropertyaccessor.vala
vala/valarealliteral.vala
vala/valareferencetransferexpression.vala
vala/valaregexliteral.vala
vala/valareturnstatement.vala
vala/valasemanticanalyzer.vala
vala/valasetliteral.vala
vala/valasignal.vala
vala/valasizeofexpression.vala
vala/valasliceexpression.vala
vala/valasourcefile.vala
vala/valastringliteral.vala
vala/valastruct.vala
vala/valaswitchlabel.vala
vala/valaswitchsection.vala
vala/valaswitchstatement.vala
vala/valatemplate.vala
vala/valathrowstatement.vala
vala/valatrystatement.vala
vala/valatuple.vala
vala/valatypecheck.vala
vala/valatypeofexpression.vala
vala/valaunaryexpression.vala
vala/valaunlockstatement.vala
vala/valavaluetype.vala
vala/valawhilestatement.vala
vala/valayieldstatement.vala

index 1033ccc13f56f35f85d516cffae8df157032c502..7786cfd2ee4b48f0d53e22485b586b17e6ff3abe 100644 (file)
@@ -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;
                }
index d8d0f2c087fd81f6ef03cb08f914d75e07e7ac00..1c72d6b5cf457043fc3898b658e6b6d97518ae1c 100644 (file)
@@ -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;
                        }
index bff533383bc94bcc914c0929c295739330e8f3b8..5ed4ff68377c9df0773be639ba24cbd2e1e3d30f 100644 (file)
@@ -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 () {
index 993de9bef546b8aba178ac7cce3e41dc2391552c..2af76b7e27288297aec27bf80743a40ae3ddc468 100644 (file)
@@ -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;
index e03baf7723b31204ade9e56ed4f20f0de623bbef..8058540689289087e6a47c65e70692c0b788a3ae 100644 (file)
@@ -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;
index 307d79dc494962f2463a483cec5487d5837e167b..9c7aedc2a554732c41642a6e2516bdadabec838a 100644 (file)
@@ -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 ();
index c5b044d6a71d875724748b1349734c0c1b44e898..de8a62ab3d8fb73d6169b7daebf725c5615cd867 100644 (file)
@@ -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;
        }
index e0279447fc0fb238c67418ff7fa6ca61dd7f6c97..1a1aee86e3df87e51bf08baf2610a1b48566a00f 100644 (file)
@@ -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;
        }
index 7018992bb6db9fc4fa8d224bb22e1bd03ad84d39..1b58b2572d266f38a26eef50b68c3ff83bece7d2 100644 (file)
@@ -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
 
index b6d742eab9e877bdce7033cf085d3c68bfd08b4d..72c9d84682025d2bf40160765687b6b6b65fad0a 100644 (file)
@@ -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;
        }
index 91a302899cbc8454d1cc24be89040403ffbfa568..d38a0e6de3aea8fabe90a95abe569a865b789b11 100644 (file)
@@ -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"));
                        }
                }
 
index ffb2265ddb9963e634eeaf683ab551d2ba9a9c7d..0ba80329dfa412e0c6749c50b9c135019be24c36 100644 (file)
@@ -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;
        }
index 62508c7e6af8813653a3ff83405237d30049bbdb..b1fc30efa676772a30f10a726cf4d96119384fd5 100644 (file)
@@ -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;
        }
 
index 25c3e2786686fd6c379732975deef79066335479..c5fdfd698eca0ea0454d549dc53f490e13c8022d 100644 (file)
@@ -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);
 
index 9860c3a38a6f4b074e764706151dafe0a72516ff..974fee4241fb53ca79eabf54b7ef7acaed974d2e 100644 (file)
@@ -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;
index b3d88a67f5141c7f2bd2c6beb1aa3286dde9fdaf..05a86711c6ddd7c2ea0bc57500c6cb0f15419511 100644 (file)
@@ -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;
        }
index 22c243d0f8d288cd3c9e5f04586a0703b52fcdca..7958ec65b9f564c2af2c00dc3560c640411e1d7b 100644 (file)
@@ -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 ()));
index 51d80fc00f76e1ce0c2cc1504242e880d7294636..9eb8fffd6630e0ccb0b60f19b6bef7077ce9428c 100644 (file)
@@ -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) {
index 82ddc689977b5298c872f8d083e9a7d57caf6e15..00d9b39be36000031140228e206907e4fb48417b 100644 (file)
@@ -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;
        }
index a355d7986badc6b2f4e204143e87041298b41de0..c5f2ec8e0281b0b2d69e81b5a37ec7cfcf7a636f 100644 (file)
@@ -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 () {
index ce76bfd4262ab30d5327097edc2744ca41121d30..bb8da392297f2eca78ab5c2122c6f0ef3b382121 100644 (file)
@@ -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;
                }
index 0ab2a74e174b719d577eb941897c0d433d77075d..79b93b5b7885af95b367269211274c8cfb4242ff 100644 (file)
@@ -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;
        }
index fa64f1feeeb115be7ddff88396403451ae99099d..6bf72c0c71f7a1a8702ce3ebf5d591dbf7dd0377 100644 (file)
@@ -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);
        }
 }
index 361d4b2ad47c46e266d1af35795e826cb886c371..3fc98f6f6bfac5bb5dc11e1ce5804aa439485860 100644 (file)
@@ -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;
        }
 }
index 7155965a5a6e95a66324b27215e075f1e5cfc82a..dc9acb568c23a2f1b8558dd35004d1ce6b1c5b55 100644 (file)
@@ -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;
        }
 }
index dc1757eb4557ae43526f5ebbe03ecf311b1f7a75..c3cae8b0691f4375cfc0ae706af117ce1502e961 100644 (file)
@@ -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;
        }
 }
index 1b60c6b07b9620a31a6b766fd41557de431e5092..96ae50860c1170e9bacd3a03185ba19c62e2e82a 100644 (file)
@@ -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);
                                }
                        }
 
index 170d7e24e0db84887bc13feec1b9b25786374e01..f5fca292f68d6e3c4f07afd71f3baa56524a1eea 100644 (file)
@@ -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;
        }
index 973bc554e2eb3734462e32a1d6cf34ee62f2431e..4a04b85698a477cc61ca8c7bd7dab44de2adae3a 100644 (file)
@@ -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;
index 24d7f60ecb838afd288a4b91045154c8677fe718..4102feda01a104771974411bff8fe2e2b51a54c8 100644 (file)
@@ -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;
index 40274f2f0ee53fc2f4688a6a7f00b27425e546db..a17e4f84d846181bde15f65fada4bb896e910c11 100644 (file)
@@ -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;
index f0e9ab219e6e45b5d2ab321fa3d2a99cab93d61d..33f5e41fe4fdeed5ec10610379e9f221c012b031 100644 (file)
@@ -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;
        }
index c6450c01b9e2df255820700bb2e29381f4caa82d..afca3775e07814572069ef60c427cba6f8fc7dfe 100644 (file)
@@ -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;
index 1fae0fe8c42d5ee5ae3ef2f37525b9c5fcc78603..6bf48686a9443fba218e0a8847037ed0993e789b 100644 (file)
@@ -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;
        }
index 469c51e185c7310595644de9aec700d807c6c414..77d4f5603cda8cf5c9ff18a45816b0488f182bdf 100644 (file)
@@ -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));
 
index 6e8be3d908a92cb3f2970e3981a1014202232b7f..555dc623c9a3f0e0fa57bc8f8608f84a522e92e2 100644 (file)
@@ -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);
        }
 }
index 8cb1bac292f1b5bc7d0ce951dd0945e404632c44..7655ffd15d641d095d9576742dd7303abc2dc60d 100644 (file)
@@ -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;
index 5028caf27110ae8115a46241a9ba594161e60dc5..5ed9ba86fe2eaf32f17e6c56c1bb8dcbe18c15b4 100644 (file)
@@ -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;
index 35f794fabc4671717d68096223d6290f0374ce96..4a5295b303fe753f28fd5b2abcc3b0aba6a8d670 100644 (file)
@@ -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);
 
index a7aa6e8219b47f8c9af51ec4349304eed5a70e1e..f5f9d08a69b9cd9ac1fa54b400acc7e38e4a900a 100644 (file)
@@ -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;
        }
index ac702ac6dc45a5ce9d74b83a79502b1934d75691..38310334b778372a71dee04112040e636cc556e1 100644 (file)
@@ -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;
index e3c6d6de9c7af5aef72531da80c36f6e74c21401..b8759d6977ea955b327755327d95b9151356a00f 100644 (file)
@@ -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;
                        }
 
index 4ed1ec2266850acead1863d07ee8d6beae2906f0..4fd8daf9f4a75f75a8f874e0052222b056b8445b 100644 (file)
@@ -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);
                }
index 39ad4e049aa324eec63435dacafbdb293809dbae..e0d4216f91a64d259cd39a0117ebced437eb5c5d 100644 (file)
@@ -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");
index e73174d7b5d11236dab11edada1a24ba6a68d121..5782070f9c3f19ee8282218b63b8750a1190f95c 100644 (file)
@@ -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 ());
 
index 9d4fe10640c7bfb0a83750c611fe8756a19c2585..3d1170d991964bed2d40521b57666b4ff873eb23 100644 (file)
@@ -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) {
index e0295526262d197d74621d3aa4ae28a07a4a0321..e8983185b433850fd1966b6b9be648042fb1e535 100644 (file)
@@ -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);
                        }
                }
 
index afcb230e4d3a538551c691ac30fca8ff94a73a68..c5e5d8255b755ecc8063b4f0b9e5cff8d6dd1882 100644 (file)
@@ -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) {
index dcdbdeb9c982f9250f066bcc075952b2ccc18310..f8fe91633248b9e20249e3b3cdd5bf58b8a6c0de 100644 (file)
@@ -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;
                }
index 6709fc0a304a1c4b58930fae77d355c267ec01f5..ea3c556c2d602db84a2b29e0fd7be18d25d64716 100644 (file)
@@ -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);
                        }
index 6b676498282b2ec17e7d9d5a46e979d381864f00..c88e8fce7096f73595d0389ba804919875e10bc5 100644 (file)
@@ -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;
                }
index 38bf9966b5dc4fdd5d54a4662280b120ea50f749..45abd68de4e6a8fb886a9d21459f9b1d5fefd099 100644 (file)
@@ -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;
index 94be504d199a67748c8839e340d691e139aae40a..b5f95d0646be1a25cdfb248e06fdaafc3906793b 100644 (file)
@@ -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;
                }
index f95aba84d2d7b7ce575b124234877d56342f1e7f..dac7d74ef0c884ce9dece9a52ddf4d5c90ce6069 100644 (file)
@@ -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);
                        }
index ad37f62421df797f28f1a54e5f90055e17664770..42187567e17fa76ff4e85020931a9f30911676b1 100644 (file)
@@ -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;
                }
index 9d17377f68a32f8f7396cd7c3322f32c1f0cb13a..d73e25c6e4b24f32d2cc1d3a3b43f489bd38c66c 100644 (file)
@@ -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;
        }
index 17295e4a57a9ce3ab9e2274593873ff5eba4ef0e..424958bd86141dbf32d68522c7619533cbb026f4 100644 (file)
@@ -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) {
index 9d11d8d34556c7dee223595d44326b691faddad7..d7da3d866a83236b485310d31f2ef1bfafcb5910 100644 (file)
@@ -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;
        }
 }
index 57969b0d3fb9be9b24065862459c7a72bdb11532..065381ae096c83178d98a00f9ad58a11d0169d55 100644 (file)
@@ -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;
                }
index ae2d022b9f5eb619c124e4d07fe2c9dfd68c0ddc..467cdf84efbb1476718fd076f934debbdebaad2e 100644 (file)
@@ -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;
        }
index 2b5ed82cd1d5b5a4a3ae8b966eb12880d5197e6c..5579e8bd9c81bf64db31c6fa6ea10c5ec9d9f21c 100644 (file)
@@ -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;
        }
index f45560f9fe3ea9c68d5a05b215d8a8b343700592..0acfb8893ad476ce0a890bb782324af89bcb0f6c 100644 (file)
@@ -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);
 
index 945593fb79032ce96cfc81d7c94d15c4171f4a14..5e34282c3d782945013e2c5245e4cec00bc22ecd 100644 (file)
@@ -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 */
index 8e4cdc62bc5db63b1ceb0cb667201b3a060b7413..e8c9fa8110237cc737df63264766c4e111c9b09b 100644 (file)
@@ -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;
        }
index b8b2e83232b13260228f9751ba441121ba84c959..39aff8259570f419fa5cc82ed6ccee2181c2600f 100644 (file)
@@ -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 ());
index 32709cc4c3a5687087e01ae262d143afdbb1e6b4..7891bc568e0564cb714bc1e2c67e1762cb5f6db1 100644 (file)
@@ -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;
index 5ae8e94bbac87681f52866b5261b130f57a47cc7..d0f1228912e09c558aa62f96b18f46bc3a3ac8df 100644 (file)
@@ -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;
                        }
 
index 7e2a01aef7081bed53615f2d54c9fdc2b5360f3a..6530c449dd9d652bedacfd1822745fd6231abb11 100644 (file)
@@ -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);
                }
 
 
index 10643890c5571a5bd1d892fa30f79d02cd0e3ddb..01fda86c51f59bf12aadd507d8dd29d870fc622d 100644 (file)
@@ -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;
        }
index 77c574397219c856d1c0203d7110e7e5e4e1fb78..4680a1bff85e92c45fc783d6f37cd3ead6efca80 100644 (file)
@@ -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;
index 90433589b3ca28844417cf65abbc7c441eb1e6e1..931f02010385be5b2c9fb76bfb40c24df44fdd7e 100644 (file)
@@ -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;
        }
index e0234bd302d04a8130954a39e230ea6f94e6f7a9..69fc4d79b2c4c877d62787fb6ac3b29ef862a863 100644 (file)
@@ -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;
        }
index 906ce41d9b4a4560e724e6c11ef4a009f6f4c61e..cab1b820a54aae8d54150f1de8a04bfce826c5b4 100644 (file)
@@ -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;
        }
index 2a15d96c0706aff991c15355ecfdf21e222a87e1..9468b0ed38bf1767da35b98e4ed3c1acd23dd716 100644 (file)
@@ -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 ()) {
index c8faae5649e7c2434b9c254d0741a2facefcaed1..ce8180507d887eeff61523249f8140f2603c5918 100644 (file)
@@ -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;
        }
index c2066c51cedcf2234e06de5e079b4f6dc43f805f..6509d49f11fc9e31ff14f3d0187c499578ae0d29 100644 (file)
@@ -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
index c329c5ca16dfb8db6bd461998ee5088051f823dc..d11c0c87cec37d43014f853d4eb6b47759ccb6e1 100644 (file)
@@ -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);
        }
 }
 
index 444df3cd99fece04afec79130b30cdb3af7e09f6..2667db6aa2ba9752ee651ab8ba26fe03f646c12c 100644 (file)
@@ -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;
index e5d3b2e2b1456615f76c3b16e53dc67a95fa9ef0..38000f516ed221d549516f708ef8dea89c0f6e47 100644 (file)
@@ -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);
                        }
index 2fcc45d2d8624e65421bbe77e07599f43ed8ba07..852215a4e1d01ff9f6a5eabd518fe6f179fab2b0 100644 (file)
@@ -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 ());
index 9208812e5d495d56614cee2c8c1e6179018739db..749401db58c7c5e1b4729e71f51a8edc979e367e 100644 (file)
@@ -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;
        }
index d85f1867c5f539569f4a665c42292d0bd16187c4..9efb1f55cb27e870e71405fe17e0c4f45db8d04f 100644 (file)
@@ -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;
        }
index 51206c179c217fd4dd82a7745800b54b9cd34b63..661a8fb5361461b5a191ad964064303ebf7a1364 100644 (file)
@@ -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;
index f86295582726074651284f31b7d815e496f03556..ff2f401850f9e31ef6540bf83451241b2c317f6a 100644 (file)
@@ -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");
index c881c1ed7eab79de44a431f5902e0fb3e8655d08..baec19eb783ea9a8be8d74888845ab5874f95e1a 100644 (file)
@@ -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);
        }
 }
index 8df427d84bf697725cfd59a7169dd2ee345382f4..267e35ed546da0fd1d173e6adcc1044cbbc2df90 100644 (file)
@@ -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);
        }
 }
 
index 0fd6e34545a18a54354725a63c1b008c07024652..8b2069f21833f68efcfff81f05c83bd95136669d 100644 (file)
@@ -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;
        }