private bool TryMatchInput(SyntaxNode node, out CSharpReloadableInput input)
        {
            if (node is IdentifierNameSyntax idns)
            {
                var className = idns.Identifier.ToString();

                var matchingInputs = Inputs.Where(x => x.Input.OriginalClassName == className).ToList();
                if (!matchingInputs.Any())
                {
                    input = null;
                    return(false);
                }

                if (matchingInputs.Count == 1)
                {
                    input = matchingInputs[0];
                    return(true);
                }

                foreach (var u in Usings)
                {
                    var matchingWithNamespace =
                        matchingInputs
                        .FirstOrDefault(x => x.OriginalIdentifier == $"{u}.{className}");

                    if (matchingWithNamespace != null)
                    {
                        input = matchingWithNamespace;
                        return(true);
                    }
                }

                input = null;
                return(false);
            }
            else if (node is QualifiedNameSyntax qns)
            {
                var nodeIdentifier = $"{qns}";

                input = Inputs.FirstOrDefault(x => x.OriginalIdentifier == nodeIdentifier);
                return(input != null);
            }
            else
            {
                Logger.LogError("Don't know how to match input of type {node.GetType().Name}");
                input = null;
                return(false);
            }
        }
        public void Init(DisambiguationRewriterConfig config, CSharpReloadableInput targetInput)
        {
            Model           = config.Model;
            Inputs          = config.Inputs;
            Usings          = config.Usings;
            DependencyNodes = config.DependencyNodes;

            var thisNode = DependencyNodes.FirstOrDefault(x => x.Input == targetInput);

            if (thisNode == null)
            {
                Logger.LogInformation("Creating node for {TypeIdentifier}", targetInput.OriginalIdentifier);
                thisNode = new DependencyNode {
                    Input = targetInput
                };
                DependencyNodes.Add(thisNode);
            }

            ThisDependencyNode = thisNode;
        }
        public void AddDependency(CSharpReloadableInput input, DependencyKind kind)
        {
            if (input.OriginalIdentifier == this.ThisDependencyNode.Input.OriginalIdentifier)
            {
                Logger.LogDebug("Not adding dependency to self: {OriginalIdentifier}", input.OriginalIdentifier);
                return;
            }

            var existingNode = DependencyNodes.FirstOrDefault(x => x.Input == input);

            if (existingNode == null)
            {
                existingNode = new DependencyNode {
                    Input = input
                };
                DependencyNodes.Add(existingNode);
            }

            if (!ThisDependencyNode.Dependencies.Contains(existingNode))
            {
                ThisDependencyNode.Dependencies.Add(existingNode);
            }
        }