public virtual Statement VisitFilter(Filter filter) { if (filter == null) return null; filter.Expression = this.VisitExpression(filter.Expression); filter.Block = this.VisitBlock(filter.Block); return filter; }
public override Statement VisitFilter(Filter filter) { if (filter == null) return null; return base.VisitFilter((Filter)filter.Clone()); }
public override Statement VisitFilter(Filter filter) { throw new NotImplementedException("Node type not yet supported"); }
/// <summary> /// Add explicit Catch statements at beginning of each catch handler. /// If a Catch handler has a next handler that differs from the ExceptionHandler enclosing the handler block, then we split /// the Catch statement into a separate block. /// /// Special case for Finally handlers that have been turned into catch handlers by the finally-elimination: /// - Move the special instruction FINALLYVARPREFIX<n> = pop() to the header. /// </summary> private void AddCatchStatements (IEnumerable/*<ExceptionHandler>*/ all_ehs, IList new_blocks) { if (all_ehs == null) return; foreach(ExceptionHandler eh in all_ehs) { switch (eh.HandlerType) { case NodeType.Catch: { Block handlerblock = eh.HandlerStartBlock; Block nexthandler = (Block)e2_next[handlerblock]; Block exnhandler = ExceptionHandler(handlerblock); Debug.Assert(nexthandler != null); // put Catch into separate block. Statement catchStatement = new Catch(null, null, eh.FilterType); catchStatement.SourceContext = handlerblock.SourceContext; link_handler_header_statement_to_block(new_blocks, catchStatement, handlerblock, nexthandler, exnhandler); break; } case NodeType.Filter: { // insert a Filter instruction at the beginning of filter block Block handlerblock = eh.HandlerStartBlock; Block nexthandler = (Block)e2_next[handlerblock]; Block exnhandler = ExceptionHandler(handlerblock); Debug.Assert(nexthandler != null); // put Filter into separate block. Statement filterStatement = new Filter(); filterStatement.SourceContext = handlerblock.SourceContext; link_handler_header_statement_to_block(new_blocks, filterStatement, handlerblock, nexthandler, exnhandler); // Commented out, since we treat filter's differently now. // insert a Catch all instruction at the beginning of the handler block // prepend_statement_to_block( // new Catch(null, null, System.Compiler.SystemTypes.Exception), // eh.HandlerStartBlock); break; } default: continue; } } }
public EventingVisitor(Action<Filter> visitFilter) { VisitedFilter += visitFilter; } public event Action<Filter> VisitedFilter; public override Statement VisitFilter(Filter filter) { if (VisitedFilter != null) VisitedFilter(filter); return base.VisitFilter(filter); }