コード例 #1
0
ファイル: T4PsiModule.cs プロジェクト: robyvandamme/ForTea
        /// <summary>
        /// Gets all modules referenced by this module.
        /// </summary>
        /// <returns>All referenced modules.</returns>
        public IEnumerable <IPsiModuleReference> GetReferences(IModuleReferenceResolveContext moduleReferenceResolveContext)
        {
            _shellLocks.AssertReadAccessAllowed();

            var references = new PsiModuleReferenceAccumulator(TargetFrameworkId);

            foreach (IAssemblyCookie cookie in _assemblyReferences.Values)
            {
                if (cookie.Assembly == null)
                {
                    continue;
                }

                IPsiModule psiModule = _psiModules.GetPrimaryPsiModule(cookie.Assembly, TargetFrameworkId);

                // Normal assembly.
                if (psiModule != null)
                {
                    references.Add(new PsiModuleReference(psiModule));
                }

                // Assembly that is the output of a current project: reference the project instead.
                else
                {
                    IProject project = _outputAssemblies.GetProjectByOutputAssembly(cookie.Assembly);
                    if (project != null)
                    {
                        psiModule = _psiModules.GetPrimaryPsiModule(project, TargetFrameworkId);
                        if (psiModule != null)
                        {
                            references.Add(new PsiModuleReference(psiModule));
                        }
                    }
                }
            }

            return(references.GetReferences());
        }
コード例 #2
0
 public IPsiModule GetPrimaryPsiModule(IModule module)
 {
     return(_psiModules.GetPrimaryPsiModule(module));
 }