protected AnalysisWalker(ExpressionEval eval) { Eval = eval; ImportHandler = new ImportHandler(this); AssignmentHandler = new AssignmentHandler(this); LoopHandler = new LoopHandler(this); ConditionalHandler = new ConditionalHandler(this); WithHandler = new WithHandler(this); TryExceptHandler = new TryExceptHandler(this); NonLocalHandler = new NonLocalHandler(this); }
public override bool Walk(IfStatement node) => ConditionalHandler.HandleIf(node);
public void SetHandler <T>(Action <T> handler, IEventFilter filter = null) where T : Event { _handlers[typeof(T)] = new ConditionalHandler(e => handler.Invoke((T)e), filter); }
/// <summary> /// Add a task to execute. The task must return true if has completed (and if it /// returns false it will be invoked again after a little while, until it /// eventually returns true) /// </summary> /// <param name="action"></param> public void AddTask (ConditionalHandler action) { if (!is_async) throw new Exception ("Cannot add async tasks to a sync test."); tasks.Enqueue (action); }
public override Task <bool> WalkAsync(IfStatement node, CancellationToken cancellationToken = default) => ConditionalHandler.HandleIfAsync(node, cancellationToken);
public void EnqueueConditional (ConditionalHandler condition) { AsyncTestCase.Current.AddTask (condition); }