Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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)
 {
 }
Exemplo n.º 5
0
 protected abstract void VisitBlock([NotNull] BlockNode blockNode);
Exemplo n.º 6
0
 Null INodeVisitor <Null> .VisitBlock(BlockNode blockNode)
 {
     VisitBlock(blockNode);
     return(null);
 }