Upgrades code style - First batch (#22)

This commit is contained in:
Kamron Batman 2018-08-14 06:16:50 +08:00 committed by GitHub
parent 8ee42c8ea2
commit 632e8b4757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1834 changed files with 10245 additions and 10437 deletions

View file

@ -127,9 +127,7 @@ namespace Server
public LocalBuilder AcquireTemp( Type localType )
{
Queue<LocalBuilder> list;
if ( !m_Temps.TryGetValue( localType, out list ) )
if (!m_Temps.TryGetValue( localType, out Queue<LocalBuilder> list ))
m_Temps[localType] = list = new Queue<LocalBuilder>();
if ( list.Count > 0 )
@ -140,9 +138,7 @@ namespace Server
public void ReleaseTemp( LocalBuilder local )
{
Queue<LocalBuilder> list;
if ( !m_Temps.TryGetValue( local.LocalType, out list ) )
if (!m_Temps.TryGetValue( local.LocalType, out Queue<LocalBuilder> list ))
m_Temps[local.LocalType] = list = new Queue<LocalBuilder>();
list.Enqueue( local );
@ -504,25 +500,25 @@ namespace Server
if ( compareTo == null )
{
/* This gets a little tricky...
*
*
* There's a scenario where we might be trying to use CompareTo on an interface
* which, while it doesn't explicitly implement CompareTo itself, is said to
* extend IComparable indirectly. The implementation is implicitly passed off
* to implementers...
*
*
* interface ISomeInterface : IComparable
* {
* void SomeMethod();
* }
*
*
* class SomeClass : ISomeInterface
* {
* void SomeMethod() { ... }
* int CompareTo( object other ) { ... }
* }
*
*
* In this case, calling ISomeInterface.GetMethod( "CompareTo" ) will return null.
*
*
* Bleh.
*/
@ -555,11 +551,11 @@ namespace Server
if ( !active.IsValueType )
{
/* This object is a reference type, so we have to make it behave
*
*
* null.CompareTo( null ) = 0
* real.CompareTo( null ) = -1
* null.CompareTo( real ) = +1
*
*
*/
LocalBuilder aValue = AcquireTemp( active );
@ -724,4 +720,4 @@ namespace Server
m_Generator.Emit( OpCodes.Box, argumentType );
}
}
}
}