本文整理汇总了C#中ConsList.Any方法的典型用法代码示例。如果您正苦于以下问题:C# ConsList.Any方法的具体用法?C# ConsList.Any怎么用?C# ConsList.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsList
的用法示例。
在下文中一共展示了ConsList.Any方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubstituteFields
private static ConsList<FieldSymbol> SubstituteFields(ConsList<FieldSymbol> fields, TypeMap typeMap)
{
if (!fields.Any())
{
return ConsList<FieldSymbol>.Empty;
}
var head = SubstituteField(fields.Head, typeMap);
var tail = SubstituteFields(fields.Tail, typeMap);
return tail.Prepend(head);
}
示例2: DisplayClassVariable
internal DisplayClassVariable(string name, DisplayClassVariableKind kind, DisplayClassInstance displayClassInstance, ConsList<FieldSymbol> displayClassFields)
{
Debug.Assert(displayClassFields.Any());
this.Name = name;
this.Kind = kind;
this.DisplayClassInstance = displayClassInstance;
this.DisplayClassFields = displayClassFields;
// Verify all type parameters are substituted.
Debug.Assert(this.ContainingSymbol.IsContainingSymbolOfAllTypeParameters(this.Type));
}
示例3: GetBounds
private TypeParameterBounds GetBounds(ConsList<TypeParameterSymbol> inProgress)
{
Debug.Assert(!inProgress.ContainsReference(this));
Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol));
if (ReferenceEquals(_lazyBounds, TypeParameterBounds.Unset))
{
var diagnostics = DiagnosticBag.GetInstance();
var bounds = this.ResolveBounds(inProgress, diagnostics);
if (ReferenceEquals(Interlocked.CompareExchange(ref _lazyBounds, bounds, TypeParameterBounds.Unset), TypeParameterBounds.Unset))
{
this.CheckConstraintTypeConstraints(diagnostics);
this.AddDeclarationDiagnostics(diagnostics);
_state.NotePartComplete(CompletionPart.TypeParameterConstraints);
}
diagnostics.Free();
}
return _lazyBounds;
}
示例4: GetBounds
private TypeParameterBounds GetBounds(ConsList<TypeParameterSymbol> inProgress)
{
Debug.Assert(!inProgress.ContainsReference(this));
Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol));
if (ReferenceEquals(_lazyBounds, TypeParameterBounds.Unset))
{
var constraintTypes = GetDeclaredConstraintTypes();
Debug.Assert(!constraintTypes.IsDefault);
var diagnostics = ArrayBuilder<TypeParameterDiagnosticInfo>.GetInstance();
ArrayBuilder<TypeParameterDiagnosticInfo> useSiteDiagnosticsBuilder = null;
bool inherited = (_containingSymbol.Kind == SymbolKind.Method) && ((MethodSymbol)_containingSymbol).IsOverride;
var bounds = this.ResolveBounds(this.ContainingAssembly.CorLibrary, inProgress.Prepend(this), constraintTypes, inherited, currentCompilation: null,
diagnosticsBuilder: diagnostics, useSiteDiagnosticsBuilder: ref useSiteDiagnosticsBuilder);
DiagnosticInfo errorInfo = null;
if (diagnostics.Count > 0)
{
errorInfo = diagnostics[0].DiagnosticInfo;
}
else if (useSiteDiagnosticsBuilder != null && useSiteDiagnosticsBuilder.Count > 0)
{
foreach (var diag in useSiteDiagnosticsBuilder)
{
if (diag.DiagnosticInfo.Severity == DiagnosticSeverity.Error)
{
errorInfo = diag.DiagnosticInfo;
break;
}
else if ((object)errorInfo == null)
{
errorInfo = diag.DiagnosticInfo;
}
}
}
diagnostics.Free();
Interlocked.CompareExchange(ref _lazyBoundsErrorInfo, errorInfo, CSDiagnosticInfo.EmptyErrorInfo);
Interlocked.CompareExchange(ref _lazyBounds, bounds, TypeParameterBounds.Unset);
}
Debug.Assert(!ReferenceEquals(_lazyBoundsErrorInfo, CSDiagnosticInfo.EmptyErrorInfo));
return _lazyBounds;
}
示例5: CompleteIf
// removes unfinished if & related directives from stack and leaves active branch directives
private static ConsList<Directive> CompleteIf(ConsList<Directive> stack, out bool include)
{
// if we get to the top, the default rule is to include anything that follows
if (!stack.Any())
{
include = true;
return stack;
}
// if we reach the #if directive, then we stop unwinding and start
// rebuilding the stack w/o the #if/#elif/#else/#endif directives
// only including content from sections that are considered included
if (stack.Head.Kind.IsIfLikeDirective())
{
include = stack.Head.BranchTaken;
return stack.Tail;
}
var newStack = CompleteIf(stack.Tail, out include);
switch (stack.Head.Kind)
{
case SyntaxKind.ElifDirectiveTrivia:
case SyntaxKind.ElseDirectiveTrivia:
include = stack.Head.BranchTaken;
break;
default:
if (include)
{
newStack = new ConsList<Directive>(stack.Head, newStack);
}
break;
}
return newStack;
}
示例6: SkipInsignificantDirectives
private static ConsList<Directive> SkipInsignificantDirectives(ConsList<Directive> directives)
{
for (; directives != null && directives.Any(); directives = directives.Tail)
{
switch (directives.Head.Kind)
{
case SyntaxKind.IfDirectiveTrivia:
case SyntaxKind.ElifDirectiveTrivia:
case SyntaxKind.ElseDirectiveTrivia:
case SyntaxKind.EndIfDirectiveTrivia:
case SyntaxKind.DefineDirectiveTrivia:
case SyntaxKind.UndefDirectiveTrivia:
case SyntaxKind.RegionDirectiveTrivia:
case SyntaxKind.EndRegionDirectiveTrivia:
return directives;
}
}
return directives;
}
示例7: CompleteRegion
// removes region directives from stack but leaves everything else
private static ConsList<Directive> CompleteRegion(ConsList<Directive> stack)
{
// if we get to the top, the default rule is to include anything that follows
if (!stack.Any())
{
return stack;
}
if (stack.Head.Kind == SyntaxKind.RegionDirectiveTrivia)
{
return stack.Tail;
}
var newStack = CompleteRegion(stack.Tail);
newStack = new ConsList<Directive>(stack.Head, newStack);
return newStack;
}