X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fcontext.cs;h=006c66cb60cf72a175c595df8cc7b8486bf82c41;hb=b7dc3a9663532553ea61bcaee3b41bc808617829;hp=4e02e315b4623166238974104027e8bc9b05b631;hpb=ed08cc90885fed60521bb942d05f00e0b6791060;p=mono.git
diff --git a/mcs/mcs/context.cs b/mcs/mcs/context.cs
index 4e02e315b46..006c66cb60c 100644
--- a/mcs/mcs/context.cs
+++ b/mcs/mcs/context.cs
@@ -10,7 +10,7 @@
//
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Reflection.Emit;
namespace Mono.CSharp
@@ -24,7 +24,7 @@ namespace Mono.CSharp
//
// A scope type context, it can be inflated for generic types
//
- Type CurrentType { get; }
+ TypeSpec CurrentType { get; }
//
// A scope type parameters either VAR or MVAR
@@ -32,21 +32,20 @@ namespace Mono.CSharp
TypeParameter[] CurrentTypeParameters { get; }
//
- // A type definition of the type context. For partial types definition use
+ // A member definition of the context. For partial types definition use
// CurrentTypeDefinition.PartialContainer otherwise the context is local
//
- // TODO: CurrentType.Definition
- //
- TypeContainer CurrentTypeDefinition { get; }
+ MemberCore CurrentMemberDefinition { get; }
bool IsObsolete { get; }
bool IsUnsafe { get; }
bool IsStatic { get; }
+ bool HasUnresolvedConstraints { get; }
string GetSignatureForError ();
- ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, string name, Location loc);
- FullNamedExpression LookupNamespaceOrType (string name, Location loc, bool ignore_cs0104);
+ ExtensionMethodGroupExpr LookupExtensionMethod (TypeSpec extensionType, string name, int arity, Location loc);
+ FullNamedExpression LookupNamespaceOrType (string name, int arity, Location loc, bool ignore_cs0104);
FullNamedExpression LookupNamespaceAlias (string name);
CompilerContext Compiler { get; }
@@ -61,7 +60,7 @@ namespace Mono.CSharp
public TypeInferenceContext ReturnTypeInference;
- Type return_type;
+ TypeSpec return_type;
///
/// The location where return has to jump to return the
@@ -74,7 +73,7 @@ namespace Mono.CSharp
///
public bool HasReturnLabel;
- public BlockContext (IMemberContext mc, ExplicitBlock block, Type returnType)
+ public BlockContext (IMemberContext mc, ExplicitBlock block, TypeSpec returnType)
: base (mc)
{
if (returnType == null)
@@ -180,7 +179,7 @@ namespace Mono.CSharp
HasReturnLabel = true;
}
- public Type ReturnType {
+ public TypeSpec ReturnType {
get { return return_type; }
}
}
@@ -362,7 +361,7 @@ namespace Mono.CSharp
get { return CurrentAnonymousMethod as Iterator; }
}
- public Type CurrentType {
+ public TypeSpec CurrentType {
get { return MemberContext.CurrentType; }
}
@@ -370,8 +369,8 @@ namespace Mono.CSharp
get { return MemberContext.CurrentTypeParameters; }
}
- public TypeContainer CurrentTypeDefinition {
- get { return MemberContext.CurrentTypeDefinition; }
+ public MemberCore CurrentMemberDefinition {
+ get { return MemberContext.CurrentMemberDefinition; }
}
public bool ConstantCheckState {
@@ -382,6 +381,10 @@ namespace Mono.CSharp
get { return (flags & Options.DoFlowAnalysis) != 0; }
}
+ public bool HasUnresolvedConstraints {
+ get { return false; }
+ }
+
public bool IsInProbingMode {
get { return (flags & Options.ProbingMode) != 0; }
}
@@ -473,14 +476,14 @@ namespace Mono.CSharp
get { return HasSet (Options.UnsafeScope) || MemberContext.IsUnsafe; }
}
- public ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, string name, Location loc)
+ public ExtensionMethodGroupExpr LookupExtensionMethod (TypeSpec extensionType, string name, int arity, Location loc)
{
- return MemberContext.LookupExtensionMethod (extensionType, name, loc);
+ return MemberContext.LookupExtensionMethod (extensionType, name, arity, loc);
}
- public FullNamedExpression LookupNamespaceOrType (string name, Location loc, bool ignore_cs0104)
+ public FullNamedExpression LookupNamespaceOrType (string name, int arity, Location loc, bool ignore_cs0104)
{
- return MemberContext.LookupNamespaceOrType (name, loc, ignore_cs0104);
+ return MemberContext.LookupNamespaceOrType (name, arity, loc, ignore_cs0104);
}
public FullNamedExpression LookupNamespaceAlias (string name)
@@ -501,23 +504,22 @@ namespace Mono.CSharp
//
public class CloneContext
{
- Hashtable block_map = new Hashtable ();
- Hashtable variable_map;
+ Dictionary block_map = new Dictionary ();
+ Dictionary variable_map;
public void AddBlockMap (Block from, Block to)
{
- if (block_map.Contains (from))
+ if (block_map.ContainsKey (from))
return;
block_map[from] = to;
}
public Block LookupBlock (Block from)
{
- Block result = (Block) block_map[from];
-
- if (result == null) {
+ Block result;
+ if (!block_map.TryGetValue (from, out result)) {
result = (Block) from.Clone (this);
- block_map[from] = result;
+ block_map [from] = result;
}
return result;
@@ -528,8 +530,8 @@ namespace Mono.CSharp
///
public Block RemapBlockCopy (Block from)
{
- Block mapped_to = (Block) block_map[from];
- if (mapped_to == null)
+ Block mapped_to;
+ if (!block_map.TryGetValue (from, out mapped_to))
return from;
return mapped_to;
@@ -538,21 +540,20 @@ namespace Mono.CSharp
public void AddVariableMap (LocalInfo from, LocalInfo to)
{
if (variable_map == null)
- variable_map = new Hashtable ();
-
- if (variable_map.Contains (from))
+ variable_map = new Dictionary ();
+ else if (variable_map.ContainsKey (from))
return;
+
variable_map[from] = to;
}
public LocalInfo LookupVariable (LocalInfo from)
{
- LocalInfo result = (LocalInfo) variable_map[from];
-
- if (result == null)
+ try {
+ return variable_map[from];
+ } catch (KeyNotFoundException) {
throw new Exception ("LookupVariable: looking up a variable that has not been registered yet");
-
- return result;
+ }
}
}