diff options
Diffstat (limited to 'src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs | 67 |
1 files changed, 5 insertions, 62 deletions
diff --git a/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs b/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs index ed0763bfda..2cee63ff2e 100644 --- a/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs +++ b/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs @@ -10,15 +10,11 @@ namespace System.Reflection.Emit using System.Diagnostics.SymbolStore; using System.Runtime.InteropServices; using System.Reflection; - using System.Security.Permissions; using System.Globalization; using System.Diagnostics; using System.Diagnostics.Contracts; - [ClassInterface(ClassInterfaceType.None)] - [ComDefaultInterface(typeof(_ILGenerator))] - [System.Runtime.InteropServices.ComVisible(true)] - public class ILGenerator : _ILGenerator + public class ILGenerator { #region Const Members private const int defaultSize = 16; @@ -388,20 +384,17 @@ namespace System.Reflection.Emit // Just a cheap insertion sort. We don't expect many exceptions (<10), where InsertionSort beats QuickSort. // If we have more exceptions than this in real life, we should consider moving to a QuickSort. - int least; - __ExceptionInfo temp; - int length = exceptions.Length; - for (int i =0; i < length; i++) + for (int i = 0; i < exceptions.Length; i++) { - least = i; - for (int j =i + 1; j < length; j++) + int least = i; + for (int j = i + 1; j < exceptions.Length; j++) { if (exceptions[least].IsInner(exceptions[j])) { least = j; } } - temp = exceptions[i]; + __ExceptionInfo temp = exceptions[i]; exceptions[i] = exceptions[least]; exceptions[least] = temp; } @@ -543,51 +536,6 @@ namespace System.Reflection.Emit PutInteger4(modBuilder.GetSignatureToken(sig).Token); } - public virtual void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes) - { - int stackchange = 0; - int cParams = 0; - int i; - SignatureHelper sig; - - ModuleBuilder modBuilder = (ModuleBuilder) m_methodBuilder.Module; - - if (parameterTypes != null) - { - cParams = parameterTypes.Length; - } - - sig = SignatureHelper.GetMethodSigHelper( - modBuilder, - unmanagedCallConv, - returnType); - - if (parameterTypes != null) - { - for (i = 0; i < cParams; i++) - { - sig.AddArgument(parameterTypes[i]); - } - } - - // If there is a non-void return type, push one. - if (returnType != typeof(void)) - stackchange++; - - // Pop off arguments if any. - if (parameterTypes != null) - stackchange -= cParams; - - // Pop the native function pointer. - stackchange--; - UpdateStackSize(OpCodes.Calli, stackchange); - - EnsureCapacity(7); - Emit(OpCodes.Calli); - RecordTokenFixup(); - PutInteger4(modBuilder.GetSignatureToken(sig).Token); - } - public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes) { if (methodInfo == null) @@ -660,7 +608,6 @@ namespace System.Reflection.Emit PutInteger4(tempVal); } - [System.Runtime.InteropServices.ComVisible(true)] public virtual void Emit(OpCode opcode, ConstructorInfo con) { if (con == null) @@ -1160,13 +1107,9 @@ namespace System.Reflection.Emit private static Type GetConsoleType() { -#if FEATURE_LEGACYSURFACE - return typeof(Console); -#else return Type.GetType( "System.Console, System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" + AssemblyRef.MicrosoftPublicKeyToken, throwOnError: true); -#endif } public virtual void EmitWriteLine(String value) |