Example #1
0
            private void RecordStepTree(IncrementalGeneratorRunStep step, bool addToOutputSteps)
            {
                Debug.Assert(RecordingExecutedSteps);
                foreach (var(inputStep, _) in step.Inputs)
                {
                    RecordStepTree(inputStep, addToOutputSteps: false);
                }

                // If the step name is not null, we record it in the easily accessible collections.
                // Otherwise, it will be available only through graph traversal.
                if (step.Name is not null)
                {
                    addToNamedStepCollection(_namedSteps, step);
                    if (addToOutputSteps)
                    {
                        addToNamedStepCollection(_outputSteps, step);
                    }
                }
Example #2
0
 static void addToNamedStepCollection(Dictionary <string, HashSet <IncrementalGeneratorRunStep> > stepCollectionBuilder, IncrementalGeneratorRunStep step)
 {
     Debug.Assert(step.Name is not null);
     if (!stepCollectionBuilder.TryGetValue(step.Name, out var stepsByName))
     {
         stepsByName = new HashSet <IncrementalGeneratorRunStep>();
         stepCollectionBuilder.Add(step.Name, stepsByName);
     }
     stepsByName.Add(step);
 }