Beispiel #1
0
        void WriteTypeFullName(TypeReference type, GenericTypeOptions options)
        {
            if (type.DeclaringType != null)
            {
                WriteTypeFullName(type.DeclaringType, options);
                id.Append('.');
            }

            if (!string.IsNullOrEmpty(type.Namespace))
            {
                id.Append(type.Namespace);
                id.Append('.');
            }

            var name = type.Name;

            if (options.IsArgument)
            {
                var index = name.LastIndexOf('`');
                if (index > 0)
                {
                    name = name.Substring(0, index);
                }
            }

            id.Append(name);

            WriteGenericTypeParameters(type, options);
        }
Beispiel #2
0
 void WriteGenericTypeParameters(TypeReference type, GenericTypeOptions options)
 {
     if (options.IsArgument && IsGenericType(type))
     {
         id.Append('{');
         WriteList(GetGenericTypeArguments(type, options), WriteTypeSignature);
         id.Append('}');
     }
 }
Beispiel #3
0
        IList <TypeReference> GetGenericTypeArguments(TypeReference type, GenericTypeOptions options)
        {
            if (options.IsNestedType)
            {
                var typeParameterCount   = type.GenericParameters.Count;
                var typeGenericArguments = options.Arguments.Skip(options.ArgumentIndex).Take(typeParameterCount).ToList();

                options.ArgumentIndex += typeParameterCount;

                return(typeGenericArguments);
            }

            return(options.Arguments);
        }
Beispiel #4
0
        void WriteGenericInstanceTypeSignature(GenericInstanceType type)
        {
            if (type.ElementType.IsTypeSpecification())
            {
                throw new NotSupportedException();
            }

            GenericTypeOptions options = new GenericTypeOptions {
                IsArgument   = true,
                IsNestedType = type.IsNested,
                Arguments    = type.GenericArguments
            };

            WriteTypeFullName(type.ElementType, options);
        }
Beispiel #5
0
 void WriteTypeFullName(TypeReference type)
 {
     WriteTypeFullName(type, GenericTypeOptions.Empty());
 }