diff options
author | Ben Adams <thundercat@illyriad.co.uk> | 2019-01-06 05:25:02 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-01-05 20:25:02 -0800 |
commit | c239af7f3cfe1a62137a1c24a4228a69dd2df654 (patch) | |
tree | ab4d70d8f0f07efe6c9c43a3016ae52d783c7c57 /src | |
parent | dda6df6ceaf0785c7bfd52fce3084b7f157c9588 (diff) | |
download | coreclr-c239af7f3cfe1a62137a1c24a4228a69dd2df654.tar.gz coreclr-c239af7f3cfe1a62137a1c24a4228a69dd2df654.tar.bz2 coreclr-c239af7f3cfe1a62137a1c24a4228a69dd2df654.zip |
Remove redundant casts in TypeBuilder.CreateTypeNoLock (#21824)
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs index 1c063ac0c1..7b96786a4b 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs @@ -2033,17 +2033,19 @@ namespace System.Reflection.Emit { // Check for global typebuilder if (((m_tdType.Token & 0x00FFFFFF) != 0) && ((tkParent & 0x00FFFFFF) != 0)) + { SetParentType(m_module.GetNativeHandle(), m_tdType.Token, tkParent); + } if (m_inst != null) - foreach (Type tb in m_inst) - if (tb is GenericTypeParameterBuilder) - ((GenericTypeParameterBuilder)tb).m_type.CreateType(); + { + foreach (GenericTypeParameterBuilder tb in m_inst) + { + tb.m_type.CreateType(); + } + } } - byte[] body; - MethodAttributes methodAttrs; - if (!m_isHiddenGlobalType) { // create a public default constructor if this class has no constructor. @@ -2060,11 +2062,10 @@ namespace System.Reflection.Emit { MethodBuilder meth = m_listMethods[i]; - if (meth.IsGenericMethodDefinition) meth.GetToken(); // Doubles as "CreateMethod" for MethodBuilder -- analogous to CreateType() - methodAttrs = meth.Attributes; + MethodAttributes methodAttrs = meth.Attributes; // Any of these flags in the implemenation flags is set, we will not attach the IL method body if (((meth.GetMethodImplementationFlags() & (MethodImplAttributes.CodeTypeMask | MethodImplAttributes.PreserveSig | MethodImplAttributes.Unmanaged)) != MethodImplAttributes.IL) || @@ -2073,8 +2074,7 @@ namespace System.Reflection.Emit continue; } - int sigLength; - byte[] localSig = meth.GetLocalSignature(out sigLength); + byte[] localSig = meth.GetLocalSignature(out int sigLength); // Check that they haven't declared an abstract method on a non-abstract class if (((methodAttrs & MethodAttributes.Abstract) != 0) && ((m_iAttr & TypeAttributes.Abstract) == 0)) @@ -2082,7 +2082,7 @@ namespace System.Reflection.Emit throw new InvalidOperationException(SR.InvalidOperation_BadTypeAttributesNotAbstract); } - body = meth.GetBody(); + byte[] body = meth.GetBody(); // If this is an abstract method or an interface, we don't need to set the IL. |