private MarkCatchAddr ( int catchAddr, |
||
catchAddr | int | |
catchException | ||
Результат | void |
public override void BeginCatchBlock(Type exceptionType) { if (CurrExcStackCount == 0) { throw new NotSupportedException(SR.Argument_NotInExceptionBlock); } Contract.EndContractBlock(); __ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1]; RuntimeType rtType = exceptionType as RuntimeType; if (current.GetCurrentState() == __ExceptionInfo.State_Filter) { if (exceptionType != null) { throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType); } this.Emit(OpCodes.Endfilter); current.MarkCatchAddr(ILOffset, null); } else { // execute this branch if previous clause is Catch or Fault if (exceptionType == null) { throw new ArgumentNullException(nameof(exceptionType)); } if (rtType == null) { throw new ArgumentException(SR.Argument_MustBeRuntimeType); } Label endLabel = current.GetEndLabel(); this.Emit(OpCodes.Leave, endLabel); // if this is a catch block the exception will be pushed on the stack and we need to update the stack info UpdateStackSize(OpCodes.Nop, 1); current.MarkCatchAddr(ILOffset, exceptionType); // this is relying on too much implementation details of the base and so it's highly breaking // Need to have a more integrated story for exceptions current.m_filterAddr[current.m_currentCatch - 1] = GetTokenFor(rtType); } }
public override void BeginCatchBlock(Type exceptionType) { if (base.CurrExcStackCount == 0) { throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock")); } __ExceptionInfo info = base.CurrExcStack[base.CurrExcStackCount - 1]; if (info.GetCurrentState() == 1) { if (exceptionType != null) { throw new ArgumentException(Environment.GetResourceString("Argument_ShouldNotSpecifyExceptionType")); } this.Emit(OpCodes.Endfilter); } else { if (exceptionType == null) { throw new ArgumentNullException("exceptionType"); } if (!exceptionType.GetType().IsRuntimeType) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } Label endLabel = info.GetEndLabel(); this.Emit(OpCodes.Leave, endLabel); base.UpdateStackSize(OpCodes.Nop, 1); } info.MarkCatchAddr(this.ILOffset, exceptionType); info.m_filterAddr[info.m_currentCatch - 1] = this.m_scope.GetTokenFor(exceptionType.TypeHandle); }
public virtual void BeginCatchBlock(Type exceptionType) { if (this.m_currExcStackCount == 0) { throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock")); } __ExceptionInfo info = this.m_currExcStack[this.m_currExcStackCount - 1]; if (info.GetCurrentState() == 1) { if (exceptionType != null) { throw new ArgumentException(Environment.GetResourceString("Argument_ShouldNotSpecifyExceptionType")); } this.Emit(OpCodes.Endfilter); } else { if (exceptionType == null) { throw new ArgumentNullException("exceptionType"); } Label endLabel = info.GetEndLabel(); this.Emit(OpCodes.Leave, endLabel); } info.MarkCatchAddr(this.m_length, exceptionType); }
public override void BeginCatchBlock(Type exceptionType) { if (m_currExcStackCount == 0) { throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock")); } __ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1]; if (current.GetCurrentState() == __ExceptionInfo.State_Filter) { if (exceptionType != null) { throw new ArgumentException(Environment.GetResourceString("Argument_ShouldNotSpecifyExceptionType")); } this.Emit(OpCodes.Endfilter); } else { // execute this branch if previous clause is Catch or Fault if (exceptionType == null) { throw new ArgumentNullException("exceptionType"); } if (exceptionType.GetType() != typeof(RuntimeType)) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } Label endLabel = current.GetEndLabel(); this.Emit(OpCodes.Leave, endLabel); // if this is a catch block the exception will be pushed on the stack and we need to update the stack info UpdateStackSize(OpCodes.Nop, 1); } current.MarkCatchAddr(m_length, exceptionType); // this is relying on too much implementation details of the base and so it's highly breaking // Need to have a more integreted story for exceptions current.m_filterAddr[current.m_currentCatch - 1] = m_scope.GetTokenFor(exceptionType.TypeHandle); }