private static TypeDefinitionName Translate <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(Type type, IOutput output, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder)
        {
            Type parent;

            if (mdDecoder.IsNested(type, out parent))
            {
                TypeDefinitionName parentDef = Translate(parent, output, mdDecoder);

                TypeDefinitionName nested = TypeDefinitionName.FromName(0, mdDecoder.IsStruct(type), parentDef, mdDecoder.Name(type));
                return(nested);
            }

            string moduleName = mdDecoder.DeclaringModuleName(type);

            if (moduleName == null)
            {
                // can't translate this as a type definition
                output.WriteLine("Can't translate type {0} as a type definition", mdDecoder.Name(type));
                throw new NotImplementedException();
            }

            Microsoft.Research.DataStructures.IIndexable <Type> formals;
            string[] args;
            if (mdDecoder.IsGeneric(type, out formals, true))
            {
                args = TranslateTypeFormals(formals, output, mdDecoder);
            }
            else
            {
                args = new string[0];
            }
            return(TypeDefinitionName.FromName(ShortAssemblyName.FromName(mdDecoder.DeclaringModuleName(type)), 0, mdDecoder.IsStruct(type), mdDecoder.Namespace(type), mdDecoder.Name(type), args));
        }
예제 #2
0
 public static TypeName AttributeName(string name)
 {
     return(TypeDefinitionName.FromName(
                AssemblyName,
                -1,
                false,
                RootNamespace,
                name + "Attribute").SelfInstantiation);
 }
예제 #3
0
 private static TypeName TypeName(string name)
 {
     SafeDebug.AssumeNotNullOrEmpty(name, "name");
     return(TypeDefinitionName.FromName(
                AssemblyName,
                -1,
                false,
                RootNamespace,
                name).SelfInstantiation);
 }
예제 #4
0
        static TypeName MakeTypeName(string name, string @namespace = null, ShortAssemblyName assembly = null)
        {
            SafeDebug.AssumeNotNullOrEmpty(name, "name");

            return(TypeDefinitionName.FromName(assembly ?? Assembly_XunitCore, -1, false, @namespace ?? Namespace_Xunit, name).SelfInstantiation);
        }