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);
                        }
                    }
                }
            }
        }
Пример #2
0
        protected override void VisitModuleSyntax(ModuleSyntax pNode)
        {
            //First we go through the current module to find any types that need to poly
            foreach (var s in pNode.Structs)
            {
                MaybeQueueStructToPoly(s);
            }

            //After we have found all of those, we go through the imported modules and find additional types
            //Since we could be using those types in our main module we need to poly them
            foreach (var r in _compilation.GetAllReferences())
            {
                foreach (var s in r.Module.Structs)
                {
                    MaybeQueueStructToPoly(s);
                }
            }

            base.VisitModuleSyntax(pNode);
        }