Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -503,9 +503,9 @@ namespace Server
* Bleh.
*/
Type[] ifaces = active.FindInterfaces((type, obj) => (type.IsGenericType)
&& (type.GetGenericTypeDefinition() == typeof(IComparable<>))
&& (type.GetGenericArguments()[0].IsAssignableFrom(active)), null );
Type[] ifaces = active.FindInterfaces((type, obj) => type.IsGenericType
&& type.GetGenericTypeDefinition() == typeof(IComparable<>)
&& type.GetGenericArguments()[0].IsAssignableFrom(active), null );
if ( ifaces.Length > 0 )
{
@ -513,10 +513,7 @@ namespace Server
}
else
{
ifaces = active.FindInterfaces( delegate( Type type, object obj )
{
return ( type == typeof( IComparable ) );
}, null );
ifaces = active.FindInterfaces((type, obj) => type == typeof(IComparable), null );
if ( ifaces.Length > 0 )
compareTo = ifaces[0].GetMethod( "CompareTo", new[] { active } );
@ -668,7 +665,7 @@ namespace Server
if ( ( call.type.IsValueType || call.type.IsByRef ) && call.method.DeclaringType != call.type )
Generator.Emit( OpCodes.Constrained, call.type );
if ( call.method.DeclaringType.IsValueType || call.method.IsStatic )
if ( call.method.DeclaringType?.IsValueType == true || call.method.IsStatic )
Generator.Emit( OpCodes.Call, call.method );
else
Generator.Emit( OpCodes.Callvirt, call.method );