本文整理汇总了C#中ICompilation.GetProject方法的典型用法代码示例。如果您正苦于以下问题:C# ICompilation.GetProject方法的具体用法?C# ICompilation.GetProject怎么用?C# ICompilation.GetProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICompilation
的用法示例。
在下文中一共展示了ICompilation.GetProject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindLocalReferencesAsync
public async Task FindLocalReferencesAsync(FileName fileName, IVariable variable, Action<SearchResultMatch> callback, ITextSource fileContent, ICompilation compilation, CancellationToken cancellationToken)
{
var entry = GetFileEntry(fileName, true);
if (entry.parser == null)
return;
if (fileContent == null)
fileContent = entry.parser.GetFileContent(fileName);
if (compilation == null)
compilation = GetCompilationForFile(fileName);
var parseInfo = await entry.ParseAsync(fileContent, compilation.GetProject(), cancellationToken).ConfigureAwait(false);
await Task.Run(
() => entry.parser.FindLocalReferences(parseInfo, fileContent, variable, compilation, callback, cancellationToken)
);
}
示例2: ResolveSnippet
public ResolveResult ResolveSnippet(FileName fileName, TextLocation fileLocation, string codeSnippet, ITextSource fileContent, ICompilation compilation, CancellationToken cancellationToken)
{
var entry = GetFileEntry(fileName, true);
if (entry.parser == null)
return ErrorResolveResult.UnknownError;
IProject project = compilation != null ? compilation.GetProject() : null;
var parseInfo = entry.Parse(fileContent, project, cancellationToken);
if (parseInfo == null)
return ErrorResolveResult.UnknownError;
if (compilation == null)
compilation = GetCompilationForFile(fileName);
ResolveResult rr = entry.parser.ResolveSnippet(parseInfo, fileLocation, codeSnippet, compilation, cancellationToken);
LoggingService.Debug("Resolved " + fileLocation + " to " + rr);
return rr ?? ErrorResolveResult.UnknownError;
}
示例3: ResolveAsync
public Task<ResolveResult> ResolveAsync(FileName fileName, TextLocation location, ITextSource fileContent, ICompilation compilation, CancellationToken cancellationToken)
{
var entry = GetFileEntry(fileName, true);
if (entry.parser == null)
return Task.FromResult<ResolveResult>(ErrorResolveResult.UnknownError);
IProject project = compilation != null ? compilation.GetProject() : null;
return entry.ParseAsync(fileContent, project, cancellationToken).ContinueWith(
delegate (Task<ParseInformation> parseInfoTask) {
var parseInfo = parseInfoTask.Result;
if (parseInfo == null)
return ErrorResolveResult.UnknownError;
if (compilation == null)
compilation = GetCompilationForFile(fileName);
ResolveResult rr = entry.parser.Resolve(parseInfo, location, compilation, cancellationToken);
LoggingService.Debug("Resolved " + location + " to " + rr);
return rr ?? ErrorResolveResult.UnknownError;
}, cancellationToken);
}
示例4: ResolveContext
public ICodeContext ResolveContext(FileName fileName, TextLocation location, ITextSource fileContent = null, ICompilation compilation = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (compilation == null)
compilation = GetCompilationForFile(fileName);
var entry = GetFileEntry(fileName, true);
if (entry.parser == null)
return new UnknownCodeContext(compilation);
IProject project = compilation != null ? compilation.GetProject() : null;
var parseInfo = entry.Parse(fileContent, project, cancellationToken);
if (parseInfo == null)
return new UnknownCodeContext(compilation);
var context = entry.parser.ResolveContext(parseInfo, location, compilation, cancellationToken);
if (context == null)
return new UnknownCodeContext(compilation, parseInfo.UnresolvedFile, location);
return context;
}