protected override void VisitCastSyntax(CastSyntax pNode)
        {
            base.VisitCastSyntax(pNode);

            //We only care about methods that aren't in the current module
            foreach (var mod in _unit.GetAllReferences())
            {
                //Find the method
                foreach (var m in mod.Module.Methods)
                {
                    if (m is CastDefinitionSyntax c && IsCalledCast(c, pNode))
                    {
                        var rn = new ReferencedNode(m, mod.Cache);
                        if (!MethodNodes.Contains(rn))
                        {
                            MethodNodes.Add(rn);

                            //Get any type/methods that this method references
                            var mrv = new ModuleReferenceVisitor(mod.Cache, _context, mod);
                            mrv.Visit(m);
                            MethodNodes.AddRange(mrv.MethodNodes);
                            TypeNodes.AddRange(mrv.TypeNodes);
                        }
                    }
                }
            }
        }
        protected override void VisitMethodCallSyntax(MethodCallSyntax pNode)
        {
            base.VisitMethodCallSyntax(pNode);

            //We only care about methods that aren't in the current module
            if (_module != null || Namespace != null)
            {
                System.Diagnostics.Debug.Assert(_module != null || _unit.HasReference(Namespace));

                //Get the referenced module
                var mod = Namespace == null ? _module : _unit.GetReference(Namespace);

                //Find the method
                foreach (var m in mod.Module.Methods)
                {
                    if (IsCalledMethod(m, pNode))
                    {
                        var rn = new ReferencedNode(m, mod.Cache);
                        if (!MethodNodes.Contains(rn))
                        {
                            MethodNodes.Add(rn);

                            //Get any type/methods that this method references
                            var mrv = new ModuleReferenceVisitor(mod.Cache, _context, mod);
                            mrv.MethodNodes.Add(rn);

                            mrv.Visit(m);
                            MethodNodes.AddRange(mrv.MethodNodes);
                            TypeNodes.AddRange(mrv.TypeNodes);
                        }
                    }
                }
            }
        }
        protected override void VisitTypeSyntax(TypeSyntax pNode)
        {
            base.VisitTypeSyntax(pNode);

            if (SmallTypeCache.TryGetPrimitive(pNode.Type.Name, out SmallType tt))
            {
                return;
            }

            //We only care about types that aren't in the current module
            if (_module != null || !string.IsNullOrEmpty(pNode.Type.Namespace))
            {
                System.Diagnostics.Debug.Assert(_module != null || _unit.HasReference(pNode.Type.Namespace));

                //Get the referenced module
                var mod = Namespace == null ? _module : _unit.GetReference(pNode.Type.Namespace);

                //Find the struct
                foreach (var t in mod.Module.Structs)
                {
                    bool add = false;
                    if (pNode.Type == t.GetApplicableType().Type)
                    {
                        add = true;
                    }
                    else if (pNode.Type != null &&
                             pNode.Type.HasGenericArguments &&
                             pNode.Type.Name == t.DeclaredType.Type.Name &&
                             pNode.Type.GenericParameters.Count == t.DeclaredType.Type.GenericParameters.Count)
                    {
                        add = true;
                    }

                    if (add)
                    {
                        var rn = new ReferencedNode(t, mod.Cache);
                        if (!TypeNodes.Contains(rn))
                        {
                            TypeNodes.Add(rn);

                            //TODO check existance before adding to typenodes?
                            //Get any type/methods that this method references
                            foreach (var m in t.Methods)
                            {
                                var mrv = new ModuleReferenceVisitor(mod.Cache, _context, mod);
                                mrv.Visit(m);
                                MethodNodes.AddRange(mrv.MethodNodes);
                                TypeNodes.AddRange(mrv.TypeNodes);
                            }
                        }
                    }
                }
            }
        }