예제 #1
0
 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;
 }
예제 #2
0
 public override Statement VisitFilter(Filter filter)
 {
     if (filter == null) return null;
     return base.VisitFilter((Filter)filter.Clone());
 }
예제 #3
0
 public override Statement VisitFilter(Filter filter)
 {
     throw new NotImplementedException("Node type not yet supported");
 }
예제 #4
0
    /// <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&lt;n&gt; = 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;
        }
      }
    }
예제 #5
0
 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); }