Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add INamespace.ContributingAssemblies.

  • Loading branch information...
commit a3534f250d709ec0d5a4f0429eb0f497392fd479 1 parent 8b026d4
@dgrunwald dgrunwald authored
View
4 ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs
@@ -290,6 +290,10 @@ select t.Value
get { return assembly.Compilation; }
}
+ IEnumerable<IAssembly> INamespace.ContributingAssemblies {
+ get { return new [] { assembly }; }
+ }
+
INamespace INamespace.GetChildNamespace(string name)
{
var nameComparer = assembly.compilation.NameComparer;
View
4 ICSharpCode.NRefactory.CSharp/TypeSystem/ResolvedUsingScope.cs
@@ -172,6 +172,10 @@ public DummyNamespace(INamespace parentNamespace, string name)
get { return EmptyList<ITypeDefinition>.Instance; }
}
+ IEnumerable<IAssembly> INamespace.ContributingAssemblies {
+ get { return EmptyList<IAssembly>.Instance; }
+ }
+
ICompilation IResolved.Compilation {
get { return parentNamespace.Compilation; }
}
View
5 ICSharpCode.NRefactory/TypeSystem/INamespace.cs
@@ -63,6 +63,11 @@ public interface INamespace : IResolved
IEnumerable<ITypeDefinition> Types { get; }
/// <summary>
+ /// Gets the assemblies that contribute types to this namespace (or to child namespaces).
+ /// </summary>
+ IEnumerable<IAssembly> ContributingAssemblies { get; }
+
+ /// <summary>
/// Gets a direct child namespace by its short name.
/// Returns null when the namespace cannot be found.
/// </summary>
View
4 ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedAssembly.cs
@@ -378,6 +378,10 @@ public NS(DefaultResolvedAssembly assembly, UnresolvedNamespace ns, INamespace p
get { return parentNamespace; }
}
+ IEnumerable<IAssembly> INamespace.ContributingAssemblies {
+ get { return new [] { assembly }; }
+ }
+
IEnumerable<INamespace> INamespace.ChildNamespaces {
get { return childNamespaces; }
}
View
5 ICSharpCode.NRefactory/TypeSystem/Implementation/MergedNamespace.cs
@@ -20,7 +20,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using System.Text;
using ICSharpCode.NRefactory.Utils;
namespace ICSharpCode.NRefactory.TypeSystem.Implementation
@@ -96,6 +95,10 @@ public MergedNamespace(INamespace parentNamespace, INamespace[] namespaces)
get { return compilation; }
}
+ public IEnumerable<IAssembly> ContributingAssemblies {
+ get { return namespaces.SelectMany(ns => ns.ContributingAssemblies); }

Shouldn't there be a Distinct() here?

@dgrunwald Owner

Each assembly only appears in one of the input namespaces. Otherwise we'd also get duplicates in INamespace.Types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
+
public IEnumerable<INamespace> ChildNamespaces {
get { return GetChildNamespaces().Values; }
}
Please sign in to comment.
Something went wrong with that request. Please try again.