Merge some MD mcs changes
authorMarek Safar <marek.safar@gmail.com>
Mon, 12 Dec 2011 20:06:14 +0000 (20:06 +0000)
committerMarek Safar <marek.safar@gmail.com>
Mon, 12 Dec 2011 21:52:33 +0000 (21:52 +0000)
25 files changed:
mcs/mcs/anonymous.cs
mcs/mcs/assign.cs
mcs/mcs/async.cs
mcs/mcs/attribute.cs
mcs/mcs/class.cs
mcs/mcs/const.cs
mcs/mcs/cs-parser.jay
mcs/mcs/cs-tokenizer.cs
mcs/mcs/decl.cs
mcs/mcs/delegate.cs
mcs/mcs/ecore.cs
mcs/mcs/enum.cs
mcs/mcs/expression.cs
mcs/mcs/field.cs
mcs/mcs/generic.cs
mcs/mcs/iterators.cs
mcs/mcs/lambda.cs
mcs/mcs/linq.cs
mcs/mcs/literal.cs
mcs/mcs/method.cs
mcs/mcs/nullable.cs
mcs/mcs/parameter.cs
mcs/mcs/property.cs
mcs/mcs/statement.cs
mcs/mcs/support.cs

index 32de48046b768e7244c7e582fa531757fa7f6de5..dc77fe53cbcc84aa38551180c9a7f4a9d2e878fc 100644 (file)
@@ -885,7 +885,7 @@ namespace Mono.CSharp {
 
                public ParametersBlock Block;
 
-               public AnonymousMethodExpression (bool isAsync, Location loc)
+               public AnonymousMethodExpression (Location loc)
                {
                        this.loc = loc;
                        this.compatibles = new Dictionary<TypeSpec, Expression> ();
@@ -1300,6 +1300,11 @@ namespace Mono.CSharp {
 
                        target.Block = (ParametersBlock) clonectx.LookupBlock (Block);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
index b9aa689fc7a967ce988f321ce873965ca93bedac..3b2a5bcf07d662fd2e65d59d0ca0b7dfb8223bd8 100644 (file)
@@ -418,6 +418,11 @@ namespace Mono.CSharp {
                        _target.target = target.Clone (clonectx);
                        _target.source = source.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class SimpleAssign : Assign
@@ -642,6 +647,12 @@ namespace Mono.CSharp {
                        this.left = left;
                }
 
+               public Binary.Operator Operator {
+                       get {
+                               return op;
+                       }
+               }
+
                protected override Expression DoResolve (ResolveContext ec)
                {
                        right = right.Resolve (ec);
@@ -800,5 +811,10 @@ namespace Mono.CSharp {
                        ctarget.right = ctarget.source = source.Clone (clonectx);
                        ctarget.target = target.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 }
index a7856804b5e39009affb2442daa3f28ae590dcc4..6ae8027c0ab5eab7dfa1b203940eeb311d2b7d31 100644 (file)
@@ -34,6 +34,12 @@ namespace Mono.CSharp
                        this.loc = loc;
                }
 
+               public Expression Expr {
+                       get {
+                               return expr;
+                       }
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression target)
                {
                        var t = (Await) target;
@@ -102,6 +108,11 @@ namespace Mono.CSharp
                {
                        stmt.EmitStatement (ec);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        class AwaitStatement : YieldStatement<AsyncInitializer>
index c537442a9b1291e131bdaf9b60cc824d36dd4790..47996afaaaa961b0a6089f3f86153edfc9c2c3b5 100644 (file)
@@ -90,8 +90,7 @@ namespace Mono.CSharp {
                public AttributeTargets Target;
                readonly ATypeNameExpression expression;
 
-               Arguments PosArguments;
-               Arguments NamedArguments;
+               Arguments pos_args, named_args;
 
                bool resolve_error;
                bool arg_resolved;
@@ -119,8 +118,8 @@ namespace Mono.CSharp {
                {
                        this.expression = expr;
                        if (args != null) {
-                               PosArguments = args[0];
-                               NamedArguments = args[1];
+                               pos_args = args[0];
+                               named_args = args[1];
                        }
                        this.loc = loc;
                        ExplicitTarget = target;
@@ -133,6 +132,24 @@ namespace Mono.CSharp {
                        }
                }
 
+               public Arguments NamedArguments {
+                       get {
+                               return named_args;
+                       }
+               }
+
+               public Arguments PositionalArguments {
+                       get {
+                               return pos_args;
+                       }
+               }
+
+               public ATypeNameExpression TypeExpression {
+                       get {
+                               return expression;
+                       }
+               }
+
                void AddModuleCharSet (ResolveContext rc)
                {
                        const string dll_import_char_set = "CharSet";
@@ -148,7 +165,7 @@ namespace Mono.CSharp {
                        }
 
                        if (NamedArguments == null)
-                               NamedArguments = new Arguments (1);
+                               named_args = new Arguments (1);
 
                        var value = Constant.CreateConstant (rc.Module.PredefinedTypes.CharSet.TypeSpec, rc.Module.DefaultCharSet, Location);
                        NamedArguments.Add (new NamedArgument (dll_import_char_set, loc, value));
@@ -157,8 +174,8 @@ namespace Mono.CSharp {
                public Attribute Clone ()
                {
                        Attribute a = new Attribute (ExplicitTarget, expression, null, loc, nameEscaped);
-                       a.PosArguments = PosArguments;
-                       a.NamedArguments = NamedArguments;
+                       a.pos_args = pos_args;
+                       a.named_args = NamedArguments;
                        return a;
                }
 
@@ -427,14 +444,14 @@ namespace Mono.CSharp {
 
                        MethodSpec ctor;
                        // Try if the attribute is simple and has been resolved before
-                       if (PosArguments != null || !context.Module.AttributeConstructorCache.TryGetValue (Type, out ctor)) {
+                       if (pos_args != null || !context.Module.AttributeConstructorCache.TryGetValue (Type, out ctor)) {
                                rc = CreateResolveContext ();
                                ctor = ResolveConstructor (rc);
                                if (ctor == null) {
                                        return null;
                                }
 
-                               if (PosArguments == null && ctor.Parameters.IsEmpty)
+                               if (pos_args == null && ctor.Parameters.IsEmpty)
                                        context.Module.AttributeConstructorCache.Add (Type, ctor);
                        }
 
@@ -463,16 +480,16 @@ namespace Mono.CSharp {
 
                MethodSpec ResolveConstructor (ResolveContext ec)
                {
-                       if (PosArguments != null) {
+                       if (pos_args != null) {
                                bool dynamic;
-                               PosArguments.Resolve (ec, out dynamic);
+                               pos_args.Resolve (ec, out dynamic);
                                if (dynamic) {
                                        Error_AttributeArgumentIsDynamic (ec.MemberContext, loc);
                                        return null;
                                }
                        }
 
-                       return Expression.ConstructorLookup (ec, Type, ref PosArguments, loc);
+                       return Expression.ConstructorLookup (ec, Type, ref pos_args, loc);
                }
 
                bool ResolveNamedArguments (ResolveContext ec)
@@ -632,7 +649,7 @@ namespace Mono.CSharp {
                        if (resolve_error)
                                return DefaultUsageAttribute;
 
-                       AttributeUsageAttribute usage_attribute = new AttributeUsageAttribute ((AttributeTargets)((Constant) PosArguments [0].Expr).GetValue ());
+                       AttributeUsageAttribute usage_attribute = new AttributeUsageAttribute ((AttributeTargets) ((Constant) pos_args[0].Expr).GetValue ());
 
                        var field = GetNamedValue ("AllowMultiple") as BoolConstant;
                        if (field != null)
@@ -655,10 +672,10 @@ namespace Mono.CSharp {
                                // But because a lot of attribute class code must be rewritten will be better to wait...
                                Resolve ();
 
-                       if (resolve_error || PosArguments.Count != 1 || !(PosArguments [0].Expr is Constant))
+                       if (resolve_error || pos_args.Count != 1 || !(pos_args[0].Expr is Constant))
                                return null;
 
-                       return ((Constant) PosArguments [0].Expr).GetValue () as string;
+                       return ((Constant) pos_args[0].Expr).GetValue () as string;
                }
 
                /// <summary>
@@ -674,7 +691,7 @@ namespace Mono.CSharp {
                        if (resolve_error)
                                return null;
 
-                       return ((Constant) PosArguments[0].Expr).GetValue () as string;
+                       return ((Constant) pos_args[0].Expr).GetValue () as string;
                }
 
                /// <summary>
@@ -696,14 +713,14 @@ namespace Mono.CSharp {
                        if (resolve_error)
                                return null;
 
-                       if (PosArguments == null)
+                       if (pos_args == null)
                                return new ObsoleteAttribute ();
 
-                       string msg = ((Constant) PosArguments[0].Expr).GetValue () as string;
-                       if (PosArguments.Count == 1)
+                       string msg = ((Constant) pos_args[0].Expr).GetValue () as string;
+                       if (pos_args.Count == 1)
                                return new ObsoleteAttribute (msg);
 
-                       return new ObsoleteAttribute (msg, ((BoolConstant) PosArguments[1].Expr).Value);
+                       return new ObsoleteAttribute (msg, ((BoolConstant) pos_args[1].Expr).Value);
                }
 
                /// <summary>
@@ -721,7 +738,7 @@ namespace Mono.CSharp {
                        if (resolve_error)
                                return false;
 
-                       return ((BoolConstant) PosArguments[0].Expr).Value;
+                       return ((BoolConstant) pos_args[0].Expr).Value;
                }
 
                public TypeSpec GetCoClassAttributeValue ()
@@ -807,7 +824,7 @@ namespace Mono.CSharp {
 
                System.Security.Permissions.SecurityAction GetSecurityActionValue ()
                {
-                       return (SecurityAction) ((Constant) PosArguments[0].Expr).GetValue ();
+                       return (SecurityAction) ((Constant) pos_args[0].Expr).GetValue ();
                }
 
                /// <summary>
@@ -817,9 +834,9 @@ namespace Mono.CSharp {
                public void ExtractSecurityPermissionSet (MethodSpec ctor, ref SecurityType permissions)
                {
 #if STATIC
-                       object[] values = new object [PosArguments.Count];
+                       object[] values = new object[pos_args.Count];
                        for (int i = 0; i < values.Length; ++i)
-                               values [i] = ((Constant) PosArguments [i].Expr).GetValue ();
+                               values[i] = ((Constant) pos_args[i].Expr).GetValue ();
 
                        PropertyInfo[] prop;
                        object[] prop_values;
@@ -860,7 +877,7 @@ namespace Mono.CSharp {
 
                public CharSet GetCharSetValue ()
                {
-                       return (CharSet)System.Enum.Parse (typeof (CharSet), ((Constant) PosArguments [0].Expr).GetValue ().ToString ());
+                       return (CharSet) System.Enum.Parse (typeof (CharSet), ((Constant) pos_args[0].Expr).GetValue ().ToString ());
                }
 
                public bool HasField (string fieldName)
@@ -882,8 +899,8 @@ namespace Mono.CSharp {
                public bool IsInternalCall ()
                {
                        MethodImplOptions options = 0;
-                       if (PosArguments.Count == 1) {
-                               options = (MethodImplOptions) System.Enum.Parse (typeof (MethodImplOptions), ((Constant) PosArguments[0].Expr).GetValue ().ToString ());
+                       if (pos_args.Count == 1) {
+                               options = (MethodImplOptions) System.Enum.Parse (typeof (MethodImplOptions), ((Constant) pos_args[0].Expr).GetValue ().ToString ());
                        } else if (HasField ("Value")) {
                                var named = GetNamedValue ("Value");
                                options = (MethodImplOptions) System.Enum.Parse (typeof (MethodImplOptions), named.GetValue ().ToString ());
@@ -897,19 +914,19 @@ namespace Mono.CSharp {
                // 
                public bool IsExplicitLayoutKind ()
                {
-                       if (PosArguments == null || PosArguments.Count != 1)
+                       if (pos_args == null || pos_args.Count != 1)
                                return false;
 
-                       var value = (LayoutKind) System.Enum.Parse (typeof (LayoutKind), ((Constant) PosArguments[0].Expr).GetValue ().ToString ());
+                       var value = (LayoutKind) System.Enum.Parse (typeof (LayoutKind), ((Constant) pos_args[0].Expr).GetValue ().ToString ());
                        return value == LayoutKind.Explicit;
                }
 
                public Expression GetParameterDefaultValue ()
                {
-                       if (PosArguments == null)
+                       if (pos_args == null)
                                return null;
 
-                       return PosArguments[0].Expr;
+                       return pos_args[0].Expr;
                }
 
                public override bool Equals (object obj)
@@ -946,16 +963,16 @@ namespace Mono.CSharp {
                        }
 
                        byte[] cdata;
-                       if (PosArguments == null && named_values == null) {
+                       if (pos_args == null && named_values == null) {
                                cdata = AttributeEncoder.Empty;
                        } else {
                                AttributeEncoder encoder = new AttributeEncoder ();
 
-                               if (PosArguments != null) {
+                               if (pos_args != null) {
                                        var param_types = ctor.Parameters.Types;
-                                       for (int j = 0; j < PosArguments.Count; ++j) {
+                                       for (int j = 0; j < pos_args.Count; ++j) {
                                                var pt = param_types[j];
-                                               var arg_expr = PosArguments[j].Expr;
+                                               var arg_expr = pos_args[j].Expr;
                                                if (j == 0) {
                                                        if ((Type == predefined.IndexerName || Type == predefined.Conditional) && arg_expr is Constant) {
                                                                string v = ((Constant) arg_expr).GetValue () as string;
@@ -979,15 +996,15 @@ namespace Mono.CSharp {
                                                                                "System.AttributeUsage");
                                                                }
                                                        } else if (Type == predefined.MarshalAs) {
-                                                               if (PosArguments.Count == 1) {
-                                                                       var u_type = (UnmanagedType) System.Enum.Parse (typeof (UnmanagedType), ((Constant) PosArguments[0].Expr).GetValue ().ToString ());
+                                                               if (pos_args.Count == 1) {
+                                                                       var u_type = (UnmanagedType) System.Enum.Parse (typeof (UnmanagedType), ((Constant) pos_args[0].Expr).GetValue ().ToString ());
                                                                        if (u_type == UnmanagedType.ByValArray && !(Owner is FieldBase)) {
                                                                                Error_AttributeEmitError ("Specified unmanaged type is only valid on fields");
                                                                        }
                                                                }
                                                        } else if (Type == predefined.DllImport) {
-                                                               if (PosArguments.Count == 1 && PosArguments[0].Expr is Constant) {
-                                                                       var value = ((Constant) PosArguments[0].Expr).GetValue () as string;
+                                                               if (pos_args.Count == 1 && pos_args[0].Expr is Constant) {
+                                                                       var value = ((Constant) pos_args[0].Expr).GetValue () as string;
                                                                        if (string.IsNullOrEmpty (value))
                                                                                Error_AttributeEmitError ("DllName cannot be empty");
                                                                }
@@ -1050,8 +1067,8 @@ namespace Mono.CSharp {
 
                        // Here we are testing attribute arguments for array usage (error 3016)
                        if (Owner.IsClsComplianceRequired ()) {
-                               if (PosArguments != null)
-                                       PosArguments.CheckArrayAsAttribute (context.Module.Compiler);
+                               if (pos_args != null)
+                                       pos_args.CheckArrayAsAttribute (context.Module.Compiler);
                        
                                if (NamedArguments == null)
                                        return;
@@ -1062,10 +1079,10 @@ namespace Mono.CSharp {
 
                private Expression GetValue () 
                {
-                       if (PosArguments == null || PosArguments.Count < 1)
+                       if (pos_args == null || pos_args.Count < 1)
                                return null;
 
-                       return PosArguments [0].Expr;
+                       return pos_args[0].Expr;
                }
 
                public string GetString () 
index d2b4661f8f05b6e1f55965e994272bbbbf9fb9df..5b120b161c71e468d7f8dc2a07b93745d9cc7db2 100644 (file)
@@ -201,7 +201,7 @@ namespace Mono.CSharp
                // from classes from the arraylist `type_bases' 
                //
                protected TypeSpec base_type;
-               protected FullNamedExpression base_type_expr;   // TODO: It's temporary variable
+               FullNamedExpression base_type_expr;     // TODO: It's temporary variable
                protected TypeSpec[] iface_exprs;
 
                protected List<FullNamedExpression> type_bases;
@@ -249,6 +249,12 @@ namespace Mono.CSharp
 
                #region Properties
 
+               public List<FullNamedExpression> BaseTypeExpressions {
+                       get {
+                               return type_bases;
+                       }
+               }
+
                public override TypeSpec CurrentType {
                        get {
                                if (current_type == null) {
@@ -315,7 +321,10 @@ namespace Mono.CSharp
 
                #endregion
 
-               public abstract void Accept (StructuralVisitor visitor);
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
 
                public bool AddMember (MemberCore symbol)
                {
index 45e54c1047e4636cfcbb20039541f712192d9d4c..91f59671a0fe956009dc35ca9a7d11ebbb0edfba 100644 (file)
@@ -223,5 +223,10 @@ namespace Mono.CSharp {
 
                        return field.Parent.GetSignatureForError () + "." + Name;
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 }
index 5904afcc64720e66855746ce3226cca45056b686..6782e595427a2c64a1065e60e23a21739b96d12f 100644 (file)
@@ -821,6 +821,7 @@ named_attribute_argument
                --lexer.parsing_block;
                var lt = (Tokenizer.LocatedToken) $1;
                $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4);          
+               lbag.AddLocation ($$, GetLocation($2));
          }
        ;
        
@@ -835,6 +836,7 @@ named_argument
                        
                var lt = (Tokenizer.LocatedToken) $1;
                $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, arg_mod);
+               lbag.AddLocation ($$, GetLocation($2));
          }
        ;
        
@@ -2723,7 +2725,7 @@ indexer_declaration_name
        | explicit_interface THIS
          {
                lexer.parsing_generic_declaration = false;
-               $$ = new MemberName ((MemberName) $1, TypeContainer.DefaultIndexerName, null, GetLocation ($1));
+               $$ = new MemberName ((MemberName) $1, TypeContainer.DefaultIndexerName, null, GetLocation ($2));
          }
        ;
 
@@ -3050,6 +3052,7 @@ member_access
                var lt2 = (Tokenizer.LocatedToken) $2;
 
                $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
+               lbag.AddLocation ($$, GetLocation ($2));
          }
        | primary_expression DOT GENERATE_COMPLETION {
                $$ = new CompletionMemberAccess ((Expression) $1, null,GetLocation ($3));
@@ -3601,6 +3604,7 @@ unbound_type_name
                var lt2 = (Tokenizer.LocatedToken) $2;
 
                $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location);
+               lbag.AddLocation ($$, GetLocation ($2));
          }
        | unbound_type_name DOT identifier_inside_body
          {
@@ -4068,6 +4072,7 @@ lambda_expression_body_simple
          expression_or_error   // Have to close block when error occurs
          {
                Block b = end_block (lexer.Location);
+               b.IsCompilerGenerated = true;
                b.AddStatement (new ContextualReturn ((Expression) $2));
                $$ = b;
          } 
@@ -4117,7 +4122,7 @@ lambda_expression
          lambda_expression_body
          {
                $$ = end_anonymous ((ParametersBlock) $7);
-               lbag.AddLocation ($$, GetLocation ($4), GetLocation ($5));
+               lbag.AddLocation ($$, GetLocation ($1), GetLocation ($4), GetLocation ($5));
          }
        | ASYNC OPEN_PARENS_LAMBDA
          {
@@ -4131,7 +4136,7 @@ lambda_expression
          lambda_expression_body
          {
                $$ = end_anonymous ((ParametersBlock) $8);
-               lbag.AddLocation ($$, GetLocation ($1), GetLocation ($5), GetLocation ($6));
+               lbag.AddLocation ($$, GetLocation ($1), GetLocation ($2), GetLocation ($5), GetLocation ($6));
          }
        ;
 
@@ -4402,6 +4407,7 @@ type_parameter_constraints_clause
          {
                var lt = (Tokenizer.LocatedToken) $2;
                $$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List<FullNamedExpression>) $4, GetLocation ($1));
+               lbag.AddLocation ($$, GetLocation ($3));
          }
        ; 
 
@@ -4651,7 +4657,7 @@ labeled_statement
          {
                var lt = (Tokenizer.LocatedToken) $1;
                LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
-
+               lbag.AddLocation (labeled, GetLocation ($2));
                current_block.AddLabel (labeled);
                current_block.AddStatement (labeled);
          }
@@ -4926,7 +4932,7 @@ statement_expression
                ExpressionStatement s = $1 as ExpressionStatement;
                if (s == null) {
                        Expression.Error_InvalidExpressionStatement (report, GetLocation ($1));
-                       $$ = new StatementExpression (EmptyExpressionStatement.Instance);
+                       $$ = new StatementErrorExpression ($1 as Expression);
                } else {
                        $$ = new StatementExpression (s);
                }
@@ -5156,7 +5162,7 @@ for_statement_cont
          
                For f = ((For) $0);
                f.Statement = (Statement) $10;
-               lbag.AddStatement (f, current_block.StartLocation, GetLocation ($2), GetLocation ($5), GetLocation ($9));
+               lbag.AddStatement (f, current_block.StartLocation, GetLocation ($2), GetLocation ($5), GetLocation ($8));
 
                $$ = end_block (GetLocation ($2));
          }
@@ -5302,8 +5308,8 @@ goto_statement
        : GOTO identifier_inside_body SEMICOLON 
          {
                var lt = (Tokenizer.LocatedToken) $2;
-               $$ = new Goto (lt.Value, lt.Location);
-               lbag.AddStatement ($$, GetLocation ($1), GetLocation ($3));
+               $$ = new Goto (lt.Value, GetLocation ($1));
+               lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
          }
        | GOTO CASE constant_expression SEMICOLON
          {
@@ -5771,6 +5777,7 @@ select_or_group_clause
          BY expression
          {
                $$ = new Linq.GroupBy ((Linq.QueryBlock)current_block, (Expression)$3, linq_clause_blocks.Pop (), (Expression)$6, GetLocation ($1));
+               lbag.AddLocation ($$, GetLocation ($5));
                
                current_block.SetEndLocation (lexer.Location);
                current_block = current_block.Parent;
@@ -5809,6 +5816,7 @@ let_clause
                var lt = (Tokenizer.LocatedToken) $2;
                var sn = new Linq.RangeVariable (lt.Value, lt.Location);
                $$ = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)$5, GetLocation ($1));
+               lbag.AddLocation ($$, GetLocation ($3));
                
                current_block.SetEndLocation (lexer.Location);
                current_block = current_block.Parent;
@@ -5871,6 +5879,7 @@ join_clause
                if ($12 == null) {
                        into = sn;
                        $$ = new Linq.Join (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block, GetLocation ($1));
+                       lbag.AddLocation ($$, GetLocation ($3), GetLocation ($6), GetLocation ($9));
                } else {
                        //
                        // Set equals right side parent to beginning of linq query, it is not accessible therefore cannot cause name collisions
@@ -5887,6 +5896,7 @@ join_clause
                        into = new Linq.RangeVariable (lt.Value, lt.Location);
 
                        $$ = new Linq.GroupJoin (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1));   
+                       lbag.AddLocation ($$, GetLocation ($3), GetLocation ($6), GetLocation ($9), GetLocation ($12));
                }
 
                current_block = block.Parent;
@@ -6020,10 +6030,12 @@ order_by
        | expression ASCENDING
          {
                $$ = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)$1);       
+               lbag.AddLocation ($$, GetLocation ($2));
          }
        | expression DESCENDING
          {
                $$ = new Linq.OrderByDescending ((Linq.QueryBlock) current_block, (Expression)$1);      
+               lbag.AddLocation ($$, GetLocation ($2));
          }
        ;
 
@@ -6035,10 +6047,12 @@ then_by
        | expression ASCENDING
          {
                $$ = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)$1);        
+               lbag.AddLocation ($$, GetLocation ($2));
          }
        | expression DESCENDING
          {
                $$ = new Linq.ThenByDescending ((Linq.QueryBlock) current_block, (Expression)$1);       
+               lbag.AddLocation ($$, GetLocation ($2));
          }     
        ;
 
@@ -6573,12 +6587,12 @@ void start_anonymous (bool isLambda, ParametersCompiled parameters, bool isAsync
                if (lang_version <= LanguageVersion.ISO_2)
                        FeatureIsNotAvailable (loc, "lambda expressions");
 
-               current_anonymous_method = new LambdaExpression (isAsync, loc);
+               current_anonymous_method = new LambdaExpression (loc);
        } else {
                if (lang_version == LanguageVersion.ISO_1)
                        FeatureIsNotAvailable (loc, "anonymous methods");
                        
-               current_anonymous_method = new AnonymousMethodExpression (isAsync, loc);
+               current_anonymous_method = new AnonymousMethodExpression (loc);
        }
 
        async_block = isAsync;
index 5feacf5300b5b04a8e198fe159a5d04547008633..ad29970bf2492e9d7723ab393ff87f4be5cb42de 100644 (file)
@@ -146,7 +146,7 @@ namespace Mono.CSharp
                        }
                }
 
-               enum PreprocessorDirective
+               public enum PreprocessorDirective
                {
                        Invalid = 0,
 
index 8d91613059a961981826e760e136194f2d430440..e7ed4b801710988b399776c34dba5524a2c5b897 100644 (file)
@@ -116,6 +116,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public bool IsDoubleColon {
+                       get {
+                               return is_double_colon;
+                       }
+               }
+
                public bool IsGeneric {
                        get {
                                if (TypeArguments != null)
@@ -369,6 +375,11 @@ namespace Mono.CSharp {
                        cached_name = null;
                }
 
+               public virtual void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                protected bool CheckAbstractAndExtern (bool has_block)
                {
                        if (Parent.PartialContainer.Kind == MemberKind.Interface)
index 3c85175cc8b6b29ecb3f121e6896eb7bb4a4e4b6..9492103f782c952a34b28bdac6acdf681951e259 100644 (file)
@@ -81,6 +81,13 @@ namespace Mono.CSharp {
                                return parameters;
                        }
                }
+
+               public FullNamedExpression TypExpression {
+                       get {
+                               return ReturnType;
+                       }
+               }
+
                #endregion
 
                public override void Accept (StructuralVisitor visitor)
index ccb62e624beff8d2145250b07265c89db0d63989..9e821c63b99eb30f30919599a7a0a3414d958126 100644 (file)
@@ -1006,6 +1006,11 @@ namespace Mono.CSharp {
                {
                        throw new NotImplementedException ("MakeExpression for " + GetType ());
                }
+                       
+               public virtual object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -2527,6 +2532,11 @@ namespace Mono.CSharp {
                        //if (ec.CurrentBlock == null || ec.CurrentBlock.CheckInvariantMeaningInBlock (Name, e, Location))
                        return e;
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
index 4e35096daf901e1120470342f97d62d38ace3fa4..f0a4120b44f637d5d876289205db5dfd4e6a9bbe 100644 (file)
@@ -91,6 +91,12 @@ namespace Mono.CSharp {
                        Parent.MemberCache.AddMember (spec);
                        return true;
                }
+               
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
        }
 
        /// <summary>
index 4844c6fd93232849de797f991ba921308f368cb3..90d3329314998383f5e4de851812a13bd3444325 100644 (file)
@@ -110,6 +110,11 @@ namespace Mono.CSharp
                {
                        return expr.DoResolveLValue (ec, right_side);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        //
@@ -778,6 +783,12 @@ namespace Mono.CSharp
 
                        target.Expr = Expr.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
+
        }
 
        //
@@ -796,6 +807,12 @@ namespace Mono.CSharp
                        loc = l;
                }
 
+               public Expression Expr {
+                       get {
+                               return expr;
+                       }
+               }
+
                public bool IsFixed {
                        get { return true; }
                }
@@ -895,6 +912,11 @@ namespace Mono.CSharp
                        eclass = ExprClass.Variable;
                        return this;
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        /// <summary>
@@ -1002,6 +1024,18 @@ namespace Mono.CSharp
                        expr = e;
                }
 
+               public Mode UnaryMutatorMode {
+                       get {
+                               return mode;
+                       }
+               }
+               
+               public Expression Expr {
+                       get {
+                               return expr;
+                       }
+               }
+
                public override bool ContainsEmitWithAwait ()
                {
                        return expr.ContainsEmitWithAwait ();
@@ -1249,6 +1283,12 @@ namespace Mono.CSharp
 
                        target.expr = expr.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
+
        }
 
        //
@@ -1332,6 +1372,10 @@ namespace Mono.CSharp
                {
                }
 
+               protected override string OperatorName {
+                       get { return "is"; }
+               }
+
                public override Expression CreateExpressionTree (ResolveContext ec)
                {
                        Arguments args = Arguments.CreateForExpressionTree (ec, null,
@@ -1506,8 +1550,9 @@ namespace Mono.CSharp
                        return this;
                }
                
-               protected override string OperatorName {
-                       get { return "is"; }
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
                }
        }
 
@@ -1522,6 +1567,10 @@ namespace Mono.CSharp
                {
                }
 
+               protected override string OperatorName {
+                       get { return "as"; }
+               }
+
                public override Expression CreateExpressionTree (ResolveContext ec)
                {
                        Arguments args = Arguments.CreateForExpressionTree (ec, null,
@@ -1600,8 +1649,9 @@ namespace Mono.CSharp
                        return null;
                }
 
-               protected override string OperatorName {
-                       get { return "as"; }
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
                }
        }
        
@@ -1664,6 +1714,11 @@ namespace Mono.CSharp
                        target.target_type = target_type.Clone (clonectx);
                        target.expr = expr.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class ImplicitCast : ShimExpression
@@ -1706,6 +1761,12 @@ namespace Mono.CSharp
                        this.loc = loc;
                }
 
+               public Expression Expr {
+                       get {
+                               return this.expr; 
+                       }
+               }
+
                public override bool IsSideEffectFree {
                        get {
                                return true;
@@ -1772,6 +1833,11 @@ namespace Mono.CSharp
                        
                        target.expr = expr.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -2158,6 +2224,18 @@ namespace Mono.CSharp
                        }
                }
 
+               public Expression Left {
+                       get {
+                               return this.left;
+                       }
+               }
+
+               public Expression Right {
+                       get {
+                               return this.right;
+                       }
+               }
+
                #endregion
 
                /// <summary>
@@ -3973,6 +4051,12 @@ namespace Mono.CSharp
                        
                        return CreateExpressionFactoryCall (ec, method_name, args);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
+
        }
        
        //
@@ -4393,6 +4477,11 @@ namespace Mono.CSharp
 
                        return converted;
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class BooleanExpressionFalse : Unary
@@ -5136,7 +5225,7 @@ namespace Mono.CSharp
                        }
                }
                
-               public Expression Expression {
+               public Expression Exp {
                        get {
                                return expr;
                        }
@@ -5391,6 +5480,11 @@ namespace Mono.CSharp
                        return SLE.Expression.Call (instance_expr, (MethodInfo) mi.GetMetaInfo (), Arguments.MakeExpression (args, ctx));
 #endif
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
@@ -5432,6 +5526,12 @@ namespace Mono.CSharp
                        }
                }
 
+               public Expression TypeExpression {
+                       get {
+                               return RequestedType;
+                       }
+               }
+
                #endregion
 
                /// <summary>
@@ -5784,6 +5884,11 @@ namespace Mono.CSharp
                        return SLE.Expression.New ((ConstructorInfo) method.GetMetaInfo (), Arguments.MakeExpression (arguments, ctx));
 #endif
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
@@ -5819,6 +5924,12 @@ namespace Mono.CSharp
                        get { return elements.Count; }
                }
 
+               public List<Expression> Elements {
+                       get {
+                               return elements;
+                       }
+               }
+
                public Expression this [int index] {
                        get {
                                return elements [index];
@@ -5884,6 +5995,11 @@ namespace Mono.CSharp
                {
                        throw new InternalErrorException ("Missing Resolve call");
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -5959,6 +6075,24 @@ namespace Mono.CSharp
                {
                }
 
+               public ComposedTypeSpecifier Rank {
+                       get {
+                               return this.rank;
+                       }
+               }
+               
+               public FullNamedExpression TypeExpression {
+                       get {
+                               return this.requested_base_type;
+                       }
+               }
+               
+               public ArrayInitializer Initializers {
+                       get {
+                               return this.initializers;
+                       }
+               }
+
                bool CheckIndices (ResolveContext ec, ArrayInitializer probe, int idx, bool specified_dims, int child_bounds)
                {
                        if (initializers != null && bounds == null) {
@@ -6577,6 +6711,11 @@ namespace Mono.CSharp
                        if (initializers != null)
                                target.initializers = (ArrayInitializer) initializers.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        //
@@ -6916,6 +7055,11 @@ namespace Mono.CSharp
                public override void VerifyAssigned (ResolveContext rc)
                {
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -6960,6 +7104,11 @@ namespace Mono.CSharp
                {
                        ec.Emit (OpCodes.Arglist);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -6967,7 +7116,7 @@ namespace Mono.CSharp
        /// </summary>
        public class Arglist : Expression
        {
-               Arguments Arguments;
+               Arguments arguments;
 
                public Arglist (Location loc)
                        : this (null, loc)
@@ -6976,18 +7125,24 @@ namespace Mono.CSharp
 
                public Arglist (Arguments args, Location l)
                {
-                       Arguments = args;
+                       arguments = args;
                        loc = l;
                }
 
+               public Arguments Arguments {
+                       get {
+                               return arguments;
+                       }
+               }
+
                public MetaType[] ArgumentTypes {
                    get {
-                               if (Arguments == null)
+                               if (arguments == null)
                                        return MetaType.EmptyTypes;
 
-                               var retval = new MetaType[Arguments.Count];
-                       for (int i = 0; i < retval.Length; i++)
-                                       retval[i] = Arguments[i].Expr.Type.GetMetaInfo ();
+                               var retval = new MetaType[arguments.Count];
+                               for (int i = 0; i < retval.Length; i++)
+                                       retval[i] = arguments[i].Expr.Type.GetMetaInfo ();
 
                        return retval;
                    }
@@ -7008,9 +7163,9 @@ namespace Mono.CSharp
                {
                        eclass = ExprClass.Variable;
                        type = InternalType.Arglist;
-                       if (Arguments != null) {
+                       if (arguments != null) {
                                bool dynamic;   // Can be ignored as there is always only 1 overload
-                               Arguments.Resolve (ec, out dynamic);
+                               arguments.Resolve (ec, out dynamic);
                        }
 
                        return this;
@@ -7018,16 +7173,21 @@ namespace Mono.CSharp
 
                public override void Emit (EmitContext ec)
                {
-                       if (Arguments != null)
-                               Arguments.Emit (ec);
+                       if (arguments != null)
+                               arguments.Emit (ec);
                }
 
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        Arglist target = (Arglist) t;
 
-                       if (Arguments != null)
-                               target.Arguments = Arguments.Clone (clonectx);
+                       if (arguments != null)
+                               target.arguments = arguments.Clone (clonectx);
+               }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
                }
        }
 
@@ -7042,6 +7202,12 @@ namespace Mono.CSharp
                        this.loc = loc;
                }
 
+               public FullNamedExpression TypeExpression {
+                       get {
+                               return texpr;
+                       }
+               }
+
                public override bool ContainsEmitWithAwait ()
                {
                        return false;
@@ -7065,6 +7231,11 @@ namespace Mono.CSharp
                        ec.Emit (OpCodes.Refanyval, type);
                        ec.EmitLoadFromPtr (type);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class RefTypeExpr : ShimExpression
@@ -7098,6 +7269,11 @@ namespace Mono.CSharp
                        if (m != null)
                                ec.Emit (OpCodes.Call, m);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class MakeRefExpr : ShimExpression
@@ -7126,6 +7302,11 @@ namespace Mono.CSharp
                        ((IMemoryLocation) expr).AddressOf (ec, AddressOp.Load);
                        ec.Emit (OpCodes.Mkrefany, expr.Type);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -7278,6 +7459,11 @@ namespace Mono.CSharp
                        if (m != null)
                                ec.Emit (OpCodes.Call, m);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        sealed class TypeOfMethod : TypeOfMember<MethodSpec>
@@ -7412,12 +7598,12 @@ namespace Mono.CSharp
        ///   Implements the sizeof expression
        /// </summary>
        public class SizeOf : Expression {
-               readonly Expression QueriedType;
+               readonly Expression texpr;
                TypeSpec type_queried;
                
                public SizeOf (Expression queried_type, Location l)
                {
-                       this.QueriedType = queried_type;
+                       this.texpr = queried_type;
                        loc = l;
                }
 
@@ -7427,6 +7613,12 @@ namespace Mono.CSharp
                        }
                }
 
+               public Expression TypeExpression {
+                       get {
+                               return texpr;
+                       }
+               }
+
                public override bool ContainsEmitWithAwait ()
                {
                        return false;
@@ -7440,7 +7632,7 @@ namespace Mono.CSharp
 
                protected override Expression DoResolve (ResolveContext ec)
                {
-                       type_queried = QueriedType.ResolveAsType (ec);
+                       type_queried = texpr.ResolveAsType (ec);
                        if (type_queried == null)
                                return null;
 
@@ -7475,6 +7667,11 @@ namespace Mono.CSharp
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -7503,6 +7700,12 @@ namespace Mono.CSharp
                        this.alias = alias;
                }
 
+               public string Alias {
+                       get {
+                               return alias;
+                       }
+               }
+
                public override FullNamedExpression ResolveAsTypeOrNamespace (IMemberContext ec)
                {
                        if (alias == GlobalAlias) {
@@ -7563,6 +7766,11 @@ namespace Mono.CSharp
                {
                        // Nothing 
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -7991,6 +8199,11 @@ namespace Mono.CSharp
 
                        target.expr = expr.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -8058,6 +8271,11 @@ namespace Mono.CSharp
 
                        target.Expr = Expr.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -8118,6 +8336,11 @@ namespace Mono.CSharp
 
                        target.Expr = Expr.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -8254,6 +8477,11 @@ namespace Mono.CSharp
                        if (Arguments != null)
                                target.Arguments = Arguments.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -8809,6 +9037,11 @@ namespace Mono.CSharp
                        base.ResolveBase (ec);
                        type = ec.CurrentType.BaseType;
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -8878,6 +9111,11 @@ namespace Mono.CSharp
                public override void EmitSideEffect (EmitContext ec)
                {
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        sealed class EmptyAwaitExpression : EmptyExpression
@@ -8931,6 +9169,11 @@ namespace Mono.CSharp
                {
                        // Do nothing
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class ErrorExpression : EmptyExpression
@@ -8963,6 +9206,11 @@ namespace Mono.CSharp
                public override void Error_OperatorCannotBeApplied (ResolveContext rc, Location loc, string oper, TypeSpec t)
                {
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class UserCast : Expression {
@@ -9164,6 +9412,11 @@ namespace Mono.CSharp
                {
                        return left.GetSignatureForError () + spec.GetSignatureForError ();
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        class FixedBufferPtr : Expression
@@ -9277,6 +9530,18 @@ namespace Mono.CSharp
                        loc = l;
                }
 
+               public Expression TypeExpression {
+                       get {
+                               return this.t;
+                       }
+               }
+
+               public Expression CountExpression {
+                       get {
+                               return this.count;
+                       }
+               }
+
                public override bool ContainsEmitWithAwait ()
                {
                        return false;
@@ -9342,6 +9607,11 @@ namespace Mono.CSharp
                        target.count = count.Clone (clonectx);
                        target.t = t.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
@@ -9756,6 +10026,12 @@ namespace Mono.CSharp
                        this.initializers = initializers;
                }
 
+               public CollectionOrObjectInitializers Initializers {
+                       get {
+                               return initializers;
+                       }
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        base.CloneTo (clonectx, t);
@@ -9851,6 +10127,11 @@ namespace Mono.CSharp
 
                        return instance;
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class NewAnonymousType : New
@@ -9868,6 +10149,12 @@ namespace Mono.CSharp
                        this.parent = parent;
                }
 
+               public List<AnonymousTypeParameter> Parameters {
+                       get {
+                               return this.parameters;
+                       }
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression target)
                {
                        if (parameters == null)
@@ -9959,6 +10246,11 @@ namespace Mono.CSharp
                        RequestedType = new GenericTypeExpr (anonymous_type.Definition, new TypeArguments (t_args), loc);
                        return base.DoResolve (ec);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class AnonymousTypeParameter : ShimExpression
index ec3e050205aebb17a6ada15d3b5adcf288e419f0..14998cd7965ccdb557136d12bd0239a8c876f235 100644 (file)
@@ -79,6 +79,12 @@ namespace Mono.CSharp
                        }
                }
 
+               public List<FieldDeclarator> Declarators {
+                       get {
+                               return this.declarators;
+                       }
+               }
+
                public Expression Initializer {
                        get {
                                return initializer;
@@ -595,6 +601,11 @@ namespace Mono.CSharp
                        return false;
                }
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+               
                public override bool Define ()
                {
                        if (!base.Define ())
index 086e975256655531db1545da8dee48f2438516ac..2d91f88d526b751f7c9c5d3242a31339017f1bfa 100644 (file)
@@ -88,6 +88,12 @@ namespace Mono.CSharp {
 
                #region Properties
 
+               public List<FullNamedExpression> TypeExpressions {
+                       get {
+                               return constraints;
+                       }
+               }
+
                public Location Location {
                        get {
                                return loc;
@@ -379,6 +385,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public Constraints Constraints {
+                       get {
+                               return constraints;
+                       }
+               }
+
                public IAssemblyDefinition DeclaringAssembly {
                        get     {
                                return Module.DeclaringAssembly;
@@ -1895,6 +1907,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public List<FullNamedExpression> TypeExpressions {
+                       get {
+                               return this.args;
+                       }
+               }
+
                public string GetSignatureForError()
                {
                        StringBuilder sb = new StringBuilder ();
index 07bc9b919d0c50da03e168fc9a9863bea0c38bd0..733866919adc6e8b5f739d07799caa5b5ce6714c 100644 (file)
@@ -39,6 +39,10 @@ namespace Mono.CSharp
                        loc = l;
                }
 
+               public Expression Expr {
+                       get { return this.expr; }
+               }
+               
                protected override void CloneTo (CloneContext clonectx, Statement t)
                {
                        var target = (YieldStatement<T>) t;
@@ -100,6 +104,11 @@ namespace Mono.CSharp
 
                        return true;
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class YieldBreak : ExitStatement
@@ -131,6 +140,11 @@ namespace Mono.CSharp
                {
                        iterator.EmitYieldBreak (ec, unwind_protect);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public abstract class StateMachine : AnonymousMethodStorey
index 05e42d3d3f98ad76bed4a0e0fcbb4c3c070ac560..f1cc07b195866435cc084e0af900a215caa3d28c 100644 (file)
@@ -24,13 +24,8 @@ namespace Mono.CSharp {
                //    A list of Parameters (explicitly typed parameters)
                //    An ImplicitLambdaParameter
                //
-               public LambdaExpression (bool isAsync, Location loc)
-                       : base (isAsync, loc)
-               {
-               }
-
                public LambdaExpression (Location loc)
-                       : this (false, loc)
+                       : base (loc)
                {
                }
 
@@ -129,6 +124,11 @@ namespace Mono.CSharp {
                {
                        return "lambda expression";
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        class LambdaMethod : AnonymousMethodBody
index 1198920560691c4b4e13f83ce1ec9d239f15b7f1..3616d11ab6ad4122894e6401164f21661d8efc12 100644 (file)
@@ -276,6 +276,12 @@ namespace Mono.CSharp.Linq
                        this.identifier = identifier;
                }
 
+               public RangeVariable Identifier {
+                       get {
+                               return identifier;
+                       }
+               }
+
                public FullNamedExpression IdentifierType { get; set; }
 
                protected Invocation CreateCastExpression (Expression lSide)
@@ -455,6 +461,12 @@ namespace Mono.CSharp.Linq
                        }
                }
 
+               public Expression SelectorExpression {
+                       get {
+                               return element_selector;
+                       }
+               }
+
                protected override void CreateArguments (ResolveContext ec, Parameter parameter, ref Arguments args)
                {
                        base.CreateArguments (ec, parameter, ref args);
@@ -483,6 +495,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "GroupBy"; }
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Join : SelectMany
@@ -496,6 +513,18 @@ namespace Mono.CSharp.Linq
                        this.inner_selector = innerSelector;
                }
 
+               public QueryBlock InnerSelector {
+                       get {
+                               return inner_selector;
+                       }
+               }
+               
+               public QueryBlock OuterSelector {
+                       get {
+                               return outer_selector;
+                       }
+               }
+
                protected override void CreateArguments (ResolveContext ec, Parameter parameter, ref Arguments args)
                {
                        args = new Arguments (4);
@@ -529,6 +558,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "Join"; }
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class GroupJoin : Join
@@ -550,6 +584,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "GroupJoin"; }
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Let : ARangeVariableQueryClause
@@ -568,6 +607,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "Select"; }
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Select : AQueryClause
@@ -593,6 +637,12 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "Select"; }
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
+
        }
 
        public class SelectMany : ARangeVariableQueryClause
@@ -644,6 +694,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "SelectMany"; }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Where : AQueryClause
@@ -656,6 +711,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "Where"; }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class OrderByAscending : AQueryClause
@@ -668,6 +728,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "OrderBy"; }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class OrderByDescending : AQueryClause
@@ -680,6 +745,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "OrderByDescending"; }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class ThenByAscending : OrderByAscending
@@ -692,6 +762,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "ThenBy"; }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class ThenByDescending : OrderByDescending
@@ -704,6 +779,11 @@ namespace Mono.CSharp.Linq
                protected override string MethodName {
                        get { return "ThenByDescending"; }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
index 95be95d40b36e5c38fad09782221c1da759a7dcc..bb0370914bed2af3e6603091c0f9f528910a520e 100644 (file)
@@ -95,8 +95,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class CharLiteral : CharConstant, ILiteralConstant
@@ -111,8 +116,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class IntLiteral : IntConstant, ILiteralConstant
@@ -143,8 +153,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class UIntLiteral : UIntConstant, ILiteralConstant
@@ -159,8 +174,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class LongLiteral : LongConstant, ILiteralConstant
@@ -175,8 +195,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class ULongLiteral : ULongConstant, ILiteralConstant
@@ -191,8 +216,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class FloatLiteral : FloatConstant, ILiteralConstant
@@ -207,8 +237,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class DoubleLiteral : DoubleConstant, ILiteralConstant
@@ -245,8 +280,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class DecimalLiteral : DecimalConstant, ILiteralConstant
@@ -261,8 +301,13 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class StringLiteral : StringConstant, ILiteralConstant
@@ -277,7 +322,12 @@ namespace Mono.CSharp
                }
 
 #if FULL_AST
-               char[] ILiteralConstant.ParsedValue { get; set; }
+               public char[] ParsedValue { get; set; }
 #endif
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 }
index 2c01c0335c9ed076cd7993d956eed9dabb7d624e..655efd86de3abf6e7f12e1a93df94fff1cf6b8a6 100644 (file)
@@ -899,6 +899,11 @@ namespace Mono.CSharp {
 
 #endregion
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                public static Method Create (DeclSpace parent, GenericMethod generic, FullNamedExpression returnType, Modifiers mod,
                                   MemberName name, ParametersCompiled parameters, Attributes attrs, bool hasConstraints)
                {
@@ -1564,6 +1569,11 @@ namespace Mono.CSharp {
                                        (Initializer.Arguments == null);
                }
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
                {
                        if (a.IsValidSecurityAttribute ()) {
@@ -2145,6 +2155,11 @@ namespace Mono.CSharp {
                        ModFlags |= Modifiers.PROTECTED | Modifiers.OVERRIDE;
                }
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
                {
                        if (a.Type == pa.Conditional) {
@@ -2500,6 +2515,11 @@ namespace Mono.CSharp {
                        Block = block;
                }
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
                {
                        if (a.Type == pa.Conditional) {
index 8776ceee2af6b8d7e4054dfddfd0d03df1d8e05c..0b2b21cb1687e7ec85d0aa53398c07f80654fc4d 100644 (file)
@@ -1007,6 +1007,18 @@ namespace Mono.CSharp.Nullable
                        this.right = right;
                        this.loc = loc;
                }
+
+               public Expression LeftExpression {
+                       get {
+                               return left;
+                       }
+               }
+
+               public Expression Right {
+                       get {
+                               return right;
+                       }
+               }
                
                public override Expression CreateExpressionTree (ResolveContext ec)
                {
@@ -1198,6 +1210,11 @@ namespace Mono.CSharp.Nullable
                        target.left = left.Clone (clonectx);
                        target.right = right.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        class LiftedUnaryMutator : UnaryMutator
index c707298220cecc94cd1565dccac0648040c715dd..0a5590703eab37bc977eae55e68d6031aa6455ae 100644 (file)
@@ -248,6 +248,12 @@ namespace Mono.CSharp {
 
                #region Properties
 
+               public Expression DefaultExpression {
+                       get {
+                               return default_expr;
+                       }
+               }
+
                public DefaultParameterValueExpression DefaultValue {
                        get {
                                return default_expr as DefaultParameterValueExpression;
@@ -276,6 +282,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public Modifier ParameterModifier {
+                       get {
+                               return modFlags;
+                       }
+               }
+
                public TypeSpec Type {
                        get {
                                return parameter_type;
@@ -1209,7 +1221,7 @@ namespace Mono.CSharp {
 
        //
        // Default parameter value expression. We need this wrapper to handle
-       // default parameter values of folded constants when for indexer parameters
+       // default parameter values of folded constants (e.g. indexer parameters).
        // The expression is resolved only once but applied to two methods which
        // both share reference to this expression and we ensure that resolving
        // this expression always returns same instance
@@ -1275,5 +1287,10 @@ namespace Mono.CSharp {
                                "Optional parameter expression of type `{0}' cannot be converted to parameter type `{1}'",
                                type.GetSignatureForError (), parameter_type.GetSignatureForError ());
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 }
index c736af419454fbb22dcf6c79c60e9a05a32d6f38..30b7bee235021e6841ee7720b2baa194f52a23ed 100644 (file)
@@ -733,6 +733,12 @@ namespace Mono.CSharp
                {
                }
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+               
+
                void CreateAutomaticProperty ()
                {
                        // Create backing field
@@ -852,6 +858,11 @@ namespace Mono.CSharp
                {
                }
 
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+               
                public override bool Define()
                {
                        if (!base.Define ())
@@ -988,6 +999,12 @@ namespace Mono.CSharp
 
                #region Properties
 
+               public List<FieldDeclarator> Declarators {
+                       get {
+                               return this.declarators;
+                       }
+               }
+
                bool HasBackingField {
                        get {
                                return !IsInterface && (ModFlags & Modifiers.ABSTRACT) == 0;
@@ -1011,6 +1028,12 @@ namespace Mono.CSharp
 
                #endregion
 
+               
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                public void AddDeclarator (FieldDeclarator declarator)
                {
                        if (declarators == null)
@@ -1491,6 +1514,12 @@ namespace Mono.CSharp
 
                #endregion
 
+               
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
+
                public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
                {
                        if (a.Type == pa.IndexerName) {
index 9e0af373d30372d68d1c8b1ab3bc062f209f2c55..d91b038d577504efd958e263b1e1476410d54dcb 100644 (file)
@@ -88,6 +88,11 @@ namespace Mono.CSharp {
                        ec.Report.Error (834, loc, "A lambda expression with statement body cannot be converted to an expresion tree");
                        return null;
                }
+               
+               public virtual object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public sealed class EmptyStatement : Statement
@@ -120,6 +125,11 @@ namespace Mono.CSharp {
                {
                        // nothing needed.
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        public class If : Statement {
@@ -145,6 +155,12 @@ namespace Mono.CSharp {
                        loc = l;
                }
 
+               public Expression Expr {
+                       get {
+                               return this.expr;
+                       }
+               }
+               
                public override bool Resolve (BlockContext ec)
                {
                        bool ok = true;
@@ -250,6 +266,11 @@ namespace Mono.CSharp {
                        if (FalseStatement != null)
                                target.FalseStatement = FalseStatement.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Do : Statement {
@@ -331,6 +352,11 @@ namespace Mono.CSharp {
                        target.EmbeddedStatement = EmbeddedStatement.Clone (clonectx);
                        target.expr = expr.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class While : Statement {
@@ -445,6 +471,11 @@ namespace Mono.CSharp {
                        target.expr = expr.Clone (clonectx);
                        target.Statement = Statement.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class For : Statement
@@ -594,6 +625,11 @@ namespace Mono.CSharp {
                                target.Iterator = Iterator.Clone (clonectx);
                        target.Statement = Statement.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        public class StatementExpression : Statement
@@ -606,6 +642,12 @@ namespace Mono.CSharp {
                        loc = expr.Location;
                }
 
+               public ExpressionStatement Expr {
+                       get {
+                               return this.expr;
+                       }
+               }
+               
                protected override void CloneTo (CloneContext clonectx, Statement t)
                {
                        StatementExpression target = (StatementExpression) t;
@@ -622,6 +664,11 @@ namespace Mono.CSharp {
                        expr = expr.ResolveStatement (ec);
                        return expr != null;
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class StatementErrorExpression : Statement
@@ -633,7 +680,7 @@ namespace Mono.CSharp {
                        this.expr = expr;
                }
 
-               public Expression Expression {
+               public Expression Expr {
                        get {
                                return expr;
                        }
@@ -648,6 +695,11 @@ namespace Mono.CSharp {
                {
                        throw new NotImplementedException ();
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
@@ -697,6 +749,11 @@ namespace Mono.CSharp {
                        foreach (Statement s in statements)
                                t.statements.Add (s.Clone (clonectx));
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        // A 'return' or a 'yield break'
@@ -726,25 +783,30 @@ namespace Mono.CSharp {
        /// </summary>
        public class Return : ExitStatement
        {
-               protected Expression Expr;
+               Expression expr;
 
                public Return (Expression expr, Location l)
                {
-                       Expr = expr;
+                       this.expr = expr;
                        loc = l;
                }
 
                #region Properties
-               public Expression Expression {
+
+               public Expression Expr {
                        get {
-                               return Expr;
+                               return expr;
+                       }
+                       protected set {
+                               expr = value;
                        }
                }
+
                #endregion
 
                protected override bool DoResolve (BlockContext ec)
                {
-                       if (Expr == null) {
+                       if (expr == null) {
                                if (ec.ReturnType.Kind == MemberKind.Void)
                                        return true;
 
@@ -758,7 +820,7 @@ namespace Mono.CSharp {
                                                //
                                                // Extra trick not to emit ret/leave inside awaiter body
                                                //
-                                               Expr = EmptyExpression.Null;
+                                               expr = EmptyExpression.Null;
                                                return true;
                                        }
                                }
@@ -774,7 +836,7 @@ namespace Mono.CSharp {
                                return false;
                        }
 
-                       Expr = Expr.Resolve (ec);
+                       expr = expr.Resolve (ec);
                        TypeSpec block_return_type = ec.ReturnType;
 
                        AnonymousExpression am = ec.CurrentAnonymousMethod;
@@ -792,12 +854,12 @@ namespace Mono.CSharp {
 
                                var async_block = am as AsyncInitializer;
                                if (async_block != null) {
-                                       if (Expr != null) {
+                                       if (expr != null) {
                                                var storey = (AsyncTaskStorey) am.Storey;
                                                var async_type = storey.ReturnType;
 
                                                if (async_type == null && async_block.ReturnTypeInference != null) {
-                                                       async_block.ReturnTypeInference.AddCommonTypeBound (Expr.Type);
+                                                       async_block.ReturnTypeInference.AddCommonTypeBound (expr.Type);
                                                        return true;
                                                }
 
@@ -818,20 +880,20 @@ namespace Mono.CSharp {
                                        }
                                } else {
                                        var l = am as AnonymousMethodBody;
-                                       if (l != null && l.ReturnTypeInference != null && Expr != null) {
-                                               l.ReturnTypeInference.AddCommonTypeBound (Expr.Type);
+                                       if (l != null && l.ReturnTypeInference != null && expr != null) {
+                                               l.ReturnTypeInference.AddCommonTypeBound (expr.Type);
                                                return true;
                                        }
                                }
                        }
 
-                       if (Expr == null)
+                       if (expr == null)
                                return false;
 
-                       if (Expr.Type != block_return_type) {
-                               Expr = Convert.ImplicitConversionRequired (ec, Expr, block_return_type, loc);
+                       if (expr.Type != block_return_type) {
+                               expr = Convert.ImplicitConversionRequired (ec, expr, block_return_type, loc);
 
-                               if (Expr == null) {
+                               if (expr == null) {
                                        if (am != null && block_return_type == ec.ReturnType) {
                                                ec.Report.Error (1662, loc,
                                                        "Cannot convert `{0}' to delegate type `{1}' because some of the return types in the block are not implicitly convertible to the delegate return type",
@@ -846,8 +908,8 @@ namespace Mono.CSharp {
                
                protected override void DoEmit (EmitContext ec)
                {
-                       if (Expr != null) {
-                               Expr.Emit (ec);
+                       if (expr != null) {
+                               expr.Emit (ec);
 
                                var async_body = ec.CurrentAnonymousMethod as AsyncInitializer;
                                if (async_body != null) {
@@ -883,8 +945,13 @@ namespace Mono.CSharp {
                {
                        Return target = (Return) t;
                        // It's null for simple return;
-                       if (Expr != null)
-                               target.Expr = Expr.Clone (clonectx);
+                       if (expr != null)
+                               target.expr = expr.Clone (clonectx);
+               }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
                }
        }
 
@@ -928,6 +995,11 @@ namespace Mono.CSharp {
                        Label l = label.LabelTarget (ec);
                        ec.Emit (unwind_protect ? OpCodes.Leave : OpCodes.Br, l);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class LabeledStatement : Statement {
@@ -1010,6 +1082,11 @@ namespace Mono.CSharp {
                {
                        referenced = true;
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
 
@@ -1049,6 +1126,11 @@ namespace Mono.CSharp {
                {
                        ec.Emit (OpCodes.Br, ec.Switch.DefaultLabel);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -1064,6 +1146,12 @@ namespace Mono.CSharp {
                        loc = l;
                }
 
+               public Expression Expr {
+                       get {
+                               return this.expr;
+                       }
+               }
+               
                public override bool Resolve (BlockContext ec)
                {
                        if (ec.Switch == null){
@@ -1116,6 +1204,11 @@ namespace Mono.CSharp {
 
                        target.expr = expr.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
        
        public class Throw : Statement {
@@ -1127,6 +1220,12 @@ namespace Mono.CSharp {
                        loc = l;
                }
 
+               public Expression Expr {
+                       get {
+                               return this.expr;
+                       }
+               }
+
                public override bool Resolve (BlockContext ec)
                {
                        if (expr == null) {
@@ -1167,6 +1266,11 @@ namespace Mono.CSharp {
                        if (expr != null)
                                target.expr = expr.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Break : Statement {
@@ -1194,6 +1298,11 @@ namespace Mono.CSharp {
                {
                        // nothing needed
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Continue : Statement {
@@ -1221,6 +1330,11 @@ namespace Mono.CSharp {
                {
                        // nothing needed.
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public interface ILocalVariable
@@ -1495,6 +1609,11 @@ namespace Mono.CSharp {
                                        t.AddDeclarator (new Declarator (d, d.Initializer == null ? null : d.Initializer.Clone (clonectx)));
                        }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class BlockConstantDeclaration : BlockVariableDeclaration
@@ -1529,6 +1648,11 @@ namespace Mono.CSharp {
                        li.ConstantValue = c;
                        return initializer;
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        //
@@ -1878,7 +2002,7 @@ namespace Mono.CSharp {
 
                int? resolving_init_idx;
 
-               protected Block original;
+               Block original;
 
 #if DEBUG
                static int id;
@@ -1925,6 +2049,9 @@ namespace Mono.CSharp {
                        get {
                                return original;
                        }
+                       protected set {
+                               original = value;
+                       }
                }
 
                public bool IsCompilerGenerated {
@@ -1942,6 +2069,10 @@ namespace Mono.CSharp {
                        set { flags |= Flags.Unsafe; }
                }
 
+               public List<Statement> Statements {
+                       get { return statements; }
+               }
+
                #endregion
 
                public Block CreateSwitchBlock (Location start)
@@ -2215,6 +2346,11 @@ namespace Mono.CSharp {
                        foreach (Statement s in statements)
                                target.statements.Add (s.Clone (clonectx));
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class ExplicitBlock : Block
@@ -2575,7 +2711,7 @@ namespace Mono.CSharp {
                        // Overwrite original for comparison purposes when linking cross references
                        // between anonymous methods
                        //
-                       original = source;
+                       Original = source;
                }
 
                #region Properties
@@ -2789,7 +2925,7 @@ namespace Mono.CSharp {
                        ParametersBlock pb = new ParametersBlock (this, ParametersCompiled.EmptyReadOnlyParameters, StartLocation);
                        pb.EndLocation = EndLocation;
                        pb.statements = statements;
-                       pb.original = this;
+                       pb.Original = this;
 
                        var iterator = new Iterator (pb, method, host, iterator_type, is_enumerable);
                        am_storey = new IteratorStorey (iterator);
@@ -2804,7 +2940,7 @@ namespace Mono.CSharp {
                        ParametersBlock pb = new ParametersBlock (this, ParametersCompiled.EmptyReadOnlyParameters, StartLocation);
                        pb.EndLocation = EndLocation;
                        pb.statements = statements;
-                       pb.original = this;
+                       pb.Original = this;
 
                        var block_type = host.Module.Compiler.BuiltinTypes.Void;
                        var initializer = new AsyncInitializer (pb, host, block_type);
@@ -4114,6 +4250,11 @@ namespace Mono.CSharp {
                                target.Sections.Add (ss.Clone (clonectx));
                        }
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        // A place where execution can restart in an iterator
@@ -4347,6 +4488,12 @@ namespace Mono.CSharp {
                        this.expr = expr;
                }
 
+               public Expression Expr {
+                       get {
+                               return this.expr;
+                       }
+               }
+
                public override bool Resolve (BlockContext ec)
                {
                        expr = expr.Resolve (ec);
@@ -4480,6 +4627,12 @@ namespace Mono.CSharp {
                        target.expr = expr.Clone (clonectx);
                        target.stmt = Statement.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
+
        }
 
        public class Unchecked : Statement {
@@ -4510,6 +4663,11 @@ namespace Mono.CSharp {
 
                        target.Block = clonectx.LookupBlock (Block);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Checked : Statement {
@@ -4540,6 +4698,11 @@ namespace Mono.CSharp {
 
                        target.Block = clonectx.LookupBlock (Block);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Unsafe : Statement {
@@ -4572,6 +4735,11 @@ namespace Mono.CSharp {
 
                        target.Block = clonectx.LookupBlock (Block);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        // 
@@ -4852,6 +5020,11 @@ namespace Mono.CSharp {
                        target.decl = (VariableDeclaration) decl.Clone (clonectx);
                        target.statement = statement.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Catch : Statement
@@ -4990,6 +5163,12 @@ namespace Mono.CSharp {
                        this.fini = fini;
                }
 
+               public Block Finallyblock {
+                       get {
+                               return fini;
+                       }
+               }
+
                public override bool Resolve (BlockContext ec)
                {
                        bool ok = true;
@@ -5031,6 +5210,11 @@ namespace Mono.CSharp {
                        if (fini != null)
                                target.fini = clonectx.LookupBlock (fini);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class TryCatch : ExceptionStatement
@@ -5144,6 +5328,11 @@ namespace Mono.CSharp {
                                        target.clauses.Add ((Catch) c.Clone (clonectx));
                        }
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        public class Using : TryFinallyBlock
@@ -5292,7 +5481,12 @@ namespace Mono.CSharp {
 
                                declarators = null;
                                return stmt;
-                       }
+                       }       
+
+                       public override object Accept (StructuralVisitor visitor)
+                       {
+                               return visitor.Visit (this);
+                       }       
                }
 
                VariableDeclaration decl;
@@ -5311,7 +5505,7 @@ namespace Mono.CSharp {
 
                #region Properties
 
-               public Expression Expression {
+               public Expression Expr {
                        get {
                                return decl.Variable == null ? decl.Initializer : null;
                        }
@@ -5390,6 +5584,11 @@ namespace Mono.CSharp {
                        target.decl = (VariableDeclaration) decl.Clone (clonectx);
                        target.stmt = stmt.Clone (clonectx);
                }
+
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 
        /// <summary>
@@ -5939,10 +6138,23 @@ namespace Mono.CSharp {
                        loc = l;
                }
 
+               public Expression Expr {
+                       get { return expr; }
+               }
+
                public Statement Statement {
                        get { return statement; }
                }
 
+               public Expression TypeExpression {
+                       get { return type; }
+               }
+
+               public LocalVariable Variable {
+                       get { return variable; }
+               }
+
+
                public override bool Resolve (BlockContext ec)
                {
                        expr = expr.Resolve (ec);
@@ -5991,5 +6203,10 @@ namespace Mono.CSharp {
                        target.expr = expr.Clone (clonectx);
                        target.statement = statement.Clone (clonectx);
                }
+               
+               public override object Accept (StructuralVisitor visitor)
+               {
+                       return visitor.Visit (this);
+               }
        }
 }
index 057286656b3a96ec8742cfd243346ff450b96429..b2e983f16d8d580a2d1c8ea7a93407a68da0f415 100644 (file)
@@ -36,7 +36,7 @@ namespace Mono.CSharp {
                        return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode (obj);
                }
        }
-
+#if !NET_4_0
        public class Tuple<T1, T2> : IEquatable<Tuple<T1, T2>>
        {
                public Tuple (T1 item1, T2 item2)
@@ -106,6 +106,7 @@ namespace Mono.CSharp {
                        return new Tuple<T1, T2, T3> (item1, item2, item3);
                }
        }
+#endif
 
        static class ArrayComparer
        {