bool IDfirNodeVisitor <bool> .VisitTerminateLifetimeTunnel(TerminateLifetimeTunnel terminateLifetimeTunnel)
 {
     // The variables in the terminated lifetime will be marked consumed in InsertTerminateLifetimeTransform, assuming
     // there are no semantic errors (like trying to use one of them outside the lifetime structure).
     MarkFacadeVariableOfTerminalLive(terminateLifetimeTunnel.OutputTerminals[0]);
     return(true);
 }
Ejemplo n.º 2
0
        private void CreateTerminateLifetimeTunnel(Nodes.IBeginLifetimeTunnel beginLifetimeTunnel, NationalInstruments.Dfir.Structure dfirParentStructure)
        {
            var terminateLifetimeDfir = new TerminateLifetimeTunnel(dfirParentStructure);

            beginLifetimeTunnel.TerminateLifetimeTunnel = terminateLifetimeDfir;
            terminateLifetimeDfir.BeginLifetimeTunnel   = beginLifetimeTunnel;
        }
Ejemplo n.º 3
0
        private static IterateTunnel CreateIterateTunnel(Loop loop)
        {
            var iterateTunnel         = new IterateTunnel(loop);
            var terminateLifetimeDfir = new TerminateLifetimeTunnel(loop);

            iterateTunnel.TerminateLifetimeTunnel     = terminateLifetimeDfir;
            terminateLifetimeDfir.BeginLifetimeTunnel = iterateTunnel;
            return(iterateTunnel);
        }
Ejemplo n.º 4
0
        internal static BorrowTunnel CreateBorrowTunnel(Structure structure, BorrowMode borrowMode)
        {
            var borrowTunnel          = new BorrowTunnel(structure, borrowMode);
            var terminateLifetimeDfir = new TerminateLifetimeTunnel(structure);

            borrowTunnel.TerminateLifetimeTunnel      = terminateLifetimeDfir;
            terminateLifetimeDfir.BeginLifetimeTunnel = borrowTunnel;
            return(borrowTunnel);
        }
Ejemplo n.º 5
0
        internal LoopConditionTunnel CreateLoopConditionTunnel(global::Rebar.Compiler.Nodes.Loop loop)
        {
            var loopConditionTunnel   = new LoopConditionTunnel(loop);
            var terminateLifetimeDfir = new TerminateLifetimeTunnel(loop);

            loopConditionTunnel.TerminateLifetimeTunnel = terminateLifetimeDfir;
            terminateLifetimeDfir.BeginLifetimeTunnel   = loopConditionTunnel;
            return(loopConditionTunnel);
        }
Ejemplo n.º 6
0
        private static LockTunnel CreateLockTunnel(Structure structure)
        {
            var lockTunnel            = new LockTunnel(structure);
            var terminateLifetimeDfir = new TerminateLifetimeTunnel(structure);

            lockTunnel.TerminateLifetimeTunnel        = terminateLifetimeDfir;
            terminateLifetimeDfir.BeginLifetimeTunnel = lockTunnel;
            return(lockTunnel);
        }
Ejemplo n.º 7
0
        internal LoopConditionTunnel CreateLoopConditionTunnel(Loop loop)
        {
            var loopConditionTunnel   = new LoopConditionTunnel(loop);
            var terminateLifetimeDfir = new TerminateLifetimeTunnel(loop);

            loopConditionTunnel.TerminateLifetimeTunnel = terminateLifetimeDfir;
            terminateLifetimeDfir.BeginLifetimeTunnel   = loopConditionTunnel;
            return(loopConditionTunnel);
        }
Ejemplo n.º 8
0
        bool IDfirNodeVisitor <bool> .VisitTerminateLifetimeTunnel(TerminateLifetimeTunnel terminateLifetimeTunnel)
        {
            Terminal valueOutput = terminateLifetimeTunnel.OutputTerminals.ElementAt(0);
            var      valueFacade = new SimpleTerminalFacade(valueOutput, default(TypeVariableReference));

            _nodeFacade[valueOutput] = valueFacade;

            NationalInstruments.Dfir.BorderNode beginLifetimeBorderNode = (NationalInstruments.Dfir.BorderNode)terminateLifetimeTunnel.BeginLifetimeTunnel;
            Terminal beginLifetimeTerminal = beginLifetimeBorderNode.GetOuterTerminal(0);

            valueFacade.FacadeVariable.MergeInto(beginLifetimeTerminal.GetFacadeVariable());
            return(true);
        }
Ejemplo n.º 9
0
        public void LoopFollowedByLoop_GroupAsyncStates_SubsequentLoopStartsInPredecessorLoopTerminalGroup()
        {
            DfirRoot     function        = DfirRoot.Create();
            Loop         firstLoop       = new Loop(function.BlockDiagram);
            BorrowTunnel firstLoopBorrow = CreateBorrowTunnel(firstLoop, BorrowMode.Immutable);

            ConnectConstantToInputTerminal(firstLoopBorrow.InputTerminals[0], NITypes.Int32, false);
            TerminateLifetimeTunnel firstLoopTerminate = firstLoopBorrow.TerminateLifetimeTunnel;
            Loop   secondLoop = new Loop(function.BlockDiagram);
            Tunnel loopTunnel = CreateInputTunnel(secondLoop);

            Wire.Create(function.BlockDiagram, firstLoopTerminate.OutputTerminals[0], loopTunnel.InputTerminals[0]);

            IEnumerable <AsyncStateGroup> asyncStateGroups = GroupAsyncStates(function);

            string          terminalGroupName      = $"loop{firstLoop.UniqueId}_terminalGroup";
            AsyncStateGroup firstLoopTerminalGroup = asyncStateGroups.First(g => g.Label == terminalGroupName);
            AsyncStateGroup secondLoopInitialGroup = asyncStateGroups.First(g => g.GroupContainsStructureTraversalPoint(secondLoop, secondLoop.Diagram, StructureTraversalPoint.BeforeLeftBorderNodes));

            Assert.AreEqual(firstLoopTerminalGroup, secondLoopInitialGroup);
        }
 public bool VisitTerminateLifetimeTunnel(TerminateLifetimeTunnel unborrowTunnel)
 {
     // This node has no inputs.
     return(true);
 }
Ejemplo n.º 11
0
 bool IDfirNodeVisitor <bool> .VisitTerminateLifetimeTunnel(TerminateLifetimeTunnel terminateLifetimeTunnel)
 {
     return(true);
 }
Ejemplo n.º 12
0
 public bool VisitTerminateLifetimeTunnel(TerminateLifetimeTunnel terminateLifetimeTunnel)
 {
     return(true);
 }