Browse Source

Add ISolutionSnapshot for creating compilations for multiple projects from a single consistent snapshot.

newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
b0b9942522
  1. 10
      ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs
  2. 2
      ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs
  3. 28
      ICSharpCode.NRefactory.CSharp/TypeSystem/ConstantValues.cs
  4. 4
      ICSharpCode.NRefactory.CSharp/TypeSystem/ResolvedUsingScope.cs
  5. 28
      ICSharpCode.NRefactory.CSharp/TypeSystem/TypeOrNamespaceReference.cs
  6. 3
      ICSharpCode.NRefactory.GtkDemo/.gitignore
  7. 2
      ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj
  8. 2
      ICSharpCode.NRefactory/TypeSystem/ICompilation.cs
  9. 12
      ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs
  10. 33
      ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs
  11. 329
      ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractMember.cs
  12. 48
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultSolutionSnapshot.cs
  13. 2
      ICSharpCode.NRefactory/TypeSystem/Implementation/MinimalCorlib.cs
  14. 25
      ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs

10
ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs

@ -89,7 +89,15 @@ namespace ICSharpCode.NRefactory.CSharp @@ -89,7 +89,15 @@ namespace ICSharpCode.NRefactory.CSharp
public ICompilation CreateCompilation()
{
return new SimpleCompilation(this, assemblyReferences);
var solutionSnapshot = new DefaultSolutionSnapshot();
ICompilation compilation = new SimpleCompilation(solutionSnapshot, this, assemblyReferences);
solutionSnapshot.AddCompilation(this, compilation);
return compilation;
}
public ICompilation CreateCompilation(ISolutionSnapshot solutionSnapshot)
{
return new SimpleCompilation(solutionSnapshot, this, assemblyReferences);
}
public IProjectContent SetAssemblyName(string newAssemblyName)

2
ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs

@ -122,7 +122,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver @@ -122,7 +122,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
}
}
public CSharpResolver GetResolverStateBefore(AstNode node)
public CSharpResolver GetResolverStateBefore(AstNode node, CancellationToken cancellationToken = default(CancellationToken))
{
if (node == null || node.IsNull)
throw new ArgumentNullException("node");

28
ICSharpCode.NRefactory.CSharp/TypeSystem/ConstantValues.cs

@ -38,13 +38,33 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem.ConstantValues @@ -38,13 +38,33 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem.ConstantValues
public ResolveResult Resolve(ITypeResolveContext context)
{
var csContext = (CSharpTypeResolveContext)context;
if (context.CurrentAssembly != context.Compilation.MainAssembly) {
// The constant needs to be resolved in a different compilation.
throw new NotImplementedException();
} else {
// Resolve in current context.
return Resolve(new CSharpResolver((CSharpTypeResolveContext)context));
IProjectContent pc = context.CurrentAssembly as IProjectContent;
if (pc != null) {
ICompilation nestedCompilation = context.Compilation.SolutionSnapshot.GetCompilation(pc);
if (nestedCompilation != null) {
var nestedContext = MapToNestedCompilation(csContext, nestedCompilation);
ResolveResult rr = Resolve(new CSharpResolver(nestedContext));
return MapToNewContext(rr, context);
}
}
}
// Resolve in current context.
return Resolve(new CSharpResolver(csContext));
}
CSharpTypeResolveContext MapToNestedCompilation(CSharpTypeResolveContext context, ICompilation nestedCompilation)
{
var nestedContext = new CSharpTypeResolveContext(nestedCompilation.MainAssembly);
if (context.CurrentUsingScope != null) {
nestedContext = nestedContext.WithUsingScope(context.CurrentUsingScope.UnresolvedUsingScope.Resolve(nestedCompilation));
}
if (context.CurrentTypeDefinition != null) {
nestedContext = nestedContext.WithCurrentTypeDefinition(context.CurrentTypeDefinition.ToTypeReference().Resolve(nestedContext).GetDefinition());
}
return nestedContext;
}
static ResolveResult MapToNewContext(ResolveResult rr, ITypeResolveContext newContext)

4
ICSharpCode.NRefactory.CSharp/TypeSystem/ResolvedUsingScope.cs

@ -56,6 +56,10 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem @@ -56,6 +56,10 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem
}
}
public UsingScope UnresolvedUsingScope {
get { return usingScope; }
}
INamespace @namespace;
public INamespace Namespace {

28
ICSharpCode.NRefactory.CSharp/TypeSystem/TypeOrNamespaceReference.cs

@ -54,13 +54,27 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem @@ -54,13 +54,27 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem
IType ITypeReference.Resolve(ITypeResolveContext context)
{
if (context.CurrentAssembly != context.Compilation.MainAssembly) {
// The type needs to be resolved in a different compilation.
throw new NotImplementedException();
} else {
// Resolve in current context.
return ResolveType(new CSharpResolver((CSharpTypeResolveContext)context));
}
// Strictly speaking, we might have to resolve the type in a nested compilation, similar
// to what we're doing with ConstantExpression.
// However, in almost all cases this will work correctly - if the resulting type is only available in the
// nested compilation and not in this, we wouldn't be able to map it anyways.
return ResolveType(new CSharpResolver((CSharpTypeResolveContext)context));
// A potential issue might be this scenario:
// Assembly 1:
// class A { public class Nested {} }
// Assembly 2: (references asm 1)
// class B : A {}
// Assembly 3: (references asm 1 and 2)
// class C { public B.Nested Field; }
// Assembly 4: (references asm 1 and 3, but not 2):
// uses C.Field;
// Here we would not be able to resolve 'B.Nested' in the compilation of assembly 4, as type B is missing there.
}
}
}

3
ICSharpCode.NRefactory.GtkDemo/.gitignore vendored

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
bin/
obj/

2
ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj

@ -139,6 +139,7 @@ @@ -139,6 +139,7 @@
<Compile Include="TypeSystem\Implementation\DefaultResolvedProperty.cs" />
<Compile Include="TypeSystem\Implementation\DefaultResolvedTypeDefinition.cs" />
<Compile Include="TypeSystem\Implementation\DefaultResolvedTypeParameter.cs" />
<Compile Include="TypeSystem\Implementation\DefaultSolutionSnapshot.cs" />
<Compile Include="TypeSystem\Implementation\DefaultUnresolvedAccessor.cs" />
<Compile Include="TypeSystem\Implementation\DefaultUnresolvedAssembly.cs" />
<Compile Include="TypeSystem\Implementation\DefaultUnresolvedAttribute.cs" />
@ -180,6 +181,7 @@ @@ -180,6 +181,7 @@
<Compile Include="TypeSystem\IParsedFile.cs" />
<Compile Include="TypeSystem\IProjectContent.cs" />
<Compile Include="TypeSystem\IProperty.cs" />
<Compile Include="TypeSystem\ISolutionSnapshot.cs" />
<Compile Include="TypeSystem\ISupportsInterning.cs" />
<Compile Include="TypeSystem\IType.cs" />
<Compile Include="TypeSystem\ITypeDefinition.cs" />

2
ICSharpCode.NRefactory/TypeSystem/ICompilation.cs

@ -58,6 +58,8 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -58,6 +58,8 @@ namespace ICSharpCode.NRefactory.TypeSystem
/// </summary>
StringComparer NameComparer { get; }
ISolutionSnapshot SolutionSnapshot { get; }
CacheManager CacheManager { get; }
}

12
ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs

@ -47,12 +47,18 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -47,12 +47,18 @@ namespace ICSharpCode.NRefactory.TypeSystem
/// </summary>
/// <remarks>
/// An ICompilation is immutable, it operates on a snapshot of this project.
///
/// If the project hasn't changed since the last CreateCompilation() call, the previous compilation
/// might be reused.
/// </remarks>
ICompilation CreateCompilation();
/// <summary>
/// Creates a new <see cref="ICompilation"/> that allows resolving within this project.
/// </summary>
/// <param name="solutionSnapshot">The parent solution snapshot to use for the compilation.</param>
/// <remarks>
/// An ICompilation is immutable, it operates on a snapshot of this project.
/// </remarks>
ICompilation CreateCompilation(ISolutionSnapshot solutionSnapshot);
/// <summary>
/// Changes the assembly name of this project content.
/// </summary>

33
ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.NRefactory.TypeSystem
{
/// <summary>
/// Represents a snapshot of the whole solution (multiple compilations).
/// </summary>
public interface ISolutionSnapshot
{
/// <summary>
/// Gets the compilation for the specified project.
/// </summary>
ICompilation GetCompilation(IProjectContent project);
}
}

329
ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractMember.cs

@ -1,329 +0,0 @@ @@ -1,329 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using ICSharpCode.NRefactory.Utils;
namespace ICSharpCode.NRefactory.TypeSystem.Implementation
{
/// <summary>
/// Base class for <see cref="IMember"/> implementations.
/// </summary>
[Serializable]
public abstract class AbstractMember : AbstractFreezable, IMember
{
// possible optimizations to reduce the memory usage of AbstractMember:
// - put 'bool isFrozen' into flags
// - store regions in more compact form (e.g. assume both file names are identical; use ushort for columns)
ITypeDefinition declaringTypeDefinition;
ITypeReference returnType = SharedTypes.UnknownType;
IList<IAttribute> attributes;
IList<IExplicitInterfaceImplementation> interfaceImplementations;
DomRegion region;
DomRegion bodyRegion;
string name;
// 1 byte per enum + 2 bytes for flags
Accessibility accessibility;
EntityType entityType;
[CLSCompliant(false)]
protected BitVector16 flags;
const ushort FlagSealed = 0x0001;
const ushort FlagAbstract = 0x0002;
const ushort FlagShadowing = 0x0004;
const ushort FlagSynthetic = 0x0008;
const ushort FlagVirtual = 0x0010;
const ushort FlagOverride = 0x0020;
const ushort FlagStatic = 0x0040;
const ushort FlagPartial = 0x0080;
// Flags of form 0xY000 are reserved for use in derived classes (DefaultMethod etc.)
protected override void FreezeInternal()
{
attributes = FreezeList(attributes);
interfaceImplementations = FreezeList(interfaceImplementations);
base.FreezeInternal();
}
protected AbstractMember(ITypeDefinition declaringTypeDefinition, string name, EntityType entityType)
{
if (declaringTypeDefinition == null)
throw new ArgumentNullException("declaringTypeDefinition");
if (name == null)
throw new ArgumentNullException("name");
this.declaringTypeDefinition = declaringTypeDefinition;
this.entityType = entityType;
this.name = name;
}
/// <summary>
/// Copy constructor
/// </summary>
protected AbstractMember(IMember member)
{
if (member == null)
throw new ArgumentNullException("member");
this.declaringTypeDefinition = member.DeclaringTypeDefinition;
this.returnType = member.ReturnType;
this.attributes = CopyList(member.Attributes);
this.interfaceImplementations = CopyList(member.InterfaceImplementations);
this.region = member.Region;
this.bodyRegion = member.BodyRegion;
this.name = member.Name;
this.accessibility = member.Accessibility;
this.entityType = member.EntityType;
this.IsSealed = member.IsSealed;
this.IsAbstract = member.IsAbstract;
this.IsShadowing = member.IsShadowing;
this.IsSynthetic = member.IsSynthetic;
this.IsVirtual = member.IsVirtual;
this.IsOverride = member.IsOverride;
this.IsStatic = member.IsStatic;
}
public ITypeDefinition DeclaringTypeDefinition {
get { return declaringTypeDefinition; }
}
public virtual IType DeclaringType {
get { return declaringTypeDefinition; }
}
public virtual IMember MemberDefinition {
get { return this; }
}
public ITypeReference ReturnType {
get { return returnType; }
set {
CheckBeforeMutation();
if (value == null)
throw new ArgumentNullException();
returnType = value;
}
}
public IList<IExplicitInterfaceImplementation> InterfaceImplementations {
get {
if (interfaceImplementations == null)
interfaceImplementations = new List<IExplicitInterfaceImplementation>();
return interfaceImplementations;
}
}
public bool IsVirtual {
get { return flags[FlagVirtual]; }
set {
CheckBeforeMutation();
flags[FlagVirtual] = value;
}
}
public bool IsOverride {
get { return flags[FlagOverride]; }
set {
CheckBeforeMutation();
flags[FlagOverride] = value;
}
}
public bool IsPartial {
get { return flags[FlagPartial]; }
set {
CheckBeforeMutation();
flags[FlagPartial] = value;
}
}
public bool IsOverridable {
get {
return (IsAbstract || IsVirtual || IsOverride) && !IsSealed;
}
}
public EntityType EntityType {
get { return entityType; }
set {
CheckBeforeMutation();
entityType = value;
}
}
public DomRegion Region {
get { return region; }
set {
CheckBeforeMutation();
region = value;
}
}
public DomRegion BodyRegion {
get { return bodyRegion; }
set {
CheckBeforeMutation();
bodyRegion = value;
}
}
public IList<IAttribute> Attributes {
get {
if (attributes == null)
attributes = new List<IAttribute>();
return attributes;
}
}
public virtual string Documentation {
get {
// To save memory, we don't store the documentation provider within the member,
// but simply use our declaring type definition as documentation provider.
// If that fails, we try if the project content is a documentation provider:
IDocumentationProvider provider = declaringTypeDefinition as IDocumentationProvider
?? declaringTypeDefinition.ProjectContent as IDocumentationProvider;
if (provider != null)
return provider.GetDocumentation(this);
else
return null;
}
}
public Accessibility Accessibility {
get { return accessibility; }
set {
CheckBeforeMutation();
accessibility = value;
}
}
public bool IsStatic {
get { return flags[FlagStatic]; }
set {
CheckBeforeMutation();
flags[FlagStatic] = value;
}
}
public bool IsAbstract {
get { return flags[FlagAbstract]; }
set {
CheckBeforeMutation();
flags[FlagAbstract] = value;
}
}
public bool IsSealed {
get { return flags[FlagSealed]; }
set {
CheckBeforeMutation();
flags[FlagSealed] = value;
}
}
public bool IsShadowing {
get { return flags[FlagShadowing]; }
set {
CheckBeforeMutation();
flags[FlagShadowing] = value;
}
}
public bool IsSynthetic {
get { return flags[FlagSynthetic]; }
set {
CheckBeforeMutation();
flags[FlagSynthetic] = value;
}
}
public bool IsPrivate {
get { return Accessibility == Accessibility.Private; }
}
public bool IsPublic {
get { return Accessibility == Accessibility.Public; }
}
public bool IsProtected {
get { return Accessibility == Accessibility.Protected; }
}
public bool IsInternal {
get { return Accessibility == Accessibility.Internal; }
}
public bool IsProtectedOrInternal {
get { return Accessibility == Accessibility.ProtectedOrInternal; }
}
public bool IsProtectedAndInternal {
get { return Accessibility == Accessibility.ProtectedAndInternal; }
}
public IProjectContent ProjectContent {
get { return declaringTypeDefinition.ProjectContent; }
}
public IParsedFile ParsedFile {
get { return declaringTypeDefinition.ParsedFile; }
}
public string Name {
get { return name; }
set {
CheckBeforeMutation();
if (value == null)
throw new ArgumentNullException();
name = value;
}
}
public virtual string FullName {
get {
return this.DeclaringType.FullName + "." + this.Name;
}
}
public string Namespace {
get { return declaringTypeDefinition.Namespace; }
}
public virtual string ReflectionName {
get { return this.DeclaringType.ReflectionName + "." + this.Name; }
}
public override string ToString()
{
return "[" + EntityType + " " + ReflectionName + ":" + ReturnType + "]";
}
public virtual void ApplyInterningProvider(IInterningProvider provider)
{
if (provider != null) {
returnType = provider.Intern(returnType);
attributes = provider.InternList(attributes);
interfaceImplementations = provider.InternList(interfaceImplementations);
name = provider.Intern(name);
}
}
}
}

48
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultSolutionSnapshot.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Concurrent;
namespace ICSharpCode.NRefactory.TypeSystem.Implementation
{
/// <summary>
/// Default implementation of ISolutionSnapshot.
/// </summary>
public sealed class DefaultSolutionSnapshot : ISolutionSnapshot
{
ConcurrentDictionary<IProjectContent, ICompilation> dictionary = new ConcurrentDictionary<IProjectContent, ICompilation>();
public ICompilation GetCompilation(IProjectContent project)
{
if (project == null)
throw new ArgumentNullException("project");
return dictionary.GetOrAdd(project, p => p.CreateCompilation(this));
}
public void AddCompilation(IProjectContent project, ICompilation compilation)
{
if (project == null)
throw new ArgumentNullException("project");
if (compilation == null)
throw new ArgumentNullException("compilation");
if (!dictionary.TryAdd(project, compilation))
throw new InvalidOperationException();
}
}
}

2
ICSharpCode.NRefactory/TypeSystem/Implementation/MinimalCorlib.cs

@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
public ICompilation CreateCompilation()
{
return new SimpleCompilation(this);
return new SimpleCompilation(new DefaultSolutionSnapshot(), this);
}
private MinimalCorlib() : base("corlib")

25
ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs

@ -29,6 +29,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -29,6 +29,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
/// </summary>
public class SimpleCompilation : ICompilation
{
readonly ISolutionSnapshot solutionSnapshot;
readonly ITypeResolveContext context;
readonly CacheManager cacheManager = new CacheManager();
readonly KnownTypeCache knownTypeCache;
@ -37,12 +38,29 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -37,12 +38,29 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
INamespace rootNamespace;
public SimpleCompilation(IUnresolvedAssembly mainAssembly, params IAssemblyReference[] assemblyReferences)
: this(mainAssembly, (IEnumerable<IAssemblyReference>)assemblyReferences)
: this(new DefaultSolutionSnapshot(), mainAssembly, (IEnumerable<IAssemblyReference>)assemblyReferences)
{
}
public SimpleCompilation(IUnresolvedAssembly mainAssembly, IEnumerable<IAssemblyReference> assemblyReferences)
: this(new DefaultSolutionSnapshot(), mainAssembly, assemblyReferences)
{
}
public SimpleCompilation(ISolutionSnapshot solutionSnapshot, IUnresolvedAssembly mainAssembly, params IAssemblyReference[] assemblyReferences)
: this(solutionSnapshot, mainAssembly, (IEnumerable<IAssemblyReference>)assemblyReferences)
{
}
public SimpleCompilation(ISolutionSnapshot solutionSnapshot, IUnresolvedAssembly mainAssembly, IEnumerable<IAssemblyReference> assemblyReferences)
{
if (solutionSnapshot == null)
throw new ArgumentNullException("solutionSnapshot");
if (mainAssembly == null)
throw new ArgumentNullException("mainAssembly");
if (assemblyReferences == null)
throw new ArgumentNullException("assemblyReferences");
this.solutionSnapshot = solutionSnapshot;
this.context = new SimpleTypeResolveContext(this);
this.mainAssembly = mainAssembly.Resolve(context);
List<IAssembly> referencedAssemblies = new List<IAssembly>();
@ -107,6 +125,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -107,6 +125,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
{
return null;
}
public IType FindType(KnownTypeCode typeCode)
{
return knownTypeCache.FindType(typeCode);
@ -115,5 +134,9 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -115,5 +134,9 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
public StringComparer NameComparer {
get { return StringComparer.Ordinal; }
}
public ISolutionSnapshot SolutionSnapshot {
get { return solutionSnapshot; }
}
}
}

Loading…
Cancel
Save