Fix comment typo
[mono.git] / mcs / mcs / context.cs
index 233acd7f171e272f9a2059e80346de0f013f7f81..921770cce7820a54293a952da7d94f83c30c18d4 100644 (file)
@@ -13,14 +13,15 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 
-#if STATIC
-using IKVM.Reflection.Emit;
-#else
-using System.Reflection.Emit;
-#endif
-
 namespace Mono.CSharp
 {
+       public enum LookupMode
+       {
+               Normal = 0,
+               Probing = 1,
+               IgnoreAccessibility = 2
+       }
+
        //
        // Implemented by elements which can act as independent contexts
        // during resolve phase. Used mostly for lookups.
@@ -48,12 +49,11 @@ namespace Mono.CSharp
                bool IsObsolete { get; }
                bool IsUnsafe { get; }
                bool IsStatic { get; }
-               bool HasUnresolvedConstraints { get; }
 
                string GetSignatureForError ();
 
-               IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceEntry scope);
-               FullNamedExpression LookupNamespaceOrType (string name, int arity, Location loc, bool ignore_cs0104);
+               ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity);
+               FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc);
                FullNamedExpression LookupNamespaceAlias (string name);
        }
 
@@ -69,18 +69,7 @@ namespace Mono.CSharp
        {
                FlowBranching current_flow_branching;
 
-               TypeSpec return_type;
-
-               /// <summary>
-               ///   The location where return has to jump to return the
-               ///   value
-               /// </summary>
-               public Label ReturnLabel;       // TODO: It's emit dependant
-
-               /// <summary>
-               ///   If we already defined the ReturnLabel
-               /// </summary>
-               public bool HasReturnLabel;
+               readonly TypeSpec return_type;
 
                public int FlowOffset;
 
@@ -110,6 +99,10 @@ namespace Mono.CSharp
                        get { return current_flow_branching; }
                }
 
+               public TypeSpec ReturnType {
+                       get { return return_type; }
+               }
+
                // <summary>
                //   Starts a new code branching.  This inherits the state of all local
                //   variables and parameters from the current branching.
@@ -160,6 +153,13 @@ namespace Mono.CSharp
                        return branching;
                }
 
+               public FlowBranchingAsync StartFlowBranching (AsyncInitializer asyncBody, FlowBranching parent)
+               {
+                       var branching = new FlowBranchingAsync (parent, asyncBody);
+                       current_flow_branching = branching;
+                       return branching;
+               }
+
                public FlowBranchingToplevel StartFlowBranching (ParametersBlock stmt, FlowBranching parent)
                {
                        FlowBranchingToplevel branching = new FlowBranchingToplevel (parent, stmt);
@@ -190,19 +190,11 @@ namespace Mono.CSharp
                        current_flow_branching = current_flow_branching.Parent;
                }
 
-               //
-               // This method is used during the Resolution phase to flag the
-               // need to define the ReturnLabel
-               //
+#if !STATIC
                public void NeedReturnLabel ()
                {
-                       if (!HasReturnLabel)
-                               HasReturnLabel = true;
-               }
-
-               public TypeSpec ReturnType {
-                       get { return return_type; }
                }
+#endif
        }
 
        //
@@ -261,6 +253,8 @@ namespace Mono.CSharp
 
                        UsingInitializerScope = 1 << 12,
 
+                       LockScope = 1 << 13,
+
                        /// <summary>
                        ///   Whether control flow analysis is enabled
                        /// </summary>
@@ -371,9 +365,9 @@ namespace Mono.CSharp
 
                #region Properties
 
-               public BuildinTypes BuildinTypes {
+               public BuiltinTypes BuiltinTypes {
                        get {
-                               return MemberContext.Module.Compiler.BuildinTypes;
+                               return MemberContext.Module.Compiler.BuiltinTypes;
                        }
                }
 
@@ -414,10 +408,6 @@ namespace Mono.CSharp
                        get { return (flags & Options.DoFlowAnalysis) != 0; }
                }
 
-               public bool HasUnresolvedConstraints {
-                       get { return false; }
-               }
-
                public bool IsInProbingMode {
                        get {
                                return (flags & Options.ProbingMode) != 0;
@@ -515,14 +505,14 @@ namespace Mono.CSharp
                        return MemberContext.GetSignatureForError ();
                }
 
-               public IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceEntry scope)
+               public ExtensionMethodCandidates LookupExtensionMethod (TypeSpec extensionType, string name, int arity)
                {
-                       return MemberContext.LookupExtensionMethod (extensionType, name, arity, ref scope);
+                       return MemberContext.LookupExtensionMethod (extensionType, name, arity);
                }
 
-               public FullNamedExpression LookupNamespaceOrType (string name, int arity, Location loc, bool ignore_cs0104)
+               public FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
                {
-                       return MemberContext.LookupNamespaceOrType (name, arity, loc, ignore_cs0104);
+                       return MemberContext.LookupNamespaceOrType (name, arity, mode, loc);
                }
 
                public FullNamedExpression LookupNamespaceAlias (string name)
@@ -581,7 +571,7 @@ namespace Mono.CSharp
                static readonly TimeReporter DisabledTimeReporter = new TimeReporter (false);
 
                readonly Report report;
-               readonly BuildinTypes buildin_types;
+               readonly BuiltinTypes builtin_types;
                readonly CompilerSettings settings;
 
                Dictionary<string, SourceFile> all_source_files;
@@ -590,15 +580,15 @@ namespace Mono.CSharp
                {
                        this.settings = settings;
                        this.report = report;
-                       this.buildin_types = new BuildinTypes ();
+                       this.builtin_types = new BuiltinTypes ();
                        this.TimeReporter = DisabledTimeReporter;
                }
 
                #region Properties
 
-               public BuildinTypes BuildinTypes {
+               public BuiltinTypes BuiltinTypes {
                        get {
-                               return buildin_types;
+                               return builtin_types;
                        }
                }
 
@@ -681,18 +671,11 @@ namespace Mono.CSharp
                        /// </summary>
                        CheckedScope = 1 << 0,
 
-                       /// <summary>
-                       ///   The constant check state is always set to `true' and cant be changed
-                       ///   from the command line.  The source code can change this setting with
-                       ///   the `checked' and `unchecked' statements and expressions. 
-                       /// </summary>
-                       ConstantCheckState = 1 << 1,
-
-                       AllCheckStateFlags = CheckedScope | ConstantCheckState,
-
                        OmitDebugInfo = 1 << 2,
 
-                       ConstructorScope = 1 << 3
+                       ConstructorScope = 1 << 3,
+
+                       AsyncBody = 1 << 4
                }
 
                // utility helper for CheckExpr, UnCheckExpr, Checked and Unchecked statements
@@ -721,7 +704,7 @@ namespace Mono.CSharp
                        }
                }
 
-               Options flags;
+               protected Options flags;
 
                public bool HasSet (Options options)
                {