当前位置: 首页>>代码示例>>C#>>正文


C# ICompilation.Import方法代码示例

本文整理汇总了C#中ICompilation.Import方法的典型用法代码示例。如果您正苦于以下问题:C# ICompilation.Import方法的具体用法?C# ICompilation.Import怎么用?C# ICompilation.Import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICompilation的用法示例。


在下文中一共展示了ICompilation.Import方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MapToNestedCompilation

		CSharpTypeResolveContext MapToNestedCompilation(CSharpTypeResolveContext context, ICompilation nestedCompilation)
		{
			var nestedContext = new CSharpTypeResolveContext(nestedCompilation.MainAssembly);
			if (context.CurrentUsingScope != null) {
				nestedContext = nestedContext.WithUsingScope(context.CurrentUsingScope.UnresolvedUsingScope.Resolve(nestedCompilation));
			}
			if (context.CurrentTypeDefinition != null) {
				nestedContext = nestedContext.WithCurrentTypeDefinition(nestedCompilation.Import(context.CurrentTypeDefinition));
			}
			return nestedContext;
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:11,代码来源:ConstantValues.cs

示例2: XamlSymbolSearch

		public XamlSymbolSearch(IProject project, ISymbol entity)
		{
			compilation = SD.ParserService.GetCompilation(project);
			if (entity is IEntity)
				this.entity = compilation.Import((IEntity)entity);
			interestingFileNames = new List<FileName>();
			if (this.entity == null)
				return;
			foreach (var item in project.Items.OfType<FileProjectItem>().Where(i => i.FileName.HasExtension(".xaml")))
				interestingFileNames.Add(item.FileName);
			workAmount = interestingFileNames.Count;
			workAmountInverse = 1.0 / workAmount;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:13,代码来源:XamlSymbolSearch.cs

示例3: GetInterestingFiles

 /// <summary>
 /// Gets the file names that possibly contain references to the element being searched for.
 /// </summary>
 public IEnumerable<CSharpUnresolvedFile> GetInterestingFiles(IFindReferenceSearchScope searchScope, ICompilation compilation)
 {
     if (searchScope == null)
         throw new ArgumentNullException("searchScope");
     if (compilation == null)
         throw new ArgumentNullException("compilation");
     var pc = compilation.MainAssembly.UnresolvedAssembly as IProjectContent;
     if (pc == null)
         throw new ArgumentException("Main assembly is not a project content");
     if (searchScope.TopLevelTypeDefinition != null) {
         ITypeDefinition topLevelTypeDef = compilation.Import(searchScope.TopLevelTypeDefinition);
         if (topLevelTypeDef == null) {
             // This compilation cannot have references to the target entity.
             return EmptyList<CSharpUnresolvedFile>.Instance;
         }
         switch (searchScope.Accessibility) {
             case Accessibility.None:
             case Accessibility.Private:
                 if (topLevelTypeDef.ParentAssembly == compilation.MainAssembly)
                     return topLevelTypeDef.Parts.Select(p => p.UnresolvedFile).OfType<CSharpUnresolvedFile>().Distinct();
                 else
                     return EmptyList<CSharpUnresolvedFile>.Instance;
             case Accessibility.Protected:
                 return GetInterestingFilesProtected(topLevelTypeDef);
             case Accessibility.Internal:
                 if (topLevelTypeDef.ParentAssembly.InternalsVisibleTo(compilation.MainAssembly))
                     return pc.Files.OfType<CSharpUnresolvedFile>();
                 else
                     return EmptyList<CSharpUnresolvedFile>.Instance;
             case Accessibility.ProtectedAndInternal:
                 if (topLevelTypeDef.ParentAssembly.InternalsVisibleTo(compilation.MainAssembly))
                     return GetInterestingFilesProtected(topLevelTypeDef);
                 else
                     return EmptyList<CSharpUnresolvedFile>.Instance;
             case Accessibility.ProtectedOrInternal:
                 if (topLevelTypeDef.ParentAssembly.InternalsVisibleTo(compilation.MainAssembly))
                     return pc.Files.OfType<CSharpUnresolvedFile>();
                 else
                     return GetInterestingFilesProtected(topLevelTypeDef);
             default:
                 return pc.Files.OfType<CSharpUnresolvedFile>();
         }
     } else {
         return pc.Files.OfType<CSharpUnresolvedFile>();
     }
 }
开发者ID:artifexor,项目名称:NRefactory,代码行数:49,代码来源:FindReferences.cs

示例4: Import

		static IEnumerable<ITypeDefinition> Import (ICompilation compilation, IEnumerable<ITypeDefinition> types)
		{
			return types.Select (t => compilation.Import (t));
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:4,代码来源:MemberCollector.cs

示例5: SearchCompilation

		static void SearchCompilation (ISearchProgressMonitor monitor, ICompilation comp, ITypeDefinition cls, IMember member)
		{
			var importedType = comp.Import (cls);
			if (importedType == null) {
				return;
			}

			IMember impMember = null;
			if (member != null) {
				impMember = comp.Import (member);
				if (impMember == null) {
					return;
				}
			}

			foreach (var derivedType in comp.MainAssembly.GetAllTypeDefinitions ()) {
				if (!derivedType.IsDerivedFrom (importedType))
					continue;
				IEntity result;
				if (member != null) {
					result = FindDerivedMember (impMember, derivedType);
					if (result == null)
						continue;
				}
				else {
					result = derivedType;
				}
				ReportResult (monitor, result);
			}
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:30,代码来源:FindDerivedClassesHandler.cs

示例6: Equals

        public static bool Equals(ICompilation comp, IList<IParameter> x, IList<IParameter> y)
        {
            if (x == y)
                return true;
            if (x == null || y == null || x.Count != y.Count)
                return false;
            for (int i = 0; i < x.Count; i++) {
                var a = x[i];
                var b = y[i];
                if (a == null && b == null)
                    continue;
                if (a == null || b == null)
                    return false;

                // We want to consider the parameter lists "Method<T>(T a)" and "Method<S>(S b)" as equal.
                // However, the parameter types are not considered equal, as T is a different type parameter than S.
                // In order to compare the method signatures, we will normalize all method type parameters.
                IType aType = a.Type.AcceptVisitor(normalizationVisitor);
                IType bType = b.Type.AcceptVisitor(normalizationVisitor);
                bType = comp.Import (bType);
                if (!aType.Equals(bType))
                    return false;
            }
            return true;
        }
开发者ID:brantwedel,项目名称:monodevelop,代码行数:25,代码来源:MemberCollector.cs


注:本文中的ICompilation.Import方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。