public static bool IsAcyclic([NotNull] BlockNode block) { block.AssertNotNull("block != null"); if (block.InnerNodes.Count == 0) { return(true); } var visited = new Stack <IFlowNode>(); bool hasCycle = HasCycle(block.InnerNodes[0], visited); visited.Clear(); return(!hasCycle); }
public Task VisitBlock(BlockNode blockNode) { blockNode.AssertNotNull("blockNode != null"); Log.Info("At node: {0}. Block entered", blockNode); if (blockNode.InnerNodes.Count == 0) { if (blockNode.PointsTo != null) { return(blockNode.PointsTo.Accept(this)); } return(TaskHelper.CompletedTask); } Task innerTask = blockNode.InnerNodes[0].Accept(this); Debug.Assert(innerTask != null); if (blockNode.PointsTo == null) { return(innerTask); } Task <Task> pointsToContinuation = innerTask.ContinueWith(t => { if (t.Status == TaskStatus.RanToCompletion) { return(blockNode.PointsTo.Accept(this)); } return(t); }, myScheduler); return(pointsToContinuation.Unwrap()); }
protected override void VisitBlock(BlockNode blockNode) { CheckIfNodeIsInsideBlock(blockNode.PointsTo); }
protected override void VisitBlock(BlockNode blockNode) { }
protected abstract void VisitBlock([NotNull] BlockNode blockNode);
Null INodeVisitor <Null> .VisitBlock(BlockNode blockNode) { VisitBlock(blockNode); return(null); }