• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ICompilation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MetadataImporter

		public MetadataImporter(IErrorReporter errorReporter, ICompilation compilation, IAttributeStore attributeStore, CompilerOptions options) {
			_errorReporter = errorReporter;
			_compilation = compilation;
			_attributeStore = attributeStore;
			_minimizeNames = options.MinimizeScript;
			_systemObject = compilation.MainAssembly.Compilation.FindType(KnownTypeCode.Object);
			_typeSemantics = new Dictionary<ITypeDefinition, TypeSemantics>();
			_delegateSemantics = new Dictionary<ITypeDefinition, DelegateScriptSemantics>();
			_instanceMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
			_staticMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
			_methodSemantics = new Dictionary<IMethod, MethodScriptSemantics>();
			_propertySemantics = new Dictionary<IProperty, PropertyScriptSemantics>();
			_fieldSemantics = new Dictionary<IField, FieldScriptSemantics>();
			_eventSemantics = new Dictionary<IEvent, EventScriptSemantics>();
			_constructorSemantics = new Dictionary<IMethod, ConstructorScriptSemantics>();
			_propertyBackingFieldNames = new Dictionary<IProperty, Tuple<string, bool>>();
			_eventBackingFieldNames = new Dictionary<IEvent, Tuple<string, bool>>();
			_backingFieldCountPerType = new Dictionary<ITypeDefinition, int>();
			_internalTypeCountPerAssemblyAndNamespace = new Dictionary<Tuple<IAssembly, string>, int>();
			_ignoredMembers = new HashSet<IMember>();

			var sna = _attributeStore.AttributesFor(compilation.MainAssembly).GetAttribute<ScriptNamespaceAttribute>();
			if (sna != null) {
				if (sna.Name == null || (sna.Name != "" && !sna.Name.IsValidNestedJavaScriptIdentifier())) {
					Message(Messages._7002, default(DomRegion), "assembly");
				}
			}
		}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:28,代码来源:MetadataImporter.cs


示例2: MetadataImporter

		public MetadataImporter(IErrorReporter errorReporter, ICompilation compilation, CompilerOptions options) {
			_errorReporter = errorReporter;
			_compilation = compilation;
			_minimizeNames = options.MinimizeScript;
			_systemObject = compilation.MainAssembly.Compilation.FindType(KnownTypeCode.Object);
			_typeSemantics = new Dictionary<ITypeDefinition, TypeSemantics>();
			_delegateSemantics = new Dictionary<ITypeDefinition, DelegateScriptSemantics>();
			_instanceMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
			_staticMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
			_methodSemantics = new Dictionary<IMethod, MethodScriptSemantics>();
			_propertySemantics = new Dictionary<IProperty, PropertyScriptSemantics>();
			_fieldSemantics = new Dictionary<IField, FieldScriptSemantics>();
			_eventSemantics = new Dictionary<IEvent, EventScriptSemantics>();
			_constructorSemantics = new Dictionary<IMethod, ConstructorScriptSemantics>();
			_propertyBackingFieldNames = new Dictionary<IProperty, string>();
			_eventBackingFieldNames = new Dictionary<IEvent, string>();
			_backingFieldCountPerType = new Dictionary<ITypeDefinition, int>();
			_internalTypeCountPerAssemblyAndNamespace = new Dictionary<Tuple<IAssembly, string>, int>();
			_ignoredMembers = new HashSet<IMember>();

			var sna = compilation.MainAssembly.AssemblyAttributes.SingleOrDefault(a => a.AttributeType.FullName == typeof(ScriptNamespaceAttribute).FullName);
			if (sna != null) {
				var data = AttributeReader.ReadAttribute<ScriptNamespaceAttribute>(sna);
				if (data.Name == null || (data.Name != "" && !data.Name.IsValidNestedJavaScriptIdentifier())) {
					Message(Messages._7002, sna.Region, "assembly");
				}
			}
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:28,代码来源:MetadataImporter.cs


示例3: GetGenericMethodConstraints

        public static string GetGenericMethodConstraints(this IMethod method, ICompilation compilation)
        {
            var sb = new StringBuilder();

            foreach (var typeParam in method.Parts.SelectMany(p =>
                p.TypeParameters.OfType<DefaultUnresolvedTypeParameter>()))
            {
                var resolvedParts = new List<string>();

                if (typeParam.HasDefaultConstructorConstraint)
                    resolvedParts.Add("new()");

                if (typeParam.HasReferenceTypeConstraint)
                    resolvedParts.Add("class");

                if (typeParam.HasValueTypeConstraint)
                    resolvedParts.Add("struct");

                resolvedParts.AddRange(
                    typeParam.Constraints.Resolve(compilation.TypeResolveContext)
                        .Select(x => x.GetOriginalFullName()));

                if (resolvedParts.Any())
                    sb.Append("where ").Append(typeParam.Name).Append(" : ").Append(string.Join(",", resolvedParts));
            }

            return sb.ToString();
        }
开发者ID:prescottadam,项目名称:pMixins,代码行数:28,代码来源:IMethodExtenstions.cs


示例4: IsDefinedInSource

		/// <summary>
		/// Determines if the given type is defined in source code, ie is part of the project
		/// </summary>
		public static bool IsDefinedInSource (this ITypeDefinition type, ICompilation compilation)
		{
			if (compilation == null)
				return false;

			return type.ParentAssembly.UnresolvedAssembly.Location == compilation.MainAssembly.UnresolvedAssembly.Location;
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:10,代码来源:CodeExtensions.cs


示例5: Resolve

		public ResolveResult Resolve(ParseInformation parseInfo, TextLocation location, ICompilation compilation, CancellationToken cancellationToken)
		{
			var decompiledParseInfo = parseInfo as ILSpyFullParseInformation;
			if (decompiledParseInfo == null)
				throw new ArgumentException("ParseInfo does not have SyntaxTree");
			return ResolveAtLocation.Resolve(compilation, null, decompiledParseInfo.SyntaxTree, location, cancellationToken);
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:7,代码来源:ILSpyParser.cs


示例6: TypeInference

 public TypeInference(ICompilation compilation)
 {
     if (compilation == null)
         throw new ArgumentNullException("compilation");
     this.compilation = compilation;
     this.conversions = CSharpConversions.Get(compilation);
 }
开发者ID:svermeulen,项目名称:NRefactory,代码行数:7,代码来源:TypeInference.cs


示例7: ResolveNamespaces

		IEnumerable<INamespace> ResolveNamespaces(ICompilation compilation)
		{
			IType xmlnsDefinition = compilation.FindType(typeof(System.Windows.Markup.XmlnsDefinitionAttribute));
			if (XmlNamespace.StartsWith("clr-namespace:", StringComparison.Ordinal)) {
				string name = XmlNamespace.Substring("clr-namespace:".Length);
				IAssembly asm = compilation.MainAssembly;
				int asmIndex = name.IndexOf(";assembly=", StringComparison.Ordinal);
				if (asmIndex >= 0) {
					string asmName = name.Substring(asmIndex + ";assembly=".Length);
					asm = compilation.ReferencedAssemblies.FirstOrDefault(a => a.AssemblyName == asmName) ?? compilation.MainAssembly;
					name = name.Substring(0, asmIndex);
				}
				string[] parts = name.Split('.');
				var @namespace = FindNamespace(asm, parts);
				if (@namespace != null) yield return @namespace;
			} else {
				foreach (IAssembly asm in compilation.Assemblies) {
					foreach (IAttribute attr in asm.AssemblyAttributes) {
						if (xmlnsDefinition.Equals(attr.AttributeType) && attr.PositionalArguments.Count == 2) {
							string xmlns = attr.PositionalArguments[0].ConstantValue as string;
							if (xmlns != XmlNamespace) continue;
							string ns = attr.PositionalArguments[1].ConstantValue as string;
							if (ns == null) continue;
							var @namespace = FindNamespace(asm, ns.Split('.'));
							if (@namespace != null) yield return @namespace;
						}
					}
				}
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:30,代码来源:XamlContext.cs


示例8: TypeInference

		internal TypeInference(ICompilation compilation, CSharpConversions conversions)
		{
			Debug.Assert(compilation != null);
			Debug.Assert(conversions != null);
			this.compilation = compilation;
			this.conversions = conversions;
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:TypeInference.cs


示例9: AddUsings

		public static void AddUsings(CodeElementsList<CodeElement> codeElements, UsingScope usingScope, ICompilation compilation)
		{
			var resolvedUsingScope = usingScope.Resolve(compilation);
			foreach (var ns in resolvedUsingScope.Usings) {
				codeElements.Add(new CodeImport(ns.FullName));
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:FileCodeModel2.cs


示例10: RuntimeLibrary

		public RuntimeLibrary(IMetadataImporter metadataImporter, IErrorReporter errorReporter, ICompilation compilation, INamer namer) {
			_metadataImporter = metadataImporter;
			_errorReporter = errorReporter;
			_compilation = compilation;
			_namer = namer;
			_omitDowncasts = MetadataUtils.OmitDowncasts(compilation);
			_omitNullableChecks = MetadataUtils.OmitNullableChecks(compilation);
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:8,代码来源:RuntimeLibrary.cs


示例11: CreateEmulator

		protected OOPEmulator CreateEmulator(ICompilation compilation, IErrorReporter errorReporter = null) {
			var n = new Namer();
			errorReporter = errorReporter ?? new MockErrorReporter();
			var md = new MetadataImporter(errorReporter, compilation, new CompilerOptions());
			md.Prepare(compilation.GetAllTypeDefinitions());
			var rtl = new RuntimeLibrary(md, errorReporter, compilation, n);
			return new OOPEmulator(compilation, md, rtl, n, new MockLinker(), errorReporter);
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:8,代码来源:OOPEmulatorTestBase.cs


示例12: ExpressoResolver

        public ExpressoResolver(ICompilation compilation)
        {
            if(compilation == null)
                throw new ArgumentNullException("compilation");

            this.compilation = compilation;
            context = new ExpressoTypeResolveContext(compilation.MainAssembly);
        }
开发者ID:hazama-yuinyan,项目名称:Expresso,代码行数:8,代码来源:ExpressoResolver.cs


示例13: CSharpResolver

 public CSharpResolver(ICompilation compilation)
 {
     if (compilation == null)
         throw new ArgumentNullException("compilation");
     this.compilation = compilation;
     this.conversions = Conversions.Get(compilation);
     this.context = new CSharpTypeResolveContext(compilation.MainAssembly);
 }
开发者ID:holmak,项目名称:NRefactory,代码行数:8,代码来源:CSharpResolver.cs


示例14: UnpackTask

		/// <summary>
		/// Gets the T in Task&lt;T&gt;.
		/// Returns void for non-generic Task.
		/// Any other type is returned unmodified.
		/// </summary>
		public static IType UnpackTask(ICompilation compilation, IType type)
		{
			if (!IsTask(type))
				return type;
			if (type.TypeParameterCount == 0)
				return compilation.FindType(KnownTypeCode.Void);
			else
				return type.TypeArguments[0];
		}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:14,代码来源:TaskType.cs


示例15: AddCompilation

		public void AddCompilation(IProjectContent project, ICompilation compilation)
		{
			if (project == null)
				throw new ArgumentNullException("project");
			if (compilation == null)
				throw new ArgumentNullException("compilation");
			if (!dictionary.TryAdd(project, compilation))
				throw new InvalidOperationException();
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:9,代码来源:DefaultSolutionSnapshot.cs


示例16: RunAutomaticMetadataAttributeAppliers

		private void RunAutomaticMetadataAttributeAppliers(IAttributeStore store, ICompilation compilation) {
			var processors = new IAutomaticMetadataAttributeApplier[] { new MakeMembersWithScriptableAttributesReflectable(store) };
			foreach (var p in processors) {
				foreach (var asm in compilation.Assemblies)
					p.Process(asm);
				foreach (var t in compilation.GetAllTypeDefinitions())
					p.Process(t);
			}
		}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:9,代码来源:MetadataImporterTestBase.cs


示例17: CompilationChanges

        public CompilationChanges(ICompilation original, ICompilation comparedTo, ContractChanges changes)
        {
            Contract.Requires(original != null || comparedTo != null);
            Contract.Requires(changes != null);

            Original = original;
            ComparedTo = comparedTo;
            Changes = changes;
        }
开发者ID:run00,项目名称:Versioning,代码行数:9,代码来源:CompilationChanges.cs


示例18: Init

		void Init(string program)
		{
			var pc = new CSharpProjectContent().AddAssemblyReferences(new[] { CecilLoaderTests.Mscorlib });
			var cu = new CSharpParser().Parse(new StringReader(program), "program.cs");
			compilation = pc.UpdateProjectContent(null, cu.ToTypeSystem()).CreateCompilation();
			typeDefinition = compilation.MainAssembly.TopLevelTypeDefinitions.FirstOrDefault();
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:7,代码来源:CSharpDocumentationTests.cs


示例19: IndexerParameterDataProvider

		public IndexerParameterDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType type, IEnumerable<IProperty> indexers, AstNode resolvedExpression) : base (ext, startOffset)
		{
			compilation = ext.UnresolvedFileCompilation;
			file = ext.CSharpUnresolvedFile;
			//			this.resolvedExpression = resolvedExpression;
			this.indexers = new List<IProperty> (indexers);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:7,代码来源:IndexerParameterDataProvider.cs


示例20: DelegateDataProvider

		public DelegateDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType) : base (ext, startOffset)
		{
			compilation = ext.UnresolvedFileCompilation;
			file = ext.CSharpUnresolvedFile;
			//			this.delegateType = delegateType;
			this.delegateMethod = delegateType.GetDelegateInvokeMethod ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:DelegateDataProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICompilationUnit类代码示例发布时间:2022-05-24
下一篇:
C# IComparer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap