Exemplo n.º 1
0
        public ReturnTracerResult Verify()
        {
            var firstLabel = Marks.OrderBy(o => o.Value).First().Key;
            var firstIx    = Marks[firstLabel];

            var path = new LinqList <Label>();

            path.Add(firstLabel);
            var pathLookup = new LinqHashSet <Label>(path.AsEnumerable());

            return(TraceFrom(firstIx, path, pathLookup));
        }
Exemplo n.º 2
0
 public VerifiableTracker Clone()
 {
     return
         (new VerifiableTracker(BeganAt)
     {
         IsBaseless = IsBaseless,
         MarkedLabelsAtTransitions = new LinqDictionary <Label, int>(MarkedLabelsAtTransitions),
         BranchesAtTransitions = new LinqDictionary <Label, int>(BranchesAtTransitions),
         Transitions = new LinqList <InstructionAndTransitions>(Transitions.AsEnumerable()),
         StartingStack = new LinqStack <LinqList <TypeOnStack> >(StartingStack.Reverse())
     });
 }
Exemplo n.º 3
0
        private VerificationResult VerifyBranchInto(Label to)
        {
            LinqList <VerifiableTracker> onInto;

            if (!VerifyFromLabel.TryGetValue(to, out onInto))
            {
                return(null);
            }

            VerifyFromLabel.Remove(to);

            foreach (var c in CurrentlyInScope.AsEnumerable())
            {
                foreach (var into in onInto.AsEnumerable())
                {
                    var completedCircuit = c.Concat(into);

                    var verified = completedCircuit.CollapseAndVerify();
                    if (!verified.Success)
                    {
                        return(verified);
                    }

                    if (completedCircuit.IsBaseless)
                    {
                        if (!VerifyFromLabel.ContainsKey(completedCircuit.BeganAt))
                        {
                            VerifyFromLabel[completedCircuit.BeganAt] = new LinqList <VerifiableTracker>();
                        }

                        VerifyFromLabel[completedCircuit.BeganAt].Add(completedCircuit);
                    }
                }
            }

            return(null);
        }