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


C# SyntaxTree.ToTypeSystem方法代码示例

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


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

示例1: Init

		void Init(string code)
		{
			syntaxTree = SyntaxTree.Parse(code, "test.cs");
			unresolvedFile = syntaxTree.ToTypeSystem();
			compilation = TypeSystemHelper.CreateCompilation(unresolvedFile);
			findReferences = new FindReferences();
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:7,代码来源:FindReferencesTest.cs

示例2: InitResolver

 private void InitResolver(SyntaxTree syntaxTree)
 {
     if(this.lastFileName != syntaxTree.FileName) {
         this.lastFileName = syntaxTree.FileName;
         var unresolvedFile = syntaxTree.ToTypeSystem();
         this.resolver = new CSharpAstResolver(compilation, syntaxTree, unresolvedFile);
     }
 }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:8,代码来源:MemberResolver.cs

示例3: Create

			internal static StubbedRefactoringContext Create(SyntaxTree tree, bool supportsVersion5 = true)
			{
				IProjectContent pc = new CSharpProjectContent();
				pc = pc.AddAssemblyReferences(CecilLoaderTests.Mscorlib);
				pc = pc.AddOrUpdateFiles(new[] {
					tree.ToTypeSystem()
				});
				var compilation = pc.CreateCompilation();
				var resolver = new CSharpAstResolver(compilation, tree);

				return new StubbedRefactoringContext(resolver, supportsVersion5);
			}
开发者ID:Bubeee,项目名称:NRefactory,代码行数:12,代码来源:NullValueAnalysisTests.cs

示例4: CSharpFile

        public CSharpFile(NRefactory.CSharpProject project, string fileName, string sourceCode)
        {
            _project = project;
            FileName = fileName;

            var parser = new CSharpParser(project.CompilerSettings);

            // Keep the original text around; we might use it for a refactoring later
            OriginalText = sourceCode;
            SyntaxTree = parser.Parse(OriginalText, fileName);

            _errors = parser.HasErrors
                ? parser.ErrorsAndWarnings
                : new List<Error>(0);

            UnresolvedTypeSystemForFile = SyntaxTree.ToTypeSystem();
        }
开发者ID:prescottadam,项目名称:pMixins,代码行数:17,代码来源:CSharpFile.cs

示例5: CSharpFile

        public CSharpFile(CSharpProject project, FilePath fileName, string sourceCode)
        {
            Ensure.ArgumentNotNull(project, "project");

            Project = project;
            FileName = fileName;
            OriginalText = sourceCode;

            var parser = new CSharpParser(Project.CompilerSettings);

            SyntaxTree = parser.Parse(sourceCode, fileName.FullPath);

            Errors = parser.HasErrors
                ? parser.ErrorsAndWarnings
                : new List<Error>(0);

            UnresolvedTypeSystemForFile = SyntaxTree.ToTypeSystem();
        }
开发者ID:prescottadam,项目名称:pMixins,代码行数:18,代码来源:CSharpFile.cs

示例6: GetContent

		static Tuple<ReadOnlyDocument, CSharpCompletionEngine> GetContent(string text, SyntaxTree syntaxTree)
		{
			var doc = new ReadOnlyDocument(text);
			IProjectContent pctx = new CSharpProjectContent();
			pctx = pctx.AddAssemblyReferences(new [] { mscorlib.Value, systemAssembly.Value, systemCore.Value, systemXmlLinq.Value });
			var unresolvedFile = syntaxTree.ToTypeSystem();
			
			pctx = pctx.AddOrUpdateFiles(unresolvedFile);
			var cmp = pctx.CreateCompilation();
			
			var mb = new DefaultCompletionContextProvider(doc, unresolvedFile);
			var engine = new CSharpCompletionEngine (doc, mb, new TestFactory (new CSharpResolver (new CSharpTypeResolveContext (cmp.MainAssembly))), pctx, new CSharpTypeResolveContext (cmp.MainAssembly));
			engine.EolMarker = Environment.NewLine;
			engine.FormattingPolicy = FormattingOptionsFactory.CreateMono ();
			return Tuple.Create (doc, engine);
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:16,代码来源:CodeCompletionBugTests.cs

示例7: createCompilation

 ICompilation createCompilation(string mainPath, SyntaxTree tree)
 {
     List<IUnresolvedAssembly> assemblies = new List<IUnresolvedAssembly>();
     var unresolved = tree.ToTypeSystem();
     IProjectContent project = new CSharpProjectContent();
     string[] paths = {/* mainPath, */typeof(String).Assembly.Location, typeof(INotifyPropertyChanged).Assembly.Location,
         typeof(Enumerable).Assembly.Location, typeof(System.Drawing.Bitmap).Assembly.Location };
     AssemblyLoader loader = AssemblyLoader.Create();
     return project.AddOrUpdateFiles(unresolved)
         .AddAssemblyReferences(paths.Select(path => loader.LoadAssemblyFile(path)))
         .CreateCompilation();
 }
开发者ID:phiresky,项目名称:Netjs,代码行数:12,代码来源:App.cs


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