Browse Source

Add ICompilation.Import() extension methods.

newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
36c9caec10
  1. 2
      ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs
  2. 2
      ICSharpCode.NRefactory.VB/Properties/AssemblyInfo.cs
  3. 2
      ICSharpCode.NRefactory/Properties/AssemblyInfo.cs
  4. 38
      ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs

2
ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs

@ -28,4 +28,4 @@ using System.Runtime.InteropServices; @@ -28,4 +28,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("5.0.0.1")]
[assembly: AssemblyVersion("5.0.0.2")]

2
ICSharpCode.NRefactory.VB/Properties/AssemblyInfo.cs

@ -30,4 +30,4 @@ using System.Runtime.InteropServices; @@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.0.0.2")]

2
ICSharpCode.NRefactory/Properties/AssemblyInfo.cs

@ -29,4 +29,4 @@ using System.Runtime.InteropServices; @@ -29,4 +29,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("5.0.0.1")]
[assembly: AssemblyVersion("5.0.0.2")]

38
ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs

@ -150,6 +150,44 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -150,6 +150,44 @@ namespace ICSharpCode.NRefactory.TypeSystem
}
#endregion
#region Import
/// <summary>
/// Imports a type from another compilation.
/// </summary>
public static IType Import(this ICompilation compilation, IType type)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
if (type == null)
return null;
return type.ToTypeReference().Resolve(compilation.TypeResolveContext);
}
/// <summary>
/// Imports a type from another compilation.
/// </summary>
public static ITypeDefinition Import(this ICompilation compilation, ITypeDefinition typeDefinition)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
if (typeDefinition == null)
return null;
return typeDefinition.ToTypeReference().Resolve(compilation.TypeResolveContext).GetDefinition();
}
/// <summary>
/// Imports a member from another compilation.
/// </summary>
public static IMember Import(this ICompilation compilation, IMember member)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
if (member == null)
return null;
return member.ToMemberReference().Resolve(compilation.TypeResolveContext);
}
#endregion
#region GetDelegateInvokeMethod
/// <summary>
/// Gets the invoke method for a delegate type.

Loading…
Cancel
Save