Example #1
0
        public ITypeReference ToTypeReference()
        {
            ITypeDefinition declTypeDef = this.DeclaringTypeDefinition;

            if (declTypeDef != null)
            {
                return(new NestedTypeReference(declTypeDef.ToTypeReference(),
                                               this.Name, this.TypeParameterCount - declTypeDef.TypeParameterCount,
                                               this.IsReferenceType));
            }
            else
            {
                IAssembly          asm = this.ParentAssembly;
                IAssemblyReference asmRef;
                if (asm != null)
                {
                    asmRef = new DefaultAssemblyReference(asm.AssemblyName);
                }
                else
                {
                    asmRef = null;
                }
                return(new GetClassTypeReference(asmRef, this.Namespace, this.Name, this.TypeParameterCount, this.IsReferenceType));
            }
        }
Example #2
0
 /// <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);
     }
     if (typeDefinition.Compilation == compilation)
     {
         return(typeDefinition);
     }
     return(typeDefinition.ToTypeReference().Resolve(compilation.TypeResolveContext).GetDefinition());
 }
Example #3
0
		/// <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;
			if (typeDefinition.Compilation == compilation)
				return typeDefinition;
			return typeDefinition.ToTypeReference().Resolve(compilation.TypeResolveContext).GetDefinition();
		}
Example #4
0
 public ITypeReference ToTypeReference()
 {
     return(new ParameterizedTypeReference(genericType.ToTypeReference(), typeArguments.Select(t => t.ToTypeReference())));
 }
 /// <summary>
 /// Gets the DOM type of the type definition.
 /// </summary>
 public IType ResolveType(ITypeDefinition typeDefinition)
 {
     return typeDefinition.ToTypeReference ().Resolve (this.ProjectWrapper.Compilation);
 }