Jurassic.Compiler.DynamicILGenerator.EndFilter C# (CSharp) Method

EndFilter() public method

This instruction can be used from within a filter block to indicate whether the exception will be handled. It pops an integer from the stack which should be 0 to continue searching for an exception handler or 1 to use the handler associated with the filter. EndFilter() must be called at the end of a filter block.
public EndFilter ( ) : void
return void
        public override void EndFilter()
        {
            if (this.activeExceptionRegions == null)
                throw new InvalidOperationException("EndFilter can only be called from within an exception filter.");

            // Get the current exception clause.
            var exceptionRegion = this.activeExceptionRegions.Peek();
            if (exceptionRegion.Clauses.Count == 0)
                throw new InvalidOperationException("EndFilter can only be called from within an exception filter.");
            var latestClause = exceptionRegion.Clauses[exceptionRegion.Clauses.Count - 1];
            if (latestClause.Type != ExceptionClauseType.Filter)
                throw new InvalidOperationException("EndFilter can only be called from within an exception filter.");

            Emit2ByteOpCode(0xFE, 0x11, 1, 0);
            PopStackOperands(VESType.Int32);

            // Record the start of the handler.
            latestClause.FilterHandlerStart = this.offset;

            // The filter handler has the exception on the top of the stack.
            ClearEvaluationStack();
            PushStackOperand(VESType.Object);
        }
DynamicILGenerator