Пример #1
0
        public override void Visit(Module module)
        {
            //Check filename
            module.GetModuleId().AcceptVisitor(this);

            //Get dependencies and check their existence
            List<Module> DependencyList = ModuleCache.Instance.RequestDependencies(module);
            foreach (Module moduleDependency in DependencyList)
            {
                foreach (Import import in moduleDependency.GetImports())
                {   //Check imports of dependency's
                    import.AcceptVisitor(this);
                    ModuleCache.Instance.RequestModule(import.GetModuleId());
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Add an specific module to the modulecache
 /// </summary>
 /// <param name="module"></param>
 public void AddModuleToCache(Module module)
 {
     ModuleTable.Add(module.GetModuleId().ToString(), module);
 }
Пример #3
0
        /// <summary>
        /// Request dependencies of specified modules
        /// </summary>
        /// <param name="module"></param>
        public void RequestDependencies(Module module, List<Module> list)
        {
            //Check if module is already in Table
            if (!ContainsModule(list,module.GetModuleId().ToString()))
            {
                list.Add(module);
                ISyntaxNode[] importArray = module.GetImports().ToArray();

                foreach(Import import in importArray)
                {
                    if (!ContainsModule(list, import.GetModuleId().ToString()))
                    {
                        //Get module
                        Module requestedDependency = RequestModule(import.GetModuleId());
                        if (requestedDependency != null)
                        {   //Not null, so add to list
                            //Get dependencies of retrieved module
                            RequestDependencies(requestedDependency, list);
                        }
                    }
                }
            }
        }