Пример #1
0
        public TryStatementBuilder Filter(Type type, Variable holder, Expression condition, Statement body)
        {
            if (_skipNext)
            {
                _skipNext = false;
                return(this);
            }

            Contract.RequiresNotNull(type, "type");
            Contract.RequiresNotNull(condition, "condition");
            Contract.RequiresNotNull(holder, "holder");
            Contract.RequiresNotNull(body, "body");

            if (_catchBlocks == null)
            {
                _catchBlocks = new List <CatchBlock>();
            }

            _catchBlocks.Add(Ast.Catch(type, holder, Ast.IfThenElse(condition, body, Ast.Rethrow())));
            return(this);
        }