diff options
Diffstat (limited to 'src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs index da5a56ba28..6d46362f91 100644 --- a/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs +++ b/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs @@ -4,18 +4,19 @@ // +using System; +using System.Reflection; +using System.Collections; +using System.Globalization; +using System.Diagnostics.Contracts; + namespace System.Reflection.Emit { - using System; - using System.Reflection; - using System.Collections; - using System.Globalization; - using System.Diagnostics.Contracts; - internal sealed class TypeBuilderInstantiation : TypeInfo { - public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo){ - if(typeInfo==null) return false; + public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) + { + if (typeInfo == null) return false; return IsAssignableFrom(typeInfo.AsType()); } @@ -34,9 +35,9 @@ namespace System.Reflection.Emit foreach (Type t in typeArguments) { if (t == null) - throw new ArgumentNullException(nameof(typeArguments)); + throw new ArgumentNullException(nameof(typeArguments)); } - + return new TypeBuilderInstantiation(type, typeArguments); } @@ -77,26 +78,26 @@ namespace System.Reflection.Emit #endregion #region Type Overrides - public override Type MakePointerType() - { - return SymbolType.FormCompoundType("*", this, 0); + public override Type MakePointerType() + { + return SymbolType.FormCompoundType("*", this, 0); } - public override Type MakeByRefType() + public override Type MakeByRefType() { return SymbolType.FormCompoundType("&", this, 0); } - public override Type MakeArrayType() + public override Type MakeArrayType() { return SymbolType.FormCompoundType("[]", this, 0); } - public override Type MakeArrayType(int rank) + public override Type MakeArrayType(int rank) { if (rank <= 0) throw new IndexOutOfRangeException(); Contract.EndContractBlock(); string comma = ""; - for(int i = 1; i < rank; i++) + for (int i = 1; i < rank; i++) comma += ","; string s = String.Format(CultureInfo.InvariantCulture, "[{0}]", comma); @@ -106,14 +107,14 @@ namespace System.Reflection.Emit public override Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) { throw new NotSupportedException(); } public override Assembly Assembly { get { return m_type.Assembly; } } public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } } - public override String FullName - { - get - { + public override String FullName + { + get + { if (m_strFullQualName == null) - m_strFullQualName = TypeNameBuilder.ToString(this, TypeNameBuilder.Format.FullName); + m_strFullQualName = TypeNameBuilder.ToString(this, TypeNameBuilder.Format.FullName); return m_strFullQualName; - } + } } public override String Namespace { get { return m_type.Namespace; } } public override String AssemblyQualifiedName { get { return TypeNameBuilder.ToString(this, TypeNameBuilder.Format.AssemblyQualifiedName); } } @@ -125,7 +126,7 @@ namespace System.Reflection.Emit for (int i = 0; i < instSubstituted.Length; i++) { Type t = inst[i]; - + if (t is TypeBuilderInstantiation) { instSubstituted[i] = (t as TypeBuilderInstantiation).Substitute(substitutes); @@ -147,7 +148,7 @@ namespace System.Reflection.Emit { // B<A,B,C> // D<T,S> : B<S,List<T>,char> - + // D<string,int> : B<int,List<string>,char> // D<S,T> : B<T,List<S>,char> // D<S,string> : B<string,List<S>,char> @@ -159,7 +160,7 @@ namespace System.Reflection.Emit return null; TypeBuilderInstantiation typeBldrBaseAs = typeBldrBase as TypeBuilderInstantiation; - + if (typeBldrBaseAs == null) return typeBldrBase; @@ -167,7 +168,7 @@ namespace System.Reflection.Emit } } protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } - + public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) { throw new NotSupportedException(); } protected override MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw new NotSupportedException(); } public override MethodInfo[] GetMethods(BindingFlags bindingAttr) { throw new NotSupportedException(); } @@ -187,6 +188,9 @@ namespace System.Reflection.Emit public override EventInfo[] GetEvents(BindingFlags bindingAttr) { throw new NotSupportedException(); } public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { throw new NotSupportedException(); } protected override TypeAttributes GetAttributeFlagsImpl() { return m_type.Attributes; } + + public override bool IsSZArray => false; + protected override bool IsArrayImpl() { return false; } protected override bool IsByRefImpl() { return false; } protected override bool IsPointerImpl() { return false; } @@ -217,7 +221,7 @@ namespace System.Reflection.Emit } public override MethodBase DeclaringMethod { get { return null; } } public override Type GetGenericTypeDefinition() { return m_type; } - public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericTypeDefinition")); } + public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(SR.Arg_NotGenericTypeDefinition); } public override bool IsAssignableFrom(Type c) { throw new NotSupportedException(); } [Pure] |