|
|
|
@ -73,25 +73,35 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
@@ -73,25 +73,35 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
|
|
|
|
|
public string Name { get { return name; } } |
|
|
|
|
public int TypeParameterCount { get { return typeParameterCount; } } |
|
|
|
|
|
|
|
|
|
public IType Resolve(ITypeResolveContext context) |
|
|
|
|
IType ResolveInContext(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
if (context == null) |
|
|
|
|
throw new ArgumentNullException("context"); |
|
|
|
|
|
|
|
|
|
IType type = null; |
|
|
|
|
if (assembly == null) { |
|
|
|
|
var compilation = context.Compilation; |
|
|
|
|
foreach (var asm in new[] { context.CurrentAssembly }.Concat(compilation.Assemblies)) { |
|
|
|
|
foreach (var asm in new[] { |
|
|
|
|
context.CurrentAssembly |
|
|
|
|
}.Concat (compilation.Assemblies)) { |
|
|
|
|
if (asm != null) { |
|
|
|
|
type = asm.GetTypeDefinition(nameSpace, name, typeParameterCount); |
|
|
|
|
if (type != null) |
|
|
|
|
return type; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return type; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public IType Resolve(ITypeResolveContext context) |
|
|
|
|
{ |
|
|
|
|
if (context == null) |
|
|
|
|
throw new ArgumentNullException("context"); |
|
|
|
|
IType type = null; |
|
|
|
|
if (assembly == null) { |
|
|
|
|
type = ResolveInContext(context); |
|
|
|
|
} else { |
|
|
|
|
IAssembly asm = assembly.Resolve(context); |
|
|
|
|
if (asm != null) { |
|
|
|
|
type = asm.GetTypeDefinition(nameSpace, name, typeParameterCount); |
|
|
|
|
} else { |
|
|
|
|
type = ResolveInContext(context); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return type ?? new UnknownType(nameSpace, name, typeParameterCount); |
|
|
|
|