Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal MethodBase()
{
}


public abstract MethodAttributes Attributes { get; }

public virtual CallingConventions CallingConvention { get { return CallingConventions.Standard; } }
Expand Down
63 changes: 4 additions & 59 deletions src/System.Private.CoreLib/src/System/Reflection/TypeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@

namespace System.Reflection
{
public abstract class TypeInfo : MemberInfo, IReflectableType
public abstract class TypeInfo : Type, IReflectableType
{
protected TypeInfo()
{
}

public abstract Assembly Assembly { get; }
public abstract String AssemblyQualifiedName { get; }
public abstract TypeAttributes Attributes { get; }
public abstract Type BaseType { get; }
public abstract bool ContainsGenericParameters { get; }
Expand Down Expand Up @@ -95,10 +94,7 @@ private IEnumerable<T> GetDeclaredMembersOfType<T>() where T : MemberInfo


public abstract MethodBase DeclaringMethod { get; }
public abstract String FullName { get; }
public abstract GenericParameterAttributes GenericParameterAttributes { get; }
public abstract int GenericParameterPosition { get; }
public abstract Type[] GenericTypeArguments { get; }

public virtual Type[] GenericTypeParameters
{
Expand All @@ -117,14 +113,6 @@ public virtual Type[] GenericTypeParameters

public abstract Guid GUID { get; }

public bool HasElementType
{
get
{
return IsArray || IsPointer || IsByRef;
}
}

public virtual IEnumerable<Type> ImplementedInterfaces
{
get
Expand All @@ -151,15 +139,6 @@ public bool IsAnsiClass
}
}

public bool IsArray
{
get
{
return AsType().IsArray;
}
}


public bool IsAutoClass
{
get
Expand All @@ -176,14 +155,6 @@ public bool IsAutoLayout
}
}

public bool IsByRef
{
get
{
return AsType().IsByRef;
}
}

public bool IsClass
{
get
Expand All @@ -204,7 +175,6 @@ public bool IsExplicitLayout
}
}

public abstract bool IsGenericParameter { get; }
public abstract bool IsGenericType { get; }
public abstract bool IsGenericTypeDefinition { get; }

Expand Down Expand Up @@ -236,14 +206,6 @@ public bool IsLayoutSequential
public bool IsMarshalByRef { get { return false; } }


public bool IsNested
{
get
{
return this.DeclaringType != null;
}
}

public bool IsNestedAssembly
{
get
Expand Down Expand Up @@ -306,14 +268,6 @@ public bool IsNotPublic
}
}

public bool IsPointer
{
get
{
return AsType().IsPointer;
}
}

public virtual bool IsPrimitive
{
get
Expand Down Expand Up @@ -407,15 +361,11 @@ public bool IsVisible
}
}

public abstract String Namespace { get; }

public virtual Type AsType()
{
throw NotImplemented.ByDesign;
}

public abstract int GetArrayRank();

public virtual EventInfo GetDeclaredEvent(String name)
{
return GetDeclaredMember<EventInfo>(name, DeclaredEvents);
Expand Down Expand Up @@ -470,9 +420,7 @@ private T GetDeclaredMember<T>(String name, IEnumerable<T> members) where T : Me
}


public abstract Type GetElementType();
public abstract Type[] GetGenericParameterConstraints();
public abstract Type GetGenericTypeDefinition();

public virtual bool IsAssignableFrom(TypeInfo typeInfo)
{
Expand Down Expand Up @@ -527,12 +475,9 @@ public virtual bool IsSubclassOf(Type c)
return false;
}


public abstract Type MakeArrayType();
public abstract Type MakeArrayType(int rank);
public abstract Type MakeByRefType();
public abstract Type MakeGenericType(params Type[] typeArguments);
public abstract Type MakePointerType();
// TODO https://github.com/dotnet/corefx/issues/9805: This is inherited from Type and shouldn't need to be redeclared on TypeInfo but
// TypeInfo.MakeGenericType is a well known method to the reducer.
public abstract override Type MakeGenericType(params Type[] typeArguments);

TypeInfo System.Reflection.IReflectableType.GetTypeInfo()
{
Expand Down
22 changes: 13 additions & 9 deletions src/System.Private.CoreLib/src/System/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System;
using System.Threading;
using System.Runtime;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
Expand All @@ -17,7 +18,7 @@

namespace System
{
public abstract class Type
public abstract class Type : MemberInfo
{
protected Type()
{
Expand All @@ -27,7 +28,6 @@ protected Type()
public static readonly Type[] EmptyTypes = Array.Empty<Type>();

public abstract String AssemblyQualifiedName { get; }
public abstract Type DeclaringType { get; }
public abstract String FullName { get; }
public abstract int GenericParameterPosition { get; }
public abstract Type[] GenericTypeArguments { get; }
Expand All @@ -40,19 +40,19 @@ public bool HasElementType
}
}

public virtual bool IsArray
public bool IsArray
{
get
{
throw NotImplemented.ByDesign;
return IsArrayImpl() ;
}
}

public virtual bool IsByRef
public bool IsByRef
{
get
{
throw NotImplemented.ByDesign;
return IsByRefImpl();
}
}

Expand All @@ -67,15 +67,14 @@ public bool IsNested
}
}

public virtual bool IsPointer
public bool IsPointer
{
get
{
throw NotImplemented.ByDesign;
return IsPointerImpl();
}
}

public abstract String Name { get; }
public abstract String Namespace { get; }

public virtual RuntimeTypeHandle TypeHandle
Expand Down Expand Up @@ -141,6 +140,10 @@ public override int GetHashCode()
throw NotImplemented.ByDesign;
}

protected abstract bool IsArrayImpl();
protected abstract bool IsByRefImpl();
protected abstract bool IsPointerImpl();

internal bool TryGetEEType(out EETypePtr eeType)
{
RuntimeTypeHandle typeHandle = RuntimeAugments.Callbacks.GetTypeHandleIfAvailable(this);
Expand All @@ -154,3 +157,4 @@ internal bool TryGetEEType(out EETypePtr eeType)
}
}
}

5 changes: 5 additions & 0 deletions src/System.Private.Interop/src/Shared/McgTypeHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ public override int GetHashCode()
{
return _fullTypeName.GetHashCode();
}

protected override bool IsArrayImpl() { throw new System.Reflection.MissingMetadataException(_fullTypeName); }
protected override bool IsByRefImpl() { throw new System.Reflection.MissingMetadataException(_fullTypeName); }
protected override bool IsPointerImpl() { throw new System.Reflection.MissingMetadataException(_fullTypeName); }

#endif //RHTESTCL
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
<Compile Include="System\Reflection\Runtime\TypeParsing\TypeName.cs" />
<Compile Include="System\Reflection\Runtime\TypeParsing\TypeLexer.cs" />
<Compile Include="System\Reflection\Runtime\TypeParsing\TypeParser.cs" />
<Compile Include="System\Reflection\Runtime\Types\RuntimeTypeTemporary.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Internal\Reflection\Core\AssemblyBinder.cs" />
Expand All @@ -128,9 +127,6 @@
<Compile Include="Internal\Reflection\Core\Execution\ReflectionCoreExecution.cs" />
<Compile Include="Internal\Reflection\Core\Execution\InvokerOptions.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Internal\Reflection\Core\NonPortable\RuntimeType.cs" />
</ItemGroup>
<ItemGroup Condition="'$(IsProjectNLibrary)' == 'true'">
<Compile Include="Internal\Reflection\Tracing\ReflectionTrace.Public.cs" />
<Compile Include="Internal\Reflection\Tracing\ReflectionTrace.Public.Events.cs" />
Expand Down
Loading