diff options
Diffstat (limited to 'src/coreclr/tools/Common/TypeSystem/IL/Stubs/ILEmitter.cs')
-rw-r--r-- | src/coreclr/tools/Common/TypeSystem/IL/Stubs/ILEmitter.cs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ILEmitter.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ILEmitter.cs index bc6985c43e6..b6f31e13014 100644 --- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ILEmitter.cs +++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ILEmitter.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using Internal.IL; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; @@ -521,7 +520,7 @@ namespace Internal.IL.Stubs internal int TryLength => _endTryStream.RelativeToAbsoluteOffset(_endTryOffset) - TryOffset; internal int HandlerOffset => _beginHandlerStream.RelativeToAbsoluteOffset(_beginHandlerOffset); internal int HandlerLength => _endHandlerStream.RelativeToAbsoluteOffset(_endHandlerOffset) - HandlerOffset; - + internal bool IsDefined => _beginTryStream != null && _endTryStream != null && _beginHandlerStream != null && _endHandlerStream != null; @@ -542,7 +541,7 @@ namespace Internal.IL.Stubs { private readonly byte[] _ilBytes; private readonly LocalVariableDefinition[] _locals; - private readonly Object[] _tokens; + private readonly object[] _tokens; private readonly MethodDesc _method; private readonly ILExceptionRegion[] _exceptionRegions; private readonly MethodDebugInformation _debugInformation; @@ -550,7 +549,7 @@ namespace Internal.IL.Stubs private const int MaxStackNotSet = -1; private int _maxStack; - public ILStubMethodIL(MethodDesc owningMethod, byte[] ilBytes, LocalVariableDefinition[] locals, Object[] tokens, ILExceptionRegion[] exceptionRegions = null, MethodDebugInformation debugInfo = null) + public ILStubMethodIL(MethodDesc owningMethod, byte[] ilBytes, LocalVariableDefinition[] locals, object[] tokens, ILExceptionRegion[] exceptionRegions = null, MethodDebugInformation debugInfo = null) { _ilBytes = ilBytes; _locals = locals; @@ -558,12 +557,10 @@ namespace Internal.IL.Stubs _method = owningMethod; _maxStack = MaxStackNotSet; - if (exceptionRegions == null) - exceptionRegions = Array.Empty<ILExceptionRegion>(); + exceptionRegions ??= Array.Empty<ILExceptionRegion>(); _exceptionRegions = exceptionRegions; - if (debugInfo == null) - debugInfo = MethodDebugInformation.None; + debugInfo ??= MethodDebugInformation.None; _debugInformation = debugInfo; } @@ -622,7 +619,7 @@ namespace Internal.IL.Stubs { return _locals; } - public override Object GetObject(int token, NotFoundBehavior notFoundBehavior) + public override object GetObject(int token, NotFoundBehavior notFoundBehavior) { return _tokens[(token & 0xFFFFFF) - 1]; } @@ -666,7 +663,7 @@ namespace Internal.IL.Stubs { private ArrayBuilder<ILCodeStream> _codeStreams; private ArrayBuilder<LocalVariableDefinition> _locals; - private ArrayBuilder<Object> _tokens; + private ArrayBuilder<object> _tokens; private ArrayBuilder<ILExceptionRegionBuilder> _finallyRegions; public ILEmitter() @@ -680,7 +677,7 @@ namespace Internal.IL.Stubs return stream; } - private ILToken NewToken(Object value, int tokenType) + private ILToken NewToken(object value, int tokenType) { Debug.Assert(value != null); _tokens.Add(value); @@ -802,7 +799,7 @@ namespace Internal.IL.Stubs return result; } - private class EmittedMethodDebugInformation : MethodDebugInformation + private sealed class EmittedMethodDebugInformation : MethodDebugInformation { private readonly ILSequencePoint[] _sequencePoints; |