本文整理汇总了C#中SymbolFilter类的典型用法代码示例。如果您正苦于以下问题:C# SymbolFilter类的具体用法?C# SymbolFilter怎么用?C# SymbolFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymbolFilter类属于命名空间,在下文中一共展示了SymbolFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FindAsync
public async Task<IEnumerable<ISymbol>> FindAsync(
SearchQuery query, AsyncLazy<IAssemblySymbol> lazyAssembly, SymbolFilter filter, CancellationToken cancellationToken)
{
return SymbolFinder.FilterByCriteria(
await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false),
filter);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:SymbolTreeInfo.cs
示例2: FindDeclarationsAsyncImpl
private static async Task<IEnumerable<ISymbol>> FindDeclarationsAsyncImpl(
Project project, string name, bool ignoreCase, SymbolFilter criteria, CancellationToken cancellationToken)
{
var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var list = new List<ISymbol>();
// get declarations from the compilation's assembly
await AddDeclarationsAsync(project, name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false);
// get declarations from directly referenced projects and metadata
foreach (var assembly in compilation.GetReferencedAssemblySymbols())
{
var assemblyProject = project.Solution.GetProject(assembly, cancellationToken);
if (assemblyProject != null)
{
await AddDeclarationsAsync(assemblyProject, compilation, assembly, name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false);
}
else
{
await AddDeclarationsAsync(project.Solution, assembly, GetMetadataReferenceFilePath(compilation.GetMetadataReference(assembly)), name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false);
}
}
return TranslateNamespaces(list, compilation);
}
开发者ID:reudismam,项目名称:roslyn,代码行数:26,代码来源:SymbolFinder_Declarations.cs
示例3: MatchFilter
public override bool MatchFilter(SymbolFilter filter) {
if ((filter & SymbolFilter.Members) == 0) {
return false;
}
SymbolFilter memberTypeFilter = (filter & SymbolFilter.AnyMember);
if ((memberTypeFilter == SymbolFilter.InstanceMembers) &&
((_visibility & MemberVisibility.Static) != 0)) {
// Filter specifies member should be an instance member;
// Visibility of member indicates it is a static member.
return false;
}
if ((memberTypeFilter == SymbolFilter.StaticMembers) &&
((_visibility & MemberVisibility.Static) == 0)) {
// Filter specifies member should be a static member;
// Visibility of member indicates it is an instance member.
return false;
}
SymbolFilter visibilityFilter = (filter & SymbolFilter.AnyVisibility);
if ((visibilityFilter == SymbolFilter.Public) &&
((_visibility & (MemberVisibility.Public | MemberVisibility.Internal)) == 0)) {
// Filter specifies member should be public;
// Visibility of member indicates it is not public or internal
return false;
}
if ((visibilityFilter == (SymbolFilter.Public | SymbolFilter.Protected)) &&
((_visibility & (MemberVisibility.Public | MemberVisibility.Internal | MemberVisibility.Protected)) == 0)) {
// Filter specifies member should be public or protected;
// Visibility of member indicates it is not public, internal or protected
return false;
}
return true;
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:34,代码来源:MemberSymbol.cs
示例4: MatchFilter
public override bool MatchFilter(SymbolFilter filter)
{
if ((filter & SymbolFilter.Locals) == 0) {
return false;
}
return true;
}
开发者ID:mobilligy,项目名称:scriptsharp,代码行数:7,代码来源:LocalSymbol.cs
示例5:
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) {
Debug.Assert(String.IsNullOrEmpty(name) == false);
Debug.Assert(context == null);
Debug.Assert(filter == SymbolFilter.Types);
if (_typeMap.ContainsKey(name)) {
return _typeMap[name];
}
return null;
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:NamespaceSymbol.cs
示例6: FindDeclarationsAsync
/// <summary>
/// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
/// </summary>
public static Task<IEnumerable<ISymbol>> FindDeclarationsAsync(
Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
return SpecializedTasks.EmptyEnumerable<ISymbol>();
}
return FindDeclarationsAsync(project, new SearchQuery(name, ignoreCase), filter, includeDirectReferences: true, cancellationToken: cancellationToken);
}
开发者ID:VPashkov,项目名称:roslyn,代码行数:18,代码来源:SymbolFinder_Declarations.cs
示例7:
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) {
Symbol symbol = null;
if ((filter & SymbolFilter.Locals) != 0) {
if (_localTable.ContainsKey(name)) {
symbol = _localTable[name];
}
}
if (symbol == null) {
Debug.Assert(_parentSymbolTable != null);
symbol = _parentSymbolTable.FindSymbol(name, context, filter);
}
return symbol;
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:16,代码来源:SymbolScope.cs
示例8: FindDeclarationsAsync
/// <summary>
/// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name.
/// </summary>
public static Task<IEnumerable<ISymbol>> FindDeclarationsAsync(Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
{
if (project == null)
{
throw new ArgumentNullException(nameof(project));
}
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
return SpecializedTasks.EmptyEnumerable<ISymbol>();
}
using (Logger.LogBlock(FunctionId.SymbolFinder_FindDeclarationsAsync, cancellationToken))
{
return FindDeclarationsAsyncImpl(project, name, ignoreCase, filter, cancellationToken);
}
}
开发者ID:reudismam,项目名称:roslyn,代码行数:25,代码来源:SymbolFinder_Declarations.cs
示例9: FindSourceDeclarationsAsync
/// <summary>
/// Find the symbols for declarations made in source with a matching name.
/// </summary>
public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken))
{
if (solution == null)
{
throw new ArgumentNullException(nameof(solution));
}
if (predicate == null)
{
throw new ArgumentNullException(nameof(predicate));
}
using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Predicate_FindSourceDeclarationsAsync, cancellationToken))
{
var result = new List<ISymbol>();
foreach (var projectId in solution.ProjectIds)
{
var project = solution.GetProject(projectId);
var symbols = await FindSourceDeclarationsAsync(project, predicate, filter, cancellationToken).ConfigureAwait(false);
result.AddRange(symbols);
}
return result;
}
}
开发者ID:reudismam,项目名称:roslyn,代码行数:28,代码来源:SymbolFinder_Declarations.cs
示例10: GetDocumentsWithNameAsync
internal async Task<IEnumerable<Document>> GetDocumentsWithNameAsync(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken)
{
return (await _solution.State.GetDocumentsWithNameAsync(Id, predicate, filter, cancellationToken).ConfigureAwait(false)).Select(s => _solution.GetDocument(s.Id));
}
开发者ID:tvsonar,项目名称:roslyn,代码行数:4,代码来源:Project.cs
示例11: GetDocumentsWithNameAsync
public async Task<IEnumerable<DocumentState>> GetDocumentsWithNameAsync(ProjectId id, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken)
{
// this will be used to find documents that contain declaration information in IDE cache such as DeclarationSyntaxTreeInfo for "NavigateTo"
var trees = GetCompilationTracker(id).GetSyntaxTreesWithNameFromDeclarationOnlyCompilation(predicate, filter, cancellationToken);
if (trees != null)
{
return ConvertTreesToDocuments(id, trees);
}
// it looks like declaration compilation doesn't exist yet. we have to build full compilation
var compilation = await GetCompilationAsync(id, cancellationToken).ConfigureAwait(false);
if (compilation == null)
{
// some projects don't support compilations (e.g., TypeScript) so there's nothing to check
return SpecializedCollections.EmptyEnumerable<DocumentState>();
}
return ConvertTreesToDocuments(
id, compilation.GetSymbolsWithName(predicate, filter, cancellationToken).SelectMany(s => s.DeclaringSyntaxReferences.Select(r => r.SyntaxTree)));
}
开发者ID:tvsonar,项目名称:roslyn,代码行数:20,代码来源:SolutionState.cs
示例12: FindAsync
public async Task<IEnumerable<ISymbol>> FindAsync(
SearchQuery query, AsyncLazy<IAssemblySymbol> lazyAssembly, SymbolFilter filter, CancellationToken cancellationToken)
{
// All entrypoints to this function are Find functions that are only searching
// for specific strings (i.e. they never do a custom search).
Debug.Assert(query.Kind != SearchKind.Custom);
return SymbolFinder.FilterByCriteria(
await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false),
filter);
}
开发者ID:natidea,项目名称:roslyn,代码行数:11,代码来源:SymbolTreeInfo.cs
示例13: Expression
protected Expression(ExpressionType type, TypeSymbol evaluatedType, SymbolFilter memberMask) {
_type = type;
_evaluatedType = evaluatedType;
_memberMask = memberMask | SymbolFilter.Members;
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:5,代码来源:Expression.cs
示例14: MeetCriteria
private static bool MeetCriteria(ISymbol symbol, SymbolFilter filter)
{
if (IsOn(filter, SymbolFilter.Namespace) && symbol.Kind == SymbolKind.Namespace)
{
return true;
}
if (IsOn(filter, SymbolFilter.Type) && symbol is ITypeSymbol)
{
return true;
}
if (IsOn(filter, SymbolFilter.Member) && IsNonTypeMember(symbol))
{
return true;
}
return false;
}
开发者ID:reudismam,项目名称:roslyn,代码行数:19,代码来源:SymbolFinder_Declarations.cs
示例15: LocalExpression
public LocalExpression(LocalSymbol symbol, SymbolFilter memberMask)
: base(ExpressionType.Local, symbol.ValueType, memberMask)
{
_symbol = symbol;
}
开发者ID:mobilligy,项目名称:scriptsharp,代码行数:5,代码来源:LocalExpression.cs
示例16: GetSyntaxTreesWithNameFromDeclarationOnlyCompilation
/// <summary>
/// get all syntax trees that contain declaration node with the given name
/// </summary>
public IEnumerable<SyntaxTree> GetSyntaxTreesWithNameFromDeclarationOnlyCompilation(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken)
{
var state = this.ReadState();
if (state.DeclarationOnlyCompilation == null)
{
return null;
}
// DO NOT expose declaration only compilation to outside since it can be held alive long time, we don't want to create any symbol from the declaration only compilation.
// use cloned compilation since this will cause symbols to be created.
var clone = state.DeclarationOnlyCompilation.Clone();
return clone.GetSymbolsWithName(predicate, filter, cancellationToken).SelectMany(s => s.DeclaringSyntaxReferences.Select(r => r.SyntaxTree));
}
开发者ID:TyOverby,项目名称:roslyn,代码行数:17,代码来源:SolutionState.CompilationTracker.cs
示例17: ContainsSymbolsWithNameFromDeclarationOnlyCompilation
/// <summary>
/// check whether the compilation contains any declaration symbol from syntax trees with given name
/// </summary>
public bool? ContainsSymbolsWithNameFromDeclarationOnlyCompilation(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken)
{
var state = this.ReadState();
if (state.DeclarationOnlyCompilation == null)
{
return null;
}
// DO NOT expose declaration only compilation to outside since it can be held alive long time, we don't want to create any symbol from the declaration only compilation.
return state.DeclarationOnlyCompilation.ContainsSymbolsWithName(predicate, filter, cancellationToken);
}
开发者ID:TyOverby,项目名称:roslyn,代码行数:14,代码来源:SolutionState.CompilationTracker.cs
示例18: FilterByCriteria
private static IEnumerable<ISymbol> FilterByCriteria(IEnumerable<ISymbol> symbols, SymbolFilter criteria)
{
foreach (var symbol in symbols)
{
if (symbol.IsImplicitlyDeclared || symbol.IsAccessor())
{
continue;
}
if (MeetCriteria(symbol, criteria))
{
yield return symbol;
}
}
}
开发者ID:reudismam,项目名称:roslyn,代码行数:15,代码来源:SymbolFinder_Declarations.cs
示例19: GetMember
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) {
Debug.Assert(String.IsNullOrEmpty(name) == false);
Debug.Assert(context != null);
Symbol symbol = null;
if ((filter & SymbolFilter.Members) != 0) {
SymbolFilter baseFilter = filter | SymbolFilter.ExcludeParent;
symbol = GetMember(name);
if (symbol == null) {
TypeSymbol baseType = GetBaseType();
TypeSymbol objectType = (TypeSymbol)((ISymbolTable)this.SymbolSet.SystemNamespace).FindSymbol("Object", null, SymbolFilter.Types);
if ((baseType == null) && (this != objectType)) {
baseType = objectType;
}
if (baseType != null) {
symbol = ((ISymbolTable)baseType).FindSymbol(name, context, baseFilter);
}
}
if ((symbol != null) && (symbol.MatchFilter(filter) == false)) {
symbol = null;
}
}
if ((symbol == null) && (_parentSymbolTable != null) &&
((filter & SymbolFilter.ExcludeParent) == 0)) {
symbol = _parentSymbolTable.FindSymbol(name, context, filter);
}
return symbol;
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:35,代码来源:TypeSymbol.cs
示例20: IsOn
private static bool IsOn(SymbolFilter filter, SymbolFilter flag)
{
return (filter & flag) == flag;
}
开发者ID:reudismam,项目名称:roslyn,代码行数:4,代码来源:SymbolFinder_Declarations.cs
注:本文中的SymbolFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论