本文整理汇总了C#中CompilationUnit.ToTypeSystem方法的典型用法代码示例。如果您正苦于以下问题:C# CompilationUnit.ToTypeSystem方法的具体用法?C# CompilationUnit.ToTypeSystem怎么用?C# CompilationUnit.ToTypeSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompilationUnit
的用法示例。
在下文中一共展示了CompilationUnit.ToTypeSystem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
void Init(string code)
{
compilationUnit = new CSharpParser().Parse(new StringReader(code), "test.cs");
parsedFile = compilationUnit.ToTypeSystem();
compilation = TypeSystemHelper.CreateCompilation(parsedFile);
findReferences = new FindReferences();
}
示例2: GetContent
Tuple<ReadOnlyDocument, CSharpCompletionEngine> GetContent (string text, CompilationUnit compilationUnit)
{
var doc = new ReadOnlyDocument (text);
IProjectContent pctx = new CSharpProjectContent ();
pctx = pctx.AddAssemblyReferences (new [] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore });
var parsedFile = compilationUnit.ToTypeSystem ();
pctx = pctx.UpdateProjectContent (null, parsedFile);
var cmp = pctx.CreateCompilation ();
var engine = new CSharpCompletionEngine (doc, new TestFactory (), pctx, new CSharpTypeResolveContext (cmp.MainAssembly), compilationUnit, parsedFile);
engine.EolMarker = Environment.NewLine;
engine.FormattingPolicy = FormattingOptionsFactory.CreateMono ();
return Tuple.Create (doc, engine);
}
示例3: VisitCompilationUnit
public override void VisitCompilationUnit(CompilationUnit unit)
{
IProjectContent project = new CSharpProjectContent();
_parsedFile = unit.ToTypeSystem();
project = project.UpdateProjectContent(null, _parsedFile);
project = project.AddAssemblyReferences(builtInLibs.Value);
_compilation = project.CreateCompilation();
_compilationUnit = unit;
_resolver = new CSharpAstResolver(_compilation, _compilationUnit, _parsedFile);
base.VisitCompilationUnit(unit);
}