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


C# ICompilation类代码示例

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


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

示例14: 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

示例15: 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;未经允许,请勿转载。