5 instantiations of SyntaxNodeOrToken
Microsoft.CodeAnalysis (5)
Syntax\ChildSyntaxList.cs (2)
209return new SyntaxNodeOrToken(node, greenChild, position, index); 295return new SyntaxNodeOrToken(node, green, position, index);
Syntax\SyntaxNodeOrToken.cs (2)
775return new SyntaxNodeOrToken(token.Parent, token.Node, token.Position, token.Index); 802? new SyntaxNodeOrToken(node)
Syntax\SyntaxNodeOrTokenListBuilder.cs (1)
46return new SyntaxNodeOrToken(null, innerNode, 0, 0);
960 references to SyntaxNodeOrToken
AnalyzerRunner (1)
CodeRefactoringRunner.cs (1)
79foreach (var node in root.DescendantNodesAndTokens(descendIntoTrivia: true))
Microsoft.CodeAnalysis (219)
Diagnostic\SourceLocation.cs (1)
36public SourceLocation(in SyntaxNodeOrToken nodeOrToken)
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
206foreach (var child in node.ChildNodesAndTokens()) 283foreach (var child in node.ChildNodesAndTokens().Reverse())
Syntax\ChildSyntaxList.cs (12)
14public readonly partial struct ChildSyntaxList : IEquatable<ChildSyntaxList>, IReadOnlyList<SyntaxNodeOrToken> 63public SyntaxNodeOrToken this[int index] 116internal static SyntaxNodeOrToken ItemInternal(SyntaxNode node, int index) 127internal static SyntaxNodeOrToken ItemInternal(SyntaxNode node, int index, ref SlotData slotData) 221internal static SyntaxNodeOrToken ChildThatContainsPosition(SyntaxNode node, int targetPosition) 358private SyntaxNodeOrToken[] Nodes 377public SyntaxNodeOrToken First() 392public SyntaxNodeOrToken Last() 424IEnumerator<SyntaxNodeOrToken> IEnumerable<SyntaxNodeOrToken>.GetEnumerator() 428return SpecializedCollections.EmptyEnumerator<SyntaxNodeOrToken>(); 438return SpecializedCollections.EmptyEnumerator<SyntaxNodeOrToken>();
Syntax\ChildSyntaxList.Enumerator.cs (4)
59public SyntaxNodeOrToken Current 74internal bool TryMoveNextAndGetCurrent(out SyntaxNodeOrToken current) 101private class EnumeratorImpl : IEnumerator<SyntaxNodeOrToken> 116public SyntaxNodeOrToken Current
Syntax\ChildSyntaxList.Reversed.cs (8)
16public readonly partial struct Reversed : IEnumerable<SyntaxNodeOrToken>, IEquatable<Reversed> 33IEnumerator<SyntaxNodeOrToken> IEnumerable<SyntaxNodeOrToken>.GetEnumerator() 37return SpecializedCollections.EmptyEnumerator<SyntaxNodeOrToken>(); 47return SpecializedCollections.EmptyEnumerator<SyntaxNodeOrToken>(); 88public SyntaxNodeOrToken Current 103private class EnumeratorImpl : IEnumerator<SyntaxNodeOrToken> 118public SyntaxNodeOrToken Current
Syntax\LineDirectiveMap.cs (2)
39var syntaxRoot = (SyntaxNodeOrToken)syntaxTree.GetRoot();
Syntax\SeparatedSyntaxList.cs (4)
70var item = list[i]; 415var previous = nodesWithSeps[insertionIndex - 1]; 423var nodesToInsertWithSeparators = new List<SyntaxNodeOrToken>(); 594private SyntaxNodeOrToken[] NodesWithSeparators
Syntax\SyntaxDiffer.cs (49)
19private readonly Stack<SyntaxNodeOrToken> _oldNodes = new Stack<SyntaxNodeOrToken>(InitialStackSize); 20private readonly Stack<SyntaxNodeOrToken> _newNodes = new Stack<SyntaxNodeOrToken>(InitialStackSize); 29_oldNodes.Push((SyntaxNodeOrToken)oldNode); 30_newNodes.Push((SyntaxNodeOrToken)newNode); 320private static void ReplaceFirstWithChildren(Stack<SyntaxNodeOrToken> stack) 322var node = stack.Pop(); 325var children = new SyntaxNodeOrToken[node.ChildNodesAndTokens().Count]; 326foreach (var child in node.ChildNodesAndTokens()) 341private void FindBestMatch(Stack<SyntaxNodeOrToken> stack, in SyntaxNodeOrToken node, out int index, out int similarity, int startIndex = 0) 347foreach (var stackNode in stack) 392foreach (var child in stackNode.ChildNodesAndTokens()) 424private int GetSimilarity(in SyntaxNodeOrToken node1, in SyntaxNodeOrToken node2) 474foreach (var n1 in node1.ChildNodesAndTokens()) 485foreach (var n2 in node2.ChildNodesAndTokens()) 506private static bool AreIdentical(in SyntaxNodeOrToken node1, in SyntaxNodeOrToken node2) 511private static bool AreSimilar(in SyntaxNodeOrToken node1, in SyntaxNodeOrToken node2) 519public readonly Queue<SyntaxNodeOrToken>? OldNodes; 520public readonly Queue<SyntaxNodeOrToken>? NewNodes; 522internal ChangeRecord(TextChangeRange range, Queue<SyntaxNodeOrToken>? oldNodes, Queue<SyntaxNodeOrToken>? newNodes) 543var removedNode = _oldNodes.Pop(); 546var insertedNode = _newNodes.Pop(); 593private void RecordChange(TextChangeRange textChangeRange, in SyntaxNodeOrToken removedNode, SyntaxNodeOrToken insertedNode) 616Queue<SyntaxNodeOrToken> CreateQueue(SyntaxNodeOrToken nodeOrToken) 618var queue = new Queue<SyntaxNodeOrToken>(); 624private static TextSpan GetSpan(Stack<SyntaxNodeOrToken> stack, int first, int length) 627foreach (var n in stack) 649private static TextSpan GetSpan(Queue<SyntaxNodeOrToken> queue, int first, int length) 652foreach (var n in queue) 674private static Queue<SyntaxNodeOrToken>? Combine(Queue<SyntaxNodeOrToken>? first, Queue<SyntaxNodeOrToken>? next) 686foreach (var nodeOrToken in next) 694private static Queue<SyntaxNodeOrToken>? CopyFirst(Stack<SyntaxNodeOrToken> stack, int n) 701var queue = new Queue<SyntaxNodeOrToken>(n); 704foreach (var node in stack) 718private static void RemoveFirst(Stack<SyntaxNodeOrToken> stack, int count) 819private static string GetText(Queue<SyntaxNodeOrToken>? queue) 834private static void CopyText(Queue<SyntaxNodeOrToken>? queue, StringBuilder builder) 842foreach (var n in queue)
Syntax\SyntaxNavigator.cs (6)
107var child = en.Current; 154var child = en.Current; 440foreach (var child in node.Parent.ChildNodesAndTokens()) 490foreach (var child in node.Parent.ChildNodesAndTokens().Reverse()) 548foreach (var child in current.Parent.ChildNodesAndTokens()) 602foreach (var child in current.Parent.ChildNodesAndTokens().Reverse())
Syntax\SyntaxNode.cs (13)
754public virtual SyntaxNodeOrToken ChildThatContainsPosition(int position) 763SyntaxNodeOrToken childNodeOrToken = ChildSyntaxList.ChildThatContainsPosition(this, position); 787foreach (var nodeOrToken in this.ChildNodesAndTokens()) 915public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 926public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 936public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 947public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1032foreach (var nodeOrToken in this.ChildNodesAndTokens()) 1115foreach (var element in node.ChildNodesAndTokens()) 1254public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(string annotationKind) 1263public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(params string[] annotationKinds) 1272public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(SyntaxAnnotation annotation) 1481SyntaxNodeOrToken curNode = this;
Syntax\SyntaxNode.Iterators.cs (14)
24private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 69public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 222public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 289private readonly ArrayBuilder<SyntaxNodeOrToken>? _tokenStack; 298_tokenStack = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(); 317public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 341public SyntaxNodeOrToken PopToken() 373public void PushToken(in SyntaxNodeOrToken value) 415private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 426SyntaxNodeOrToken value; 444private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 458SyntaxNodeOrToken value; 538SyntaxNodeOrToken value; 579SyntaxNodeOrToken value;
Syntax\SyntaxNodeOrToken.cs (57)
25public readonly struct SyntaxNodeOrToken : IEquatable<SyntaxNodeOrToken> 142/// Determines whether this <see cref="SyntaxNodeOrToken"/> is wrapping a token. 147/// Determines whether this <see cref="SyntaxNodeOrToken"/> is wrapping a node. 152/// Returns the underlying token if this <see cref="SyntaxNodeOrToken"/> is wrapping a 156/// The underlying token if this <see cref="SyntaxNodeOrToken"/> is wrapping a token. 181/// Returns the underlying node if this <see cref="SyntaxNodeOrToken"/> is wrapping a 185/// The underlying node if this <see cref="SyntaxNodeOrToken"/> is wrapping a node. 397public SyntaxNodeOrToken WithLeadingTrivia(IEnumerable<SyntaxTrivia> trivia) 412public SyntaxNodeOrToken WithLeadingTrivia(params SyntaxTrivia[] trivia) 417public SyntaxNodeOrToken WithTrailingTrivia(IEnumerable<SyntaxTrivia> trivia) 432public SyntaxNodeOrToken WithTrailingTrivia(params SyntaxTrivia[] trivia) 616public SyntaxNodeOrToken WithAdditionalAnnotations(params SyntaxAnnotation[] annotations) 624public SyntaxNodeOrToken WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation> annotations) 647public SyntaxNodeOrToken WithoutAnnotations(params SyntaxAnnotation[] annotations) 655public SyntaxNodeOrToken WithoutAnnotations(IEnumerable<SyntaxAnnotation> annotations) 678public SyntaxNodeOrToken WithoutAnnotations(string annotationKind) 696/// Determines whether the supplied <see cref="SyntaxNodeOrToken"/> is equal to this 697/// <see cref="SyntaxNodeOrToken"/>. 699public bool Equals(SyntaxNodeOrToken other) 712/// Determines whether two <see cref="SyntaxNodeOrToken"/>s are equal. 714public static bool operator ==(SyntaxNodeOrToken left, SyntaxNodeOrToken right) 720/// Determines whether two <see cref="SyntaxNodeOrToken"/>s are unequal. 722public static bool operator !=(SyntaxNodeOrToken left, SyntaxNodeOrToken right) 728/// Determines whether the supplied <see cref="SyntaxNodeOrToken"/> is equal to this 729/// <see cref="SyntaxNodeOrToken"/>. 733return obj is SyntaxNodeOrToken token && Equals(token); 737/// Serves as hash function for <see cref="SyntaxNodeOrToken"/>. 747public bool IsEquivalentTo(SyntaxNodeOrToken other) 763public bool IsIncrementallyIdenticalTo(SyntaxNodeOrToken other) 767/// Returns a new <see cref="SyntaxNodeOrToken"/> that wraps the supplied token. 771/// A <see cref="SyntaxNodeOrToken"/> that wraps the supplied token. 773public static implicit operator SyntaxNodeOrToken(SyntaxToken token) 779/// Returns the underlying token wrapped by the supplied <see cref="SyntaxNodeOrToken"/>. 782/// The input <see cref="SyntaxNodeOrToken"/>. 785/// The underlying token wrapped by the supplied <see cref="SyntaxNodeOrToken"/>. 787public static explicit operator SyntaxToken(SyntaxNodeOrToken nodeOrToken) 793/// Returns a new <see cref="SyntaxNodeOrToken"/> that wraps the supplied node. 797/// A <see cref="SyntaxNodeOrToken"/> that wraps the supplied node. 799public static implicit operator SyntaxNodeOrToken(SyntaxNode? node) 807/// Returns the underlying node wrapped by the supplied <see cref="SyntaxNodeOrToken"/>. 810/// The input <see cref="SyntaxNodeOrToken"/>. 813/// The underlying node wrapped by the supplied <see cref="SyntaxNodeOrToken"/>. 815public static explicit operator SyntaxNode?(SyntaxNodeOrToken nodeOrToken) 848private static void GetDirectives<TDirective>(in SyntaxNodeOrToken node, Func<TDirective, bool>? filter, out IList<TDirective> directives) 917var m = list[r]; 949public SyntaxNodeOrToken GetNextSibling() 954return default(SyntaxNodeOrToken); 964public SyntaxNodeOrToken GetPreviousSibling() 971foreach (var child in this.Parent.ChildNodesAndTokens().Reverse()) 985return default(SyntaxNodeOrToken); 988private SyntaxNodeOrToken GetNextSiblingFromStart(ChildSyntaxList siblings) 991foreach (var sibling in siblings) 1004return default(SyntaxNodeOrToken); 1007private SyntaxNodeOrToken GetNextSiblingWithSearch(ChildSyntaxList siblings) 1027return default(SyntaxNodeOrToken);
Syntax\SyntaxNodeOrTokenList.cs (39)
19/// A list of <see cref="SyntaxNodeOrToken"/> structures. 22public readonly struct SyntaxNodeOrTokenList : IEquatable<SyntaxNodeOrTokenList>, IReadOnlyCollection<SyntaxNodeOrToken> 51/// Create a <see cref="SyntaxNodeOrTokenList"/> from a sequence of <see cref="SyntaxNodeOrToken"/>. 54public SyntaxNodeOrTokenList(IEnumerable<SyntaxNodeOrToken> nodesAndTokens) 60/// Create a <see cref="SyntaxNodeOrTokenList"/> from one or more <see cref="SyntaxNodeOrToken"/>. 63public SyntaxNodeOrTokenList(params SyntaxNodeOrToken[] nodesAndTokens) 68public static SyntaxNodeOrTokenList Create(ReadOnlySpan<SyntaxNodeOrToken> nodesAndTokens) 76private static SyntaxNode? CreateNodeFromSpan(ReadOnlySpan<SyntaxNodeOrToken> nodesAndTokens) 101private static SyntaxNode? CreateNode(IEnumerable<SyntaxNodeOrToken> nodesAndTokens) 129/// Gets the <see cref="SyntaxNodeOrToken"/> at the specified index. 132public SyntaxNodeOrToken this[int index] 207public SyntaxNodeOrToken First() 215public SyntaxNodeOrToken FirstOrDefault() 219: default(SyntaxNodeOrToken); 225public SyntaxNodeOrToken Last() 233public SyntaxNodeOrToken LastOrDefault() 237: default(SyntaxNodeOrToken); 241/// Returns the index from the list for the given <see cref="SyntaxNodeOrToken"/>. 245public int IndexOf(SyntaxNodeOrToken nodeOrToken) 248foreach (var child in this) 289public SyntaxNodeOrTokenList Add(SyntaxNodeOrToken nodeOrToken) 298public SyntaxNodeOrTokenList AddRange(IEnumerable<SyntaxNodeOrToken> nodesOrTokens) 308public SyntaxNodeOrTokenList Insert(int index, SyntaxNodeOrToken nodeOrToken) 310if (nodeOrToken == default(SyntaxNodeOrToken)) 323public SyntaxNodeOrTokenList InsertRange(int index, IEnumerable<SyntaxNodeOrToken> nodesAndTokens) 345private static SyntaxNodeOrTokenList CreateList(List<SyntaxNodeOrToken> items) 384public SyntaxNodeOrTokenList Remove(SyntaxNodeOrToken nodeOrTokenInList) 400public SyntaxNodeOrTokenList Replace(SyntaxNodeOrToken nodeOrTokenInList, SyntaxNodeOrToken newNodeOrToken) 402if (newNodeOrToken == default(SyntaxNodeOrToken)) 415public SyntaxNodeOrTokenList ReplaceRange(SyntaxNodeOrToken nodeOrTokenInList, IEnumerable<SyntaxNodeOrToken> newNodesAndTokens) 431private SyntaxNodeOrToken[] Nodes 451IEnumerator<SyntaxNodeOrToken> IEnumerable<SyntaxNodeOrToken>.GetEnumerator() 454? SpecializedCollections.EmptyEnumerator<SyntaxNodeOrToken>() 467? SpecializedCollections.EmptyEnumerator<SyntaxNodeOrToken>() 537public struct Enumerator : IEnumerator<SyntaxNodeOrToken> 569public SyntaxNodeOrToken Current => _list[_index];
Syntax\SyntaxNodeOrTokenListBuilder.cs (6)
37public SyntaxNodeOrToken this[int index] 81public void Add(in SyntaxNodeOrToken item) 103public void Add(IEnumerable<SyntaxNodeOrToken> nodeOrTokens) 105foreach (var n in nodeOrTokens) 111public void Add(ReadOnlySpan<SyntaxNodeOrToken> nodeOrTokens) 113foreach (var n in nodeOrTokens)
Syntax\SyntaxTree.cs (1)
208public abstract IEnumerable<Diagnostic> GetDiagnostics(SyntaxNodeOrToken nodeOrToken);
Syntax\SyntaxWalker.cs (1)
36foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CodeStyle (67)
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (1)
58foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
57foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (2)
50public readonly SyntaxNodeOrToken ValuePattern; 62SyntaxNodeOrToken valuePattern,
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (1)
72foreach (var child in containingBlockOrCompilationUnit.ChildNodesAndTokens())
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (1)
197foreach (var child in node.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ChildSyntaxListExtensions.cs (6)
12public static SyntaxNodeOrToken First(this ChildSyntaxList childSyntaxList, Func<SyntaxNodeOrToken, bool> predicate) 14foreach (var syntaxNodeOrToken in childSyntaxList) 24public static SyntaxNodeOrToken Last(this ChildSyntaxList childSyntaxList, Func<SyntaxNodeOrToken, bool> predicate) 26foreach (var syntaxNodeOrToken in childSyntaxList.Reverse())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (2)
113var c1 = e1.Current; 114var c2 = e2.Current;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
138foreach (var child in node.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
26public static IEnumerable<SyntaxNodeOrToken> DepthFirstTraversal(this SyntaxNode node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeOrTokenExtensions.cs (13)
14public static bool AsNode(this SyntaxNodeOrToken nodeOrToken, [NotNullWhen(true)] out SyntaxNode? node) 26public static IEnumerable<SyntaxNodeOrToken> DepthFirstTraversal(this SyntaxNodeOrToken node) 28using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject(); 32while (stack.TryPop(out var current)) 38foreach (var child in current.ChildNodesAndTokens().Reverse()) 44public static IEnumerable<SyntaxNode> DepthFirstTraversalNodes(this SyntaxNodeOrToken node) 46foreach (var t in node.DepthFirstTraversal()) 53public static SyntaxTrivia[] GetTrivia(params SyntaxNodeOrToken[] nodesOrTokens) 56public static SyntaxNodeOrToken WithAppendedTrailingTrivia(this SyntaxNodeOrToken nodeOrToken, params SyntaxTrivia[] trivia) 59public static SyntaxNodeOrToken WithAppendedTrailingTrivia(this SyntaxNodeOrToken nodeOrToken, IEnumerable<SyntaxTrivia> trivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (3)
54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (6)
87var thisTokenAncestor = GetAncestorUnderRoot(this.Token, commonRoot); 88var otherTokenAncestor = GetAncestorUnderRoot(other.Token, commonRoot); 90foreach (var child in commonRoot.ChildNodesAndTokens()) 100static SyntaxNodeOrToken GetAncestorUnderRoot(SyntaxNodeOrToken start, SyntaxNode root) 102var current = start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
280foreach (var nodeOrToken in node.GetAnnotatedNodesAndTokens(annotation))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
33public bool IsOnHeader(SyntaxNode root, int position, SyntaxNode ownerOfHeader, SyntaxNodeOrToken lastTokenOrNodeOfHeader) 40SyntaxNodeOrToken lastTokenOrNodeOfHeader,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (4)
20private static readonly ObjectPool<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>> s_stackPool 21= SharedPools.Default<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>>(); 48ISyntaxFacts syntaxFacts, Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)> stack) 71foreach (var child in childNodesAndTokens.Reverse())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AliasSymbolKey.cs (1)
86foreach (var child in syntaxNode.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (11)
84public SyntaxNodeOrToken WithAdditionalAnnotations(SyntaxNodeOrToken nodeOrToken, params TAnnotation[] annotations) 96public SyntaxNodeOrToken WithoutAnnotations(SyntaxNodeOrToken nodeOrToken, params TAnnotation[] annotations) 120public IEnumerable<TAnnotation> GetAnnotations(SyntaxNodeOrToken nodeOrToken) 132public IEnumerable<TSpecificAnnotation> GetAnnotations<TSpecificAnnotation>(SyntaxNodeOrToken nodeOrToken) where TSpecificAnnotation : TAnnotation 144public bool HasAnnotations(SyntaxNodeOrToken nodeOrToken) 156public bool HasAnnotations<TSpecificAnnotation>(SyntaxNodeOrToken nodeOrToken) where TSpecificAnnotation : TAnnotation 168public bool HasAnnotation(SyntaxNodeOrToken nodeOrToken, TAnnotation annotation) 171public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(SyntaxNode node) 183public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens<TSpecificAnnotation>(SyntaxNode node) where TSpecificAnnotation : TAnnotation
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SyntaxPath.cs (10)
46public SyntaxPath(SyntaxNodeOrToken nodeOrToken, bool trackKinds = true) 54private void AddSegment(SyntaxNodeOrToken nodeOrToken) 69foreach (var child in parent.ChildNodesAndTokens()) 91public bool TryResolve(SyntaxNode? root, out SyntaxNodeOrToken nodeOrToken) 95var current = (SyntaxNodeOrToken)root; 115private SyntaxNodeOrToken FindChild(SyntaxNodeOrToken current, PathSegment segment) 118foreach (var child in current.ChildNodesAndTokens()) 145if (TryResolve(root, out var nodeOrToken) &&
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
369var sibling = children[index]; 413foreach (var child in children)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractReducer.IExpressionRewriter.cs (2)
18SyntaxNodeOrToken VisitNodeOrToken(SyntaxNodeOrToken nodeOrTokenToReduce, SemanticModel semanticModel, bool simplifyAllDescendants);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation); 40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans); 146bool IsNodeOrTokenOutsideSimplifySpans(SyntaxNodeOrToken nodeOrToken) 188var nodeOrToken = nodeOrTokenToReduce.OriginalNodeOrToken; 190var currentNodeOrToken = nodeOrTokenToReduce.NodeOrToken; 275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\NodeOrTokenToReduce.cs (2)
8SyntaxNodeOrToken NodeOrToken, 10SyntaxNodeOrToken OriginalNodeOrToken);
Microsoft.CodeAnalysis.CSharp (67)
Binder\Binder.cs (11)
559internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxNodeOrToken syntax) 566internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxNodeOrToken syntax, params object[] args) 594ReportDiagnosticsIfObsolete(diagnostics, symbol, (SyntaxNodeOrToken)node, hasBaseReceiver); 602internal void ReportDiagnosticsIfObsolete(DiagnosticBag diagnostics, Symbol symbol, SyntaxNodeOrToken node, bool hasBaseReceiver) 616internal void ReportDiagnosticsIfObsolete(BindingDiagnosticBag diagnostics, Symbol symbol, SyntaxNodeOrToken node, bool hasBaseReceiver) 624internal void ReportDiagnosticsIfObsolete(BindingDiagnosticBag diagnostics, Conversion conversion, SyntaxNodeOrToken node, bool hasBaseReceiver) 635SyntaxNodeOrToken node, 701SyntaxNodeOrToken node, 713internal static ObsoleteDiagnosticKind ReportDiagnosticsIfObsoleteInternal(DiagnosticBag diagnostics, Symbol symbol, SyntaxNodeOrToken node, Symbol? containingMember, BinderFlags location) 744internal static void ReportDiagnosticsIfObsoleteInternal(BindingDiagnosticBag diagnostics, Symbol symbol, SyntaxNodeOrToken node, Symbol containingMember, BinderFlags location) 752internal static void ReportDiagnosticsIfUnmanagedCallersOnly(BindingDiagnosticBag diagnostics, MethodSymbol symbol, SyntaxNodeOrToken syntax, bool isDelegateConversion)
Binder\Binder_Await.cs (3)
45internal void ReportBadAwaitDiagnostics(SyntaxNodeOrToken nodeOrToken, BindingDiagnosticBag diagnostics, ref bool hasErrors) 148private bool ReportBadAwaitWithoutAsync(SyntaxNodeOrToken nodeOrToken, BindingDiagnosticBag diagnostics) 203private bool ReportBadAwaitContext(SyntaxNodeOrToken nodeOrToken, BindingDiagnosticBag diagnostics)
Binder\Binder_Expressions.cs (1)
2478private bool IsRefOrOutThisParameterCaptured(SyntaxNodeOrToken thisOrBaseToken, BindingDiagnosticBag diagnostics)
Binder\Binder_Symbols.cs (1)
788private static bool CheckTupleMemberName(string name, int index, SyntaxNodeOrToken syntax, BindingDiagnosticBag diagnostics, PooledHashSet<string> uniqueFieldNames)
Binder\RefSafetyAnalysis.cs (1)
1132private static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxNodeOrToken syntax, params object[] args)
CSharpExtensions.cs (6)
53/// Determines if <see cref="SyntaxNodeOrToken"/> is of a specified kind. 58public static bool IsKind(this SyntaxNodeOrToken nodeOrToken, SyntaxKind kind) 214/// Returns <see cref="SyntaxKind"/> for <see cref="SyntaxNode"/> from <see cref="SyntaxNodeOrToken.RawKind"/> property. 216public static SyntaxKind Kind(this SyntaxNodeOrToken nodeOrToken) 332internal static Syntax.InternalSyntax.DirectiveStack ApplyDirectives(this SyntaxNodeOrToken nodeOrToken, Syntax.InternalSyntax.DirectiveStack stack) 355foreach (var i in list)
FlowAnalysis\NullableWalker.cs (2)
1047SyntaxNodeOrToken syntax = syntaxOpt switch 1051_ => syntaxOpt ?? (SyntaxNodeOrToken)methodMainNode.Syntax.GetLastToken()
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (3)
53private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 84private static int GetEndPosition(SyntaxNodeOrToken nodeOrToken)
Parser\Blender.Cursor.cs (9)
29public readonly SyntaxNodeOrToken CurrentNodeOrToken; 32private Cursor(SyntaxNodeOrToken node, int indexInParent) 53private static bool IsNonZeroWidthOrIsEndOfFile(SyntaxNodeOrToken token) 71var sibling = siblings[i]; 117var index = SyntaxNodeOrToken.GetFirstChildIndexSpanningPosition(children, ((CSharp.CSharpSyntaxNode)node).Position); 120var child = children[i]; 155var child = Microsoft.CodeAnalysis.ChildSyntaxList.ItemInternal(node, 0); 164foreach (var child in this.CurrentNodeOrToken.ChildNodesAndTokens()) 182for (var node = cursor.CurrentNodeOrToken; node.Kind() != SyntaxKind.None && !SyntaxFacts.IsAnyToken(node.Kind()); node = cursor.CurrentNodeOrToken)
Parser\Blender.Reader.cs (4)
113var node = _oldTreeCursor.CurrentNodeOrToken; 194var currentNodeOrToken = _oldTreeCursor.CurrentNodeOrToken; 215private bool CanReuse(SyntaxNodeOrToken nodeOrToken) 277private bool IntersectsNextChange(SyntaxNodeOrToken nodeOrToken)
Symbols\LabelSymbol.cs (2)
117internal virtual SyntaxNodeOrToken IdentifierNodeOrToken 119get { return default(SyntaxNodeOrToken); }
Symbols\Source\SourceLabelSymbol.cs (3)
16private readonly SyntaxNodeOrToken _identifierNodeOrToken; 28SyntaxNodeOrToken identifierNodeOrToken, 126internal override SyntaxNodeOrToken IdentifierNodeOrToken
Syntax\CompilationUnitSyntax.cs (4)
27var firstToken = (SyntaxNodeOrToken)this.GetFirstToken(includeZeroWidth: true); 40var firstToken = (SyntaxNodeOrToken)this.GetFirstToken(includeZeroWidth: true);
Syntax\CSharpSyntaxNode.cs (5)
224return ((SyntaxNodeOrToken)this).GetDirectives<DirectiveTriviaSyntax>(filter); 232foreach (var child in this.ChildNodesAndTokens()) 272foreach (var child in this.ChildNodesAndTokens().Reverse()) 548static TreeDumperNode makeTree(SyntaxNodeOrToken nodeOrToken) 561static string stringOrMissing(SyntaxNodeOrToken nodeOrToken)
Syntax\CSharpSyntaxTree.cs (1)
848public override IEnumerable<Diagnostic> GetDiagnostics(SyntaxNodeOrToken nodeOrToken)
Syntax\CSharpSyntaxWalker.cs (1)
43var child = ChildSyntaxList.ItemInternal((CSharpSyntaxNode)node, i, ref slotData);
Syntax\SyntaxFactory.cs (7)
1453public static SeparatedSyntaxList<TNode> SeparatedList<TNode>(IEnumerable<SyntaxNodeOrToken> nodesAndTokens) where TNode : SyntaxNode 1483var element = list[i]; 1497var element = list[i]; 1516/// Create a <see cref="SyntaxNodeOrTokenList"/> from a sequence of <see cref="SyntaxNodeOrToken"/>. 1519public static SyntaxNodeOrTokenList NodeOrTokenList(IEnumerable<SyntaxNodeOrToken> nodesAndTokens) 1525/// Create a <see cref="SyntaxNodeOrTokenList"/> from one or more <see cref="SyntaxNodeOrToken"/>. 1528public static SyntaxNodeOrTokenList NodeOrTokenList(params SyntaxNodeOrToken[] nodesAndTokens)
Syntax\SyntaxNodeRemover.cs (3)
215var item = withSeps[i]; 216SyntaxNodeOrToken visited; 223visited = default(SyntaxNodeOrToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (8)
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
51foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
56foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
58foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
35foreach (var child in root.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
65using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
879params SyntaxNodeOrToken[] trailingNodesOrTokens)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
222params SyntaxNodeOrToken[] trailingNodesOrTokens)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
283foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (26)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (9)
126using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 149using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 333var first = elementsWithSeparators.First(); 335var last = elementsWithSeparators.Last(); 346ArrayBuilder<SyntaxNodeOrToken> nodesAndTokens, 399using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 854=> RemoveTrailingWhitespace((SyntaxNodeOrToken)token).AsToken(); 856private static SyntaxNodeOrToken RemoveTrailingWhitespace(SyntaxNodeOrToken nodeOrToken)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (1)
153using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (3)
37using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 75using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 78foreach (var item in nodeOrTokenList)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (2)
171private SyntaxNodeOrToken ConvertTupleTypeElementComponent(SyntaxNodeOrToken nodeOrToken)
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
75using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens);
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (2)
37ArrayBuilder<SyntaxNodeOrToken> nodesAndTokens, 45foreach (var nodeOrToken in objectCreation.Initializer.Expressions.GetWithSeparators())
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (2)
28private static readonly SyntaxNodeOrToken s_omittedArgument = (SyntaxNodeOrToken)OmittedTypeArgument();
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (2)
158using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var arguments); 159foreach (var argument in argumentList.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (2)
26var members = new List<SyntaxNodeOrToken>(); 42var lastMember = members.Last();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
666foreach (var item in argumentList.Arguments.GetWithSeparators())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1833foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
StringCopyPaste\StringCopyPasteHelpers.cs (1)
66public static bool NodeOrTokenContainsError(SyntaxNodeOrToken nodeOrToken)
Microsoft.CodeAnalysis.CSharp.Features (71)
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
113foreach (var item in argumentList.Arguments.GetWithSeparators()) 135foreach (var item in argumentList.Arguments.GetWithSeparators())
ConvertAnonymousType\CSharpConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
71private SyntaxNodeOrToken CreateArgumentOrComma(SyntaxNodeOrToken declOrComma)
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (1)
40using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var result);
EditAndContinue\BreakpointSpans.cs (3)
121private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 152private static int GetEndPosition(SyntaxNodeOrToken nodeOrToken)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (4)
693SyntaxNodeOrToken nodeOrToken = statement; 1653typeDeclaration.TypeParameterList ?? (SyntaxNodeOrToken)typeDeclaration.Identifier); 1939private static TextSpan GetDiagnosticSpan(SyntaxTokenList modifiers, SyntaxNodeOrToken start, SyntaxNodeOrToken end)
EditAndContinue\SyntaxComparer.cs (3)
1411private static SyntaxNodeOrToken? TryGetName(SyntaxNode node) 1542internal static double ComputeDistance(SyntaxNodeOrToken oldNodeOrToken, SyntaxNodeOrToken newNodeOrToken)
Highlighting\KeywordHighlighters\ReturnStatementHighlighter.cs (1)
57foreach (var child in node.ChildNodesAndTokens())
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
85foreach (var childNodeOrToken in node.ChildNodesAndTokens())
Highlighting\KeywordHighlighters\YieldStatementHighlighter.cs (1)
61foreach (var child in node.ChildNodesAndTokens())
InlineHints\CSharpInlineTypeHintsService.cs (4)
125SyntaxNodeOrToken displayAllSpan, 126SyntaxNodeOrToken normalSpan) 139SyntaxNodeOrToken displayAllSpan, 140SyntaxNodeOrToken normalSpan)
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
51foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
56foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
58foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
35foreach (var child in root.ChildNodesAndTokens())
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
65using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject();
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (9)
126using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 149using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 333var first = elementsWithSeparators.First(); 335var last = elementsWithSeparators.Last(); 346ArrayBuilder<SyntaxNodeOrToken> nodesAndTokens, 399using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 854=> RemoveTrailingWhitespace((SyntaxNodeOrToken)token).AsToken(); 856private static SyntaxNodeOrToken RemoveTrailingWhitespace(SyntaxNodeOrToken nodeOrToken)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (1)
153using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (3)
37using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 75using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens); 78foreach (var item in nodeOrTokenList)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (2)
171private SyntaxNodeOrToken ConvertTupleTypeElementComponent(SyntaxNodeOrToken nodeOrToken)
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
75using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var nodesAndTokens);
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (2)
37ArrayBuilder<SyntaxNodeOrToken> nodesAndTokens, 45foreach (var nodeOrToken in objectCreation.Initializer.Expressions.GetWithSeparators())
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (2)
28private static readonly SyntaxNodeOrToken s_omittedArgument = (SyntaxNodeOrToken)OmittedTypeArgument();
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (2)
158using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var arguments); 159foreach (var argument in argumentList.ChildNodesAndTokens())
Structure\CSharpStructureHelpers.cs (1)
375foreach (var child in node.ChildNodesAndTokens())
Structure\Providers\AccessorDeclarationStructureProvider.cs (2)
31SyntaxNodeOrToken current = accessorDeclaration; 32var nextSibling = current.GetNextSibling();
Structure\Providers\ConstructorDeclarationStructureProvider.cs (2)
31SyntaxNodeOrToken current = constructorDeclaration; 32var nextSibling = current.GetNextSibling();
Structure\Providers\ConversionOperatorDeclarationStructureProvider.cs (2)
33SyntaxNodeOrToken current = operatorDeclaration; 34var nextSibling = current.GetNextSibling();
Structure\Providers\EnumDeclarationStructureProvider.cs (2)
26SyntaxNodeOrToken current = enumDeclaration; 27var nextSibling = current.GetNextSibling();
Structure\Providers\EventDeclarationStructureProvider.cs (2)
32SyntaxNodeOrToken current = eventDeclaration; 33var nextSibling = current.GetNextSibling();
Structure\Providers\IndexerDeclarationStructureProvider.cs (2)
32SyntaxNodeOrToken current = indexerDeclaration; 33var nextSibling = current.GetNextSibling();
Structure\Providers\MethodDeclarationStructureProvider.cs (2)
31SyntaxNodeOrToken current = methodDeclaration; 32var nextSibling = current.GetNextSibling();
Structure\Providers\OperatorDeclarationStructureProvider.cs (2)
31SyntaxNodeOrToken current = operatorDeclaration; 32var nextSibling = current.GetNextSibling();
Structure\Providers\PropertyDeclarationStructureProvider.cs (2)
31SyntaxNodeOrToken current = propertyDeclaration; 32var nextSibling = current.GetNextSibling();
Structure\Providers\TypeDeclarationStructureProvider.cs (2)
32SyntaxNodeOrToken current = typeDeclaration; 33var nextSibling = current.GetNextSibling();
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
190foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\InteractiveSemanticModelTests.cs (1)
288foreach (var child in node.ChildNodesAndTokens())
Semantics\TopLevelStatementsTests.cs (2)
8805var node1 = nodes1[i]; 8806var node2 = nodes2[i];
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
4790foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (114)
IncrementalParsing\ChangingAsync.cs (4)
32Assert.Equal(default(SyntaxNodeOrToken), oldTree.FindNodeOrTokenByKind(SyntaxKind.AwaitExpression)); 33Assert.NotEqual(default(SyntaxNodeOrToken), newTree.FindNodeOrTokenByKind(SyntaxKind.AwaitExpression)); 53Assert.NotEqual(default(SyntaxNodeOrToken), oldTree.FindNodeOrTokenByKind(SyntaxKind.AwaitExpression)); 54Assert.Equal(default(SyntaxNodeOrToken), newTree.FindNodeOrTokenByKind(SyntaxKind.AwaitExpression));
IncrementalParsing\GrammarAmbiguities.cs (2)
109private void AssertNodesAreEquivalent(SyntaxNodeOrToken expectedNode, SyntaxNodeOrToken actualNode)
IncrementalParsing\IncrementalParsingTests.cs (7)
113private static void TestDiffsInOrder(ImmutableArray<SyntaxNodeOrToken> diffs, params SyntaxKind[] kinds) 3709private void WalkTreeAndVerify(SyntaxNodeOrToken incNode, SyntaxNodeOrToken fullNode) 3717var incChild = incChildren[i]; 3718var fullChild = fullChildren[i]; 3777private static void CompareTreeEquivalence(SyntaxNodeOrToken parsedTreeNode, SyntaxNodeOrToken incrementalTreeNode)
IncrementalParsing\SyntaxDifferences.cs (7)
23public static ImmutableArray<SyntaxNodeOrToken> GetRebuiltNodes(SyntaxTree oldTree, SyntaxTree newTree) 28var nodes = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(); 33private static void GetRebuiltNodes(SyntaxNodeOrToken newNode, HashSet<GreenNode> hashSet, ArrayBuilder<SyntaxNodeOrToken> nodes) 42foreach (var child in newNode.ChildNodesAndTokens()) 48private static void GatherNodes(SyntaxNodeOrToken node, HashSet<GreenNode> hashSet) 51foreach (var child in node.ChildNodesAndTokens())
ParentChecker.cs (2)
16public static void CheckParents(SyntaxNodeOrToken nodeOrToken, SyntaxTree expectedSyntaxTree) 54foreach (var child in node.ChildNodesAndTokens())
Parsing\ParsingErrorRecoveryTests.cs (3)
7279var classDecl = file.ChildNodesAndTokens()[0]; 7282var methodDecl = classDecl.ChildNodesAndTokens()[3]; 7286var methodBody = methodDecl.ChildNodesAndTokens()[3];
Parsing\ParsingTests.cs (9)
23private IEnumerator<SyntaxNodeOrToken>? _treeEnumerator; 53foreach (var _ in EnumerateNodes(_node!, dump: true)) { } 199protected SyntaxNodeOrToken N(SyntaxKind kind, string? value = null) 204var current = _treeEnumerator.Current; 227protected SyntaxNodeOrToken M(SyntaxKind kind) 232SyntaxNodeOrToken current = _treeEnumerator.Current; 257private IEnumerable<SyntaxNodeOrToken> EnumerateNodes(CSharpSyntaxNode node, bool dump) 276var current = en.Current; 294private void Print(SyntaxNodeOrToken node, bool dump)
Parsing\SyntaxExtensions.cs (3)
71internal static ImmutableArray<DiagnosticInfo> Errors(this SyntaxNodeOrToken nodeOrToken) 76internal static ImmutableArray<DiagnosticInfo> Warnings(this SyntaxNodeOrToken nodeOrToken) 81internal static ImmutableArray<DiagnosticInfo> ErrorsAndWarnings(this SyntaxNodeOrToken nodeOrToken)
Syntax\SyntaxAnnotationTests.cs (28)
358var oldNode = actualNodesOrTokens.ElementAt(i); 359var annotatedNode = annotatedNodesOrTokens.ElementAt(i); 435var nodeOrTokenMap = new Dictionary<SyntaxNodeOrToken, SyntaxNodeOrToken>(); 471var annotations = new List<Tuple<SyntaxAnnotation, SyntaxNodeOrToken>>(); 483var rootAnnotated = AddAnnotationTo(rootAnnotation, currentRoot); 489var item = GetAllNodesAndTokens(currentRoot)[randomGenerator.Next(count - 1)]; 494var annotated = AddAnnotationTo(annotation, item); 515var firstItem = candidatePool[randomGenerator.Next(numberOfCandidates - 1)]; 516var firstAnnotated = AddAnnotationTo(firstAnnotation, firstItem); 523var secondItem = GetAllNodesAndTokens(newRoot)[randomGenerator.Next(numberOfCandidates - 1)]; 524var secondAnnotated = AddAnnotationTo(secondAnnotation, secondItem); 535public TRoot Replace<TRoot>(TRoot root, SyntaxNodeOrToken oldNodeOrToken, SyntaxNodeOrToken newNodeOrToken) where TRoot : SyntaxNode 545public SyntaxNodeOrToken AddAnnotationTo(SyntaxAnnotation annotation, SyntaxNodeOrToken nodeOrToken) 550private void TestAnnotations(List<Tuple<SyntaxAnnotation, SyntaxNodeOrToken>> annotations, SyntaxNode currentRoot) 556var nodeOrToken = pair.Item2; 583var nodeOrToken = allNodesAndTokens[i]; 602private void TestAnnotation(SyntaxAnnotation annotation, SyntaxNode root, SyntaxNodeOrToken oldNodeOrToken) 664private List<SyntaxNodeOrToken> GetAllNodesAndTokens(SyntaxNode root) 666return root.DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).Select(n => (SyntaxNodeOrToken)n).ToList(); 671public List<SyntaxNodeOrToken> NodeOrTokens { get; } 677this.NodeOrTokens = new List<SyntaxNodeOrToken>(); 812private readonly Dictionary<SyntaxNodeOrToken, SyntaxNodeOrToken> _nodeOrTokenMap; 815public CopyAnnotationRewriter(Dictionary<SyntaxNodeOrToken, SyntaxNodeOrToken> nodeOrTokenMap, Dictionary<SyntaxTrivia, SyntaxTrivia> triviaMap) :
Syntax\SyntaxListTests.cs (7)
297var item = ChildSyntaxList.ChildThatContainsPosition(parsedArgumentList, position); 334foreach (var child in node.ChildNodesAndTokens()) 358foreach (var child in node.ChildNodesAndTokens().Reverse()) 371var builder = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(); 372foreach (var node in parseAndGetInitializer(source).ChildNodesAndTokens().Reverse()) 379builder = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(); 380foreach (var node in parseAndGetInitializer(source).ChildNodesAndTokens())
Syntax\SyntaxNodeOrTokenListTests.cs (16)
58SyntaxNodeOrToken tokenD = SyntaxFactory.ParseToken("D "); 59SyntaxNodeOrToken nameE = SyntaxFactory.ParseExpression("E "); 145newList = list.ReplaceRange(elementA, new SyntaxNodeOrToken[] { }); 149newList = list.ReplaceRange(elementB, new SyntaxNodeOrToken[] { }); 153newList = list.ReplaceRange(elementC, new SyntaxNodeOrToken[] { }); 166Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxNodeOrToken))); 167Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxNodeOrToken))); 168Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxNodeOrToken>)null)); 169Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxNodeOrToken>)null)); 170Assert.Throws<ArgumentNullException>(() => list.ReplaceRange(elementA, (IEnumerable<SyntaxNodeOrToken>)null)); 185SyntaxNodeOrToken tokenD = SyntaxFactory.ParseToken("D "); 186SyntaxNodeOrToken nodeE = SyntaxFactory.ParseExpression("E "); 213Assert.Throws<ArgumentOutOfRangeException>(() => list.Add(default(SyntaxNodeOrToken))); 214Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(0, default(SyntaxNodeOrToken))); 215Assert.Throws<ArgumentNullException>(() => list.AddRange((IEnumerable<SyntaxNodeOrToken>)null)); 216Assert.Throws<ArgumentNullException>(() => list.InsertRange(0, (IEnumerable<SyntaxNodeOrToken>)null));
Syntax\SyntaxNodeTests.cs (26)
1301var list = new List<SyntaxNodeOrToken>(); 1302for (var child = children[0]; child.Kind() != SyntaxKind.None; child = child.GetNextSibling()) 1320var list = new List<SyntaxNodeOrToken>(); 1321for (var child = children[children.Count - 1]; child.Kind() != SyntaxKind.None; child = child.GetPreviousSibling()) 1337var child = tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0]; 1339Assert.Equal((SyntaxNodeOrToken)member, child); 1342var nameChild = member.ChildNodesAndTokens()[3]; 1343Assert.Equal((SyntaxNodeOrToken)name, nameChild); 1347Assert.Equal((SyntaxNodeOrToken)closeBraceToken, closeBraceChild); 1809var nodeOrToken = (SyntaxNodeOrToken)namespaceNode; 1823var nodeOrToken = (SyntaxNodeOrToken)syntaxTree.GetRoot(); 1825Action<SyntaxNodeOrToken> walk = null; 1826walk = (SyntaxNodeOrToken nOrT) => 1829foreach (var child in nOrT.ChildNodesAndTokens()) 1914SyntaxFactory.SeparatedList<ExpressionSyntax>(new SyntaxNodeOrToken[] { omittedArraySize, missingComma, omittedArraySize, missingComma, omittedArraySize, missingComma, omittedArraySize }), 3376var unused = list[0]; 3518SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken }); 3519SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType }); 3520SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, intType, commaToken }); 3522Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { commaToken })); 3523Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, commaToken, commaToken })); 3524Assert.Throws<ArgumentException>(() => SyntaxFactory.SeparatedList<TypeSyntax>(new SyntaxNodeOrToken[] { intType, intType })); 3556var nodeOrToken = children.First(); 3801SyntaxNodeOrToken nodeOrToken = SyntaxFactory.Identifier("goo");
Microsoft.CodeAnalysis.CSharp.Test.Utilities (9)
CSharpTestBase.cs (1)
1572foreach (var child in node.ChildNodesAndTokens())
Extensions.cs (7)
47public static SyntaxNodeOrToken FindNodeOrTokenByKind(this SyntaxTree syntaxTree, SyntaxKind kind, int occurrence = 1) 53SyntaxNodeOrToken foundNode = default(SyntaxNodeOrToken); 58return default(SyntaxNodeOrToken); 61private static bool TryFindNodeOrToken(SyntaxNodeOrToken node, SyntaxKind kind, ref int occurrence, ref SyntaxNodeOrToken foundNode) 75foreach (var child in node.ChildNodesAndTokens())
SemanticModelTestBase.cs (1)
48foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CSharp.Workspaces (18)
Classification\Worker.cs (1)
69private void ClassifyNodeOrToken(SyntaxNodeOrToken nodeOrToken)
Classification\Worker_Preprocesser.cs (1)
298foreach (var nodeOrToken in node.ErrorCodes.GetWithSeparators())
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
169using var pooledQueue = SharedPools.Default<Queue<SyntaxNodeOrToken>>().GetPooledObject();
Simplification\CSharpSimplificationService.cs (1)
178protected override ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans)
Simplification\CSharpSimplificationService.NodesAndTokensToReduceComputer.cs (3)
21private readonly Func<SyntaxNodeOrToken, bool> _isNodeOrTokenOutsideSimplifySpans; 29public static ImmutableArray<NodeOrTokenToReduce> Compute(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans) 36private NodesAndTokensToReduceComputer(Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans)
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (2)
188public SyntaxNodeOrToken VisitNodeOrToken(SyntaxNodeOrToken nodeOrToken, SemanticModel semanticModel, bool simplifyAllDescendants)
Simplification\Simplifiers\NameSimplifier.cs (2)
140foreach (var annotatedNodeOrToken in annotatedNodesOrTokens) 153foreach (var annotatedNodeOrToken in annotatedNodesOrTokens)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
879params SyntaxNodeOrToken[] trailingNodesOrTokens)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
222params SyntaxNodeOrToken[] trailingNodesOrTokens)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
283foreach (var child in node.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (2)
26var members = new List<SyntaxNodeOrToken>(); 42var lastMember = members.Last();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
666foreach (var item in argumentList.Arguments.GetWithSeparators())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1833foreach (var child in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
CodeGeneration\SyntaxGeneratorTests.cs (1)
1254new SyntaxNodeOrToken[]{
Microsoft.CodeAnalysis.EditorFeatures (7)
CodeActions\CodeActionEditHandlerService.cs (1)
350if (pathToRenameToken.TryResolve(latestRoot, out var resolvedRenameToken) &&
TextStructureNavigation\AbstractTextStructureNavigatorProvider.TextStructureNavigator.cs (6)
290private static SyntaxNodeOrToken? FindLeafNode(SnapshotSpan span, CancellationToken cancellationToken) 297SyntaxNodeOrToken? node = token; 326private static SyntaxNodeOrToken SkipSameSpanParents(SyntaxNodeOrToken node) 340private static SyntaxNodeOrToken? GetEnclosingNode(SyntaxNodeOrToken node)
Microsoft.CodeAnalysis.Features (59)
BracePairs\IBracePairsService.cs (1)
51using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject();
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (2)
182foreach (var child in current.ChildNodesAndTokens()) 459foreach (var child in current.ChildNodesAndTokens())
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (2)
723private SyntaxNodeOrToken ConvertArgumentOrToken(SyntaxGenerator generator, NamingRule parameterNamingRule, bool isRecord, SyntaxNodeOrToken arg)
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
86using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject();
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionAnalyzer.cs (1)
66foreach (var child in node.ChildNodesAndTokens())
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (1)
59foreach (var child in node.ChildNodesAndTokens())
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
453foreach (var nodeOrToken in node.ChildNodesAndTokens())
SignatureHelp\CommonSignatureHelpUtilities.cs (1)
63foreach (var element in getArgumentsWithSeparators(argumentList))
SpellCheck\AbstractSpellCheckSpanService.cs (2)
68using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var stack); 262using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var stack);
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
83SyntaxNodeOrToken current = token;
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (1)
58foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
57foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (2)
50public readonly SyntaxNodeOrToken ValuePattern; 62SyntaxNodeOrToken valuePattern,
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (1)
197foreach (var child in node.ChildNodesAndTokens())
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
369var sibling = children[index]; 413foreach (var child in children)
Structure\Syntax\BlockSpanCollector.cs (1)
49foreach (var nodeOrToken in root.DescendantNodesAndTokensAndSelf(descendIntoTrivia: true))
Wrapping\AbstractCodeActionComputer.cs (2)
82protected Task<string> GetSmartIndentationAfterAsync(SyntaxNodeOrToken nodeOrToken, CancellationToken cancellationToken) 86SyntaxNodeOrToken nodeOrToken, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken)
Wrapping\AbstractWrapper.cs (2)
38Document document, IEnumerable<SyntaxNodeOrToken> nodesAndTokens, CancellationToken cancellationToken) 47foreach (var item in nodesAndTokens)
Wrapping\BinaryExpression\AbstractBinaryExpressionWrapper.cs (5)
78var item = exprsAndOperators[i]; 95private ImmutableArray<SyntaxNodeOrToken> GetExpressionsAndOperators( 98using var _ = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var result); 104PrecedenceKind precedence, SyntaxNode expr, ArrayBuilder<SyntaxNodeOrToken> result) 107using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject();
Wrapping\BinaryExpression\BinaryExpressionCodeActionComputer.cs (2)
25private readonly ImmutableArray<SyntaxNodeOrToken> _exprsAndOperators; 52ImmutableArray<SyntaxNodeOrToken> exprsAndOperators)
Wrapping\ChainedExpression\AbstractChainedExpressionWrapper.cs (13)
116private ImmutableArray<ImmutableArray<SyntaxNodeOrToken>> GetChainChunks(SyntaxNode node) 122using var _1 = ArrayBuilder<SyntaxNodeOrToken>.GetInstance(out var pieces); 133using var _2 = ArrayBuilder<ImmutableArray<SyntaxNodeOrToken>>.GetInstance(out var chunks); 139ArrayBuilder<SyntaxNodeOrToken> pieces, 140ArrayBuilder<ImmutableArray<SyntaxNodeOrToken>> chunks) 198ArrayBuilder<SyntaxNodeOrToken> pieces, bool firstChunk, int index) 218private static bool IsNode<TNode>(ArrayBuilder<SyntaxNodeOrToken> pieces, int index) 224private static bool IsToken(int tokenKind, ArrayBuilder<SyntaxNodeOrToken> pieces, int index) 230private static ImmutableArray<SyntaxNodeOrToken> GetSubRange( 231ArrayBuilder<SyntaxNodeOrToken> pieces, int start, int end) 233var result = new FixedSizeArrayBuilder<SyntaxNodeOrToken>(end - start); 268private void Decompose(SyntaxNode node, ArrayBuilder<SyntaxNodeOrToken> pieces) 275using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject();
Wrapping\ChainedExpression\ChainedExpressionCodeActionComputer.cs (5)
46private readonly ImmutableArray<ImmutableArray<SyntaxNodeOrToken>> _chunks; 72ImmutableArray<ImmutableArray<SyntaxNodeOrToken>> chunks) 82var firstPeriod = chunks[0][0]; 174private static int NormalizedWidth(ImmutableArray<SyntaxNodeOrToken> chunk) 190ArrayBuilder<Edit> result, ImmutableArray<SyntaxNodeOrToken> chunk)
Wrapping\Edit.cs (6)
54public static Edit DeleteBetween(SyntaxNodeOrToken left, SyntaxNodeOrToken right) 58SyntaxNodeOrToken left, SyntaxTriviaList leftTrailingTrivia, 59SyntaxTrivia rightLeadingTrivia, SyntaxNodeOrToken right) 65SyntaxNodeOrToken left, SyntaxTriviaList leftTrailingTrivia, 66SyntaxTriviaList rightLeadingTrivia, SyntaxNodeOrToken right)
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (3)
219var last = _listItems.GetWithSeparators().Last(); 339var comma = itemsAndSeparators[i + 1]; 445var item = itemsAndSeparators[i - 1];
Microsoft.CodeAnalysis.Test.Utilities (7)
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (1)
244foreach (var nodeOrToken in context.Tree.GetRoot().DescendantNodesAndTokens())
Syntax\NodeHelpers.cs (3)
26public static string GetKind(this SyntaxNodeOrToken n) 78public static SyntaxNode GetRootNode(this SyntaxNodeOrToken node) 132public static NodeInfo GetNodeInfo(this SyntaxNodeOrToken nodeOrToken)
Syntax\XmlHelpers.cs (3)
66public static void AddInfo(SyntaxNodeOrToken node, XElement xml) 98public static XElement ToXml(this SyntaxNodeOrToken node, SyntaxTree syntaxTree, XmlOptions options = null) 148foreach (var c in node.ChildNodesAndTokens())
Microsoft.CodeAnalysis.UnitTests (6)
CommonSyntaxTests.cs (6)
46var d = default(SyntaxNodeOrToken); 63var d = (SyntaxNodeOrToken)((SyntaxNode)null); 83SyntaxNodeOrToken nodeOrToken = node; 99SyntaxNodeOrToken nodeOrToken = node;
Microsoft.CodeAnalysis.VisualBasic (66)
Analysis\FlowAnalysis\ControlFlowPass.vb (1)
159Dim errorLocation As SyntaxNodeOrToken
Binding\Binder.vb (11)
427Public Function GetSpecialType(typeId As SpecialType, node As SyntaxNodeOrToken, diagBag As BindingDiagnosticBag) As NamedTypeSymbol 432Public Shared Function GetSpecialType(compilation As VisualBasicCompilation, typeId As SpecialType, node As SyntaxNodeOrToken, diagBag As BindingDiagnosticBag) As NamedTypeSymbol 437Public Function GetSpecialType(typeId As SpecialType, node As SyntaxNodeOrToken, diagBag As BindingDiagnosticBag, ByRef reportedAnError As Boolean, suppressUseSiteError As Boolean) As NamedTypeSymbol 441Public Shared Function GetSpecialType(compilation As VisualBasicCompilation, typeId As SpecialType, node As SyntaxNodeOrToken, diagBag As BindingDiagnosticBag, ByRef reportedAnError As Boolean, suppressUseSiteError As Boolean) As NamedTypeSymbol 868Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, syntax As SyntaxNodeOrToken, id As ERRID) 872Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, syntax As SyntaxNodeOrToken, id As ERRID, ParamArray args As Object()) 876Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, syntax As SyntaxNodeOrToken, info As DiagnosticInfo) 898Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, syntax As SyntaxNodeOrToken, id As ERRID) 902Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, syntax As SyntaxNodeOrToken, id As ERRID, ParamArray args As Object()) 906Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, syntax As SyntaxNodeOrToken, info As DiagnosticInfo) 928Public Shared Function ReportUseSite(diagBag As BindingDiagnosticBag, syntax As SyntaxNodeOrToken, useSiteInfo As UseSiteInfo(Of AssemblySymbol)) As Boolean
Binding\Binder_Expressions.vb (2)
578Private Shared Function CheckTupleMemberName(name As String, index As Integer, syntax As SyntaxNodeOrToken, diagnostics As BindingDiagnosticBag, uniqueFieldNames As HashSet(Of String)) As Boolean 3870Private Shared Sub VerifyTypeCharacterConsistency(nodeOrToken As SyntaxNodeOrToken, type As TypeSymbol, typeChar As TypeCharacter, diagnostics As BindingDiagnosticBag)
Binding\Binder_Lambda.vb (1)
35Dim identifierSyntax As SyntaxNodeOrToken = DirectCast(param, UnboundLambdaParameterSymbol).IdentifierSyntax
Binding\Binder_Statements.vb (2)
1822nameSyntax As SyntaxNodeOrToken, 1823identifier As SyntaxNodeOrToken,
Binding\Binder_Symbols.vb (1)
186Friend Shared Function ReportUseSite(diagBag As BindingDiagnosticBag, syntax As SyntaxNodeOrToken, symbol As Symbol) As Boolean
Binding\BindingDiagnosticBag.vb (1)
86Friend Overloads Function Add(syntax As SyntaxNodeOrToken, useSiteInfo As CompoundUseSiteInfo(Of AssemblySymbol)) As Boolean
Binding\ImplicitVariableBinder.vb (1)
182Public Sub RememberPossibleShadowingVariable(name As String, syntax As SyntaxNodeOrToken, errorId As ERRID)
Errors\DiagnosticBagExtensions.vb (1)
78node As SyntaxNodeOrToken,
Semantics\AccessCheck.vb (1)
1154errorLocation As SyntaxNodeOrToken,
Semantics\OverloadResolution.vb (1)
5276Dim typeArgumentsLocation As ImmutableArray(Of SyntaxNodeOrToken) = Nothing
Semantics\TypeInference\TypeArgumentInference.vb (6)
31<Out> ByRef typeArgumentsLocation As ImmutableArray(Of SyntaxNodeOrToken), 133Private _inferredFromLocation As SyntaxNodeOrToken 163Public ReadOnly Property InferredFromLocation As SyntaxNodeOrToken 175Public Sub RegisterInferredType(inferredType As TypeSymbol, inferredFromLocation As SyntaxNodeOrToken, inferredTypeByAssumption As Boolean) 709<Out> ByRef typeArgumentsLocation As ImmutableArray(Of SyntaxNodeOrToken), 876Dim inferredFromLocation(arity - 1) As SyntaxNodeOrToken
Symbols\MethodSymbol.vb (2)
208Friend Overridable Function CallsAreOmitted(atNode As SyntaxNodeOrToken, syntaxTree As SyntaxTree) As Boolean 224Private Function CallsAreConditionallyOmitted(atNode As SyntaxNodeOrToken, syntaxTree As SyntaxTree) As Boolean
Symbols\Source\SourceMethodSymbol.vb (2)
2122Dim errorLocation As SyntaxNodeOrToken = Nothing 2281ByRef errorLocation As SyntaxNodeOrToken,
Symbols\Source\SourcePropertyAccessorSymbol.vb (2)
187Dim errorLocation As SyntaxNodeOrToken = Nothing 223ByRef errorLocation As SyntaxNodeOrToken,
Symbols\Source\SourceSymbolHelpers.vb (1)
12Public Function GetAsClauseLocation(identifier As SyntaxToken, asClauseOpt As AsClauseSyntax) As SyntaxNodeOrToken
Symbols\Source\UnboundLambdaParameterSymbol.vb (4)
21Private ReadOnly _typeSyntax As SyntaxNodeOrToken 30typeSyntax As SyntaxNodeOrToken 50Public ReadOnly Property TypeSyntax As SyntaxNodeOrToken 98If(syntax.AsClause Is Nothing, CType(syntax.Identifier, SyntaxNodeOrToken), syntax.AsClause.Type))
Symbols\SubstitutedMethodSymbol.vb (1)
128Friend Overrides Function CallsAreOmitted(atNode As SyntaxNodeOrToken, syntaxTree As SyntaxTree) As Boolean
Syntax\CompilationUnitSyntax.vb (1)
26Dim firstToken = CType(Me.GetFirstToken(includeZeroWidth:=True), SyntaxNodeOrToken)
Syntax\SyntaxNodeFactories.vb (3)
964Public Shared Function SeparatedList(Of TNode As SyntaxNode)(nodesAndTokens As IEnumerable(Of SyntaxNodeOrToken)) As SeparatedSyntaxList(Of TNode) 1018Public Shared Function NodeOrTokenList(nodesAndTokens As IEnumerable(Of SyntaxNodeOrToken)) As SyntaxNodeOrTokenList 1026Public Shared Function NodeOrTokenList(ParamArray nodesAndTokens As SyntaxNodeOrToken()) As SyntaxNodeOrTokenList
Syntax\SyntaxNodeRemover.vb (1)
144Dim visited As SyntaxNodeOrToken = Nothing
Syntax\VisualBasicSyntaxNode.vb (8)
192Friend Shared Function DoGetSyntaxErrors(tree As SyntaxTree, nodeOrToken As SyntaxNodeOrToken) As ReadOnlyCollection(Of Diagnostic) 198Dim nodesToProcess As New Stack(Of SyntaxNodeOrToken) 233Private Shared Sub PushNodesWithErrors(stack As Stack(Of SyntaxNodeOrToken), nodes As ChildSyntaxList) 246stack As Stack(Of SyntaxNodeOrToken), 271Private Shared Function CreateSyntaxError(tree As SyntaxTree, nodeOrToken As SyntaxNodeOrToken, errorInfo As DiagnosticInfo) As Diagnostic 331Return (CType(Me, SyntaxNodeOrToken)).GetDirectives(Of DirectiveTriviaSyntax)(filter) 335Dim child As SyntaxNodeOrToken 361Dim child As SyntaxNodeOrToken
Syntax\VisualBasicSyntaxTree.ConditionalSymbolsMap.vb (3)
67Friend Function Build(root As SyntaxNodeOrToken, options As VisualBasicParseOptions) As ImmutableDictionary(Of String, Stack(Of Tuple(Of InternalSyntax.CConst, Integer))) 154Private Function GetPreprocessorSymbolValue(conditionalSymbolName As String, node As SyntaxNodeOrToken) As InternalSyntax.CConst 174Friend Function IsConditionalSymbolDefined(conditionalSymbolName As String, node As SyntaxNodeOrToken) As Boolean
Syntax\VisualBasicSyntaxTree.vb (3)
350Public Overrides Function GetDiagnostics(nodeOrToken As SyntaxNodeOrToken) As IEnumerable(Of Diagnostic) 398Private Function InDocumentationComment(node As SyntaxNodeOrToken) As Boolean 583Friend Function IsAnyPreprocessorSymbolDefined(conditionalSymbolNames As IEnumerable(Of String), atNode As SyntaxNodeOrToken) As Boolean
VisualBasicExtensions.vb (6)
56''' Determines if <see cref="SyntaxNodeOrToken"/> is of a specified kind. 62Public Function IsKind(nodeOrToken As SyntaxNodeOrToken, kind As SyntaxKind) As Boolean 214''' Returns <see cref="SyntaxKind"/> for <see cref="SyntaxNodeOrToken"/> from <see cref="SyntaxNodeOrToken.RawKind"/> property. 217Public Function Kind(nodeOrToken As SyntaxNodeOrToken) As SyntaxKind 248Friend Function IsAnyPreprocessorSymbolDefined(syntaxTree As SyntaxTree, conditionalSymbolNames As IEnumerable(Of String), atNode As SyntaxNodeOrToken) As Boolean
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (1)
125Private Function FindTriviaToLeft(nodeOrToken As SyntaxNodeOrToken, position As Integer) As SyntaxTrivia
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Analyzers\VisualBasic\CodeFixes\UseCollectionInitializer\VisualBasicUseCollectionInitializerCodeFixProvider.vb (1)
86Dim nodesAndTokens = ArrayBuilder(Of SyntaxNodeOrToken).GetInstance()
src\Analyzers\VisualBasic\CodeFixes\UseObjectInitializer\UseInitializerHelpers.vb (1)
26Public Sub AddExistingItems(objectCreation As ObjectCreationExpressionSyntax, nodesAndTokens As ArrayBuilder(Of SyntaxNodeOrToken))
src\Analyzers\VisualBasic\CodeFixes\UseObjectInitializer\VisualBasicUseObjectInitializerCodeFixProvider.vb (1)
89Dim nodesAndTokens = ArrayBuilder(Of SyntaxNodeOrToken).GetInstance()
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
EndConstructGeneration\EndConstructStatementVisitor_IfStatement.vb (1)
48Dim ifNodeToken As SyntaxNodeOrToken = ifBlock
Microsoft.CodeAnalysis.VisualBasic.Features (17)
ConvertAnonymousType\VisualBasicConvertAnonymousTypeToClassCodeRefactoringProvider.vb (2)
50Private Function CreateArgumentOrComma(declOrComma As SyntaxNodeOrToken) As SyntaxNodeOrToken
EditAndContinue\SyntaxComparer.vb (5)
1104Dim leftName As SyntaxNodeOrToken? = TryGetName(leftNode) 1105Dim rightName As SyntaxNodeOrToken? = TryGetName(rightNode) 1211Private Shared Function TryGetName(node As SyntaxNode) As SyntaxNodeOrToken? 1322Friend Overloads Shared Function ComputeDistance(oldNodeOrToken As SyntaxNodeOrToken, newNodeOrToken As SyntaxNodeOrToken) As Double
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (4)
341Dim nodeOrToken As SyntaxNodeOrToken = statement 1330If(node.TypeParameterList, CType(node.Identifier, SyntaxNodeOrToken))) 1333Private Overloads Shared Function GetDiagnosticSpan(modifiers As SyntaxTokenList, start As SyntaxNodeOrToken, endNode As SyntaxNodeOrToken) As TextSpan
ExtractInterface\VisualBasicExtractInterfaceService.vb (1)
116Dim token As SyntaxNodeOrToken = Nothing
ExtractMethod\Extensions.vb (1)
371Dim list = New List(Of SyntaxNodeOrToken)
LineSeparators\VisualBasicLineSeparatorService.vb (1)
26Private Shared Function IsSeparableBlock(nodeOrToken As SyntaxNodeOrToken) As Boolean
src\Analyzers\VisualBasic\CodeFixes\UseCollectionInitializer\VisualBasicUseCollectionInitializerCodeFixProvider.vb (1)
86Dim nodesAndTokens = ArrayBuilder(Of SyntaxNodeOrToken).GetInstance()
src\Analyzers\VisualBasic\CodeFixes\UseObjectInitializer\UseInitializerHelpers.vb (1)
26Public Sub AddExistingItems(objectCreation As ObjectCreationExpressionSyntax, nodesAndTokens As ArrayBuilder(Of SyntaxNodeOrToken))
src\Analyzers\VisualBasic\CodeFixes\UseObjectInitializer\VisualBasicUseObjectInitializerCodeFixProvider.vb (1)
89Dim nodesAndTokens = ArrayBuilder(Of SyntaxNodeOrToken).GetInstance()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (36)
IncrementalParser\SyntaxDifferences.vb (5)
15Public Function GetRebuiltNodes(oldTree As SyntaxTree, newTree As SyntaxTree) As ImmutableArray(Of SyntaxNodeOrToken) 19Dim nodes = ArrayBuilder(Of SyntaxNodeOrToken).GetInstance() 24Private Sub GetRebuiltNodes(newNode As SyntaxNodeOrToken, hashSet As HashSet(Of GreenNode), nodes As ArrayBuilder(Of SyntaxNodeOrToken)) 36Private Sub GatherNodes(node As SyntaxNodeOrToken, hashSet As HashSet(Of GreenNode))
Syntax\SyntaxAnnotationTests.vb (18)
403Dim nodeOrTokenMap = New Dictionary(Of SyntaxNodeOrToken, SyntaxNodeOrToken)() 433Dim annotations = New List(Of Tuple(Of SyntaxAnnotation, SyntaxNodeOrToken))() 494Public Function Replace(Of TRoot As SyntaxNode)(root As TRoot, oldNodeOrToken As SyntaxNodeOrToken, newNodeOrToken As SyntaxNodeOrToken) As TRoot 502Public Function AddAnnotationTo(annotation As SyntaxAnnotation, nodeOrToken As SyntaxNodeOrToken) As SyntaxNodeOrToken 506Private Sub TestAnnotations(annotations As List(Of Tuple(Of SyntaxAnnotation, SyntaxNodeOrToken)), currentRoot As SyntaxNode) 547Private Sub TestAnnotation(annotation As SyntaxAnnotation, root As SyntaxNode, oldNodeOrToken As SyntaxNodeOrToken) 603Private Function GetAllNodesAndTokens(root As SyntaxNode) As List(Of SyntaxNodeOrToken) 612Private _privateNodeOrTokens As List(Of SyntaxNodeOrToken) 613Public Property NodeOrTokens() As List(Of SyntaxNodeOrToken) 617Private Set(value As List(Of SyntaxNodeOrToken)) 634Me.NodeOrTokens = New List(Of SyntaxNodeOrToken)() 747Private ReadOnly _nodeOrTokenMap As Dictionary(Of SyntaxNodeOrToken, SyntaxNodeOrToken) 750Public Sub New(nodeOrTokenMap As Dictionary(Of SyntaxNodeOrToken, SyntaxNodeOrToken), triviaMap As Dictionary(Of SyntaxTrivia, SyntaxTrivia))
TestSyntaxNodes.vb (13)
103Dim i As SyntaxNodeOrToken 122Dim item1 As SyntaxNodeOrToken = enumerator.Current 129Dim item1 As SyntaxNodeOrToken = enumeratorr.Current 134Dim i1 As SyntaxNodeOrToken = children.Item(-1) 138Assert.Equal(ItemList.Item(0), Enumerable.First(Of SyntaxNodeOrToken)(DirectCast(children, IEnumerable(Of SyntaxNodeOrToken))).ToString) 2004Dim tk_nonzero1 = CType(trivia.First().Token.Parent.Parent.Parent, SyntaxNodeOrToken).GetNextSibling() 2019Dim tk0 As SyntaxNodeOrToken = prog.GetRoot().FindToken(31) 2044Dim tk0 As SyntaxNodeOrToken = prog.GetRoot().FindToken(35) 2075Dim tk0 As SyntaxNodeOrToken = prog.GetRoot().FindToken(35) 2176Dim sN As SyntaxNodeOrToken = prog.GetRoot() 2177Dim cS As SyntaxNodeOrToken = sN 2197Dim sn As SyntaxNodeOrToken = node
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (24)
ParserTestUtilities.vb (24)
124Private Sub VerifyParents(nodeOrToken As SyntaxNodeOrToken) 300Public Function VerifySyntaxKinds(node As SyntaxNodeOrToken, ParamArray expected As SyntaxKind()) As SyntaxNodeOrToken 305Private Function VerifySyntaxKinds(node As SyntaxNodeOrToken, ByRef i As Integer, expected As SyntaxKind()) As SyntaxNodeOrToken 331Public Function FindNodeOrTokenByKind(tree As SyntaxTree, kind As SyntaxKind, Optional occurrence As Integer = 1) As SyntaxNodeOrToken 335Dim foundNode As SyntaxNodeOrToken = Nothing 343Public Function VerifyPrecedingCommentIsTrivia(node As SyntaxNodeOrToken) As SyntaxNodeOrToken 358Public Function VerifyNoWhitespaceInKeywords(nodeOrToken As SyntaxNodeOrToken) As SyntaxNodeOrToken 409Public Sub InternalVerifyErrorsOnChildrenAlsoPresentOnParent(node As SyntaxNodeOrToken, tree As SyntaxTree) 632Private Sub VerifyContainsErrors(node As SyntaxNodeOrToken, tree As SyntaxTree, 672Private Sub GetOccurrenceCount(kind As SyntaxKind, node As SyntaxNodeOrToken, 703Private Sub InternalTraverseAllNodes(node As SyntaxNodeOrToken) 723Private Function TryFindNodeOrToken(node As SyntaxNodeOrToken, kind As SyntaxKind, ByRef occurrence As Integer, ByRef foundNode As SyntaxNodeOrToken) As Boolean 751Private Function TryFindNodeOrTokenInTrivia(triviaList As SyntaxTriviaList, kind As SyntaxKind, ByRef occurrence As Integer, ByRef foundNode As SyntaxNodeOrToken) As Boolean 764Private Sub InternalVerifyNoWhitespaceInKeywords(node As SyntaxNodeOrToken) 776Private Sub InternalVerifyNoMissingChildren(node As SyntaxNodeOrToken) 798Private Sub InternalVerifyNoZeroWidthNodes(node As SyntaxNodeOrToken) 821Private Sub InternalVerifyNoAdjacentTriviaHaveSameKind(node As SyntaxNodeOrToken) 832Private Sub InternalVerifyNoAdjacentTriviaHaveSameKind(node As SyntaxNodeOrToken, triviaList As SyntaxTriviaList) 850Private Sub InternalVerifySpanOfChildWithinSpanOfParent(node As SyntaxNodeOrToken)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (9)
Classification\Worker.vb (1)
187For Each child As SyntaxNodeOrToken In directiveSyntax.ChildNodesAndTokens()
CodeCleanup\VisualBasicCodeCleanerService.vb (1)
73Private Shared Function SkipProcessing(nodeOrToken As SyntaxNodeOrToken, result As ArrayBuilder(Of TextSpan)) As Boolean
Simplification\Reducers\AbstractVisualBasicReducer.AbstractReductionRewriter.vb (2)
174Public Function VisitNodeOrToken(nodeOrToken As SyntaxNodeOrToken, semanticModel As SemanticModel, simplifyAllDescendants As Boolean) As SyntaxNodeOrToken Implements IReductionRewriter.VisitNodeOrToken
Simplification\VisualBasicSimplificationService.NodesAndTokensToReduceComputer.vb (3)
17Private ReadOnly _isNodeOrTokenOutsideSimplifySpans As Func(Of SyntaxNodeOrToken, Boolean) 25Public Shared Function Compute(root As SyntaxNode, isNodeOrTokenOutsideSimplifySpans As Func(Of SyntaxNodeOrToken, Boolean)) As ImmutableArray(Of NodeOrTokenToReduce) 31Private Sub New(isNodeOrTokenOutsideSimplifySpans As Func(Of SyntaxNodeOrToken, Boolean))
Simplification\VisualBasicSimplificationService.vb (1)
151Protected Overrides Function GetNodesAndTokensToReduce(root As SyntaxNode, isNodeOrTokenOutsideSimplifySpans As Func(Of SyntaxNodeOrToken, Boolean)) As ImmutableArray(Of NodeOrTokenToReduce)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (1)
125Private Function FindTriviaToLeft(nodeOrToken As SyntaxNodeOrToken, position As Integer) As SyntaxTrivia
Microsoft.CodeAnalysis.Workspaces (98)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (5)
28private readonly Stack<SyntaxNodeOrToken> _pendingNodes; 32private static readonly ObjectPool<Stack<SyntaxNodeOrToken>> s_stackPool = new(() => new(), trimOnFree: false); 100while (_pendingNodes.TryPop(out var nodeOrToken)) 106foreach (var child in nodeOrToken.ChildNodesAndTokens()) 115private void ClassifyNodeOrToken(SyntaxNodeOrToken nodeOrToken)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (6)
132if (TryGetStackTopNodeOrToken(oldStack, out var currentOld) 133&& TryGetStackTopNodeOrToken(newStack, out var currentNew)) 186if (TryGetStackTopNodeOrToken(oldStack, out var currentOld) 187&& TryGetStackTopNodeOrToken(newStack, out var currentNew)) 242private static bool TryGetStackTopNodeOrToken(Stack<ChildSyntaxList.Enumerator> stack, out SyntaxNodeOrToken syntaxNodeOrToken) 259private static bool TryGetStackTopNodeOrToken(Stack<ChildSyntaxList.Reversed.Enumerator> stack, out SyntaxNodeOrToken syntaxNodeOrToken)
Differencing\AbstractSyntaxComparer.cs (1)
146foreach (var descendant in node.DescendantNodesAndTokens(
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (1)
155foreach (var child in node.ChildNodesAndTokens())
FindSymbols\FindReferences\FindReferenceCache.cs (3)
156using var obj = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject(); 161while (stack.TryPop(out var current)) 166foreach (var child in currentNode.ChildNodesAndTokens().Reverse())
FindSymbols\Shared\AbstractSyntaxIndex.cs (1)
147foreach (var child in node.ChildNodesAndTokens())
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
84foreach (var current in root.DescendantNodesAndTokensAndSelf(descendIntoTrivia: true))
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
76foreach (var child in current.ChildNodesAndTokens())
ReassignedVariable\AbstractReassignedVariableService.cs (2)
81foreach (var child in current.ChildNodesAndTokens()) 306foreach (var child in current.ChildNodesAndTokens())
Rename\ConflictEngine\ConflictResolver.Session.cs (5)
370var tokenOrNode = syntax; 452var tokenOrNode = syntax; 502private IEnumerable<(SyntaxNodeOrToken syntax, RenameActionAnnotation annotation)> GetNodesOrTokensToCheckForConflicts( 505foreach (var nodeOrToken in syntaxRoot.GetAnnotatedNodesAndTokens(RenameAnnotation.Kind)) 656private ImmutableArray<ISymbol> GetSymbolsInNewSolution(Document newDocument, SemanticModel newDocumentSemanticModel, RenameActionAnnotation conflictAnnotation, SyntaxNodeOrToken tokenOrNode)
Shared\Utilities\SemanticMap.Walker.cs (1)
17foreach (var child in node.DescendantNodesAndTokensAndSelf())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ChildSyntaxListExtensions.cs (6)
12public static SyntaxNodeOrToken First(this ChildSyntaxList childSyntaxList, Func<SyntaxNodeOrToken, bool> predicate) 14foreach (var syntaxNodeOrToken in childSyntaxList) 24public static SyntaxNodeOrToken Last(this ChildSyntaxList childSyntaxList, Func<SyntaxNodeOrToken, bool> predicate) 26foreach (var syntaxNodeOrToken in childSyntaxList.Reverse())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (2)
113var c1 = e1.Current; 114var c2 = e2.Current;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
138foreach (var child in node.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
26public static IEnumerable<SyntaxNodeOrToken> DepthFirstTraversal(this SyntaxNode node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeOrTokenExtensions.cs (13)
14public static bool AsNode(this SyntaxNodeOrToken nodeOrToken, [NotNullWhen(true)] out SyntaxNode? node) 26public static IEnumerable<SyntaxNodeOrToken> DepthFirstTraversal(this SyntaxNodeOrToken node) 28using var pooledStack = SharedPools.Default<Stack<SyntaxNodeOrToken>>().GetPooledObject(); 32while (stack.TryPop(out var current)) 38foreach (var child in current.ChildNodesAndTokens().Reverse()) 44public static IEnumerable<SyntaxNode> DepthFirstTraversalNodes(this SyntaxNodeOrToken node) 46foreach (var t in node.DepthFirstTraversal()) 53public static SyntaxTrivia[] GetTrivia(params SyntaxNodeOrToken[] nodesOrTokens) 56public static SyntaxNodeOrToken WithAppendedTrailingTrivia(this SyntaxNodeOrToken nodeOrToken, params SyntaxTrivia[] trivia) 59public static SyntaxNodeOrToken WithAppendedTrailingTrivia(this SyntaxNodeOrToken nodeOrToken, IEnumerable<SyntaxTrivia> trivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (3)
54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (6)
87var thisTokenAncestor = GetAncestorUnderRoot(this.Token, commonRoot); 88var otherTokenAncestor = GetAncestorUnderRoot(other.Token, commonRoot); 90foreach (var child in commonRoot.ChildNodesAndTokens()) 100static SyntaxNodeOrToken GetAncestorUnderRoot(SyntaxNodeOrToken start, SyntaxNode root) 102var current = start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
280foreach (var nodeOrToken in node.GetAnnotatedNodesAndTokens(annotation))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
33public bool IsOnHeader(SyntaxNode root, int position, SyntaxNode ownerOfHeader, SyntaxNodeOrToken lastTokenOrNodeOfHeader) 40SyntaxNodeOrToken lastTokenOrNodeOfHeader,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (4)
20private static readonly ObjectPool<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>> s_stackPool 21= SharedPools.Default<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>>(); 48ISyntaxFacts syntaxFacts, Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)> stack) 71foreach (var child in childNodesAndTokens.Reverse())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AliasSymbolKey.cs (1)
86foreach (var child in syntaxNode.ChildNodesAndTokens())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (11)
84public SyntaxNodeOrToken WithAdditionalAnnotations(SyntaxNodeOrToken nodeOrToken, params TAnnotation[] annotations) 96public SyntaxNodeOrToken WithoutAnnotations(SyntaxNodeOrToken nodeOrToken, params TAnnotation[] annotations) 120public IEnumerable<TAnnotation> GetAnnotations(SyntaxNodeOrToken nodeOrToken) 132public IEnumerable<TSpecificAnnotation> GetAnnotations<TSpecificAnnotation>(SyntaxNodeOrToken nodeOrToken) where TSpecificAnnotation : TAnnotation 144public bool HasAnnotations(SyntaxNodeOrToken nodeOrToken) 156public bool HasAnnotations<TSpecificAnnotation>(SyntaxNodeOrToken nodeOrToken) where TSpecificAnnotation : TAnnotation 168public bool HasAnnotation(SyntaxNodeOrToken nodeOrToken, TAnnotation annotation) 171public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(SyntaxNode node) 183public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens<TSpecificAnnotation>(SyntaxNode node) where TSpecificAnnotation : TAnnotation
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SyntaxPath.cs (10)
46public SyntaxPath(SyntaxNodeOrToken nodeOrToken, bool trackKinds = true) 54private void AddSegment(SyntaxNodeOrToken nodeOrToken) 69foreach (var child in parent.ChildNodesAndTokens()) 91public bool TryResolve(SyntaxNode? root, out SyntaxNodeOrToken nodeOrToken) 95var current = (SyntaxNodeOrToken)root; 115private SyntaxNodeOrToken FindChild(SyntaxNodeOrToken current, PathSegment segment) 118foreach (var child in current.ChildNodesAndTokens()) 145if (TryResolve(root, out var nodeOrToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractReducer.IExpressionRewriter.cs (2)
18SyntaxNodeOrToken VisitNodeOrToken(SyntaxNodeOrToken nodeOrTokenToReduce, SemanticModel semanticModel, bool simplifyAllDescendants);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation); 40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans); 146bool IsNodeOrTokenOutsideSimplifySpans(SyntaxNodeOrToken nodeOrToken) 188var nodeOrToken = nodeOrTokenToReduce.OriginalNodeOrToken; 190var currentNodeOrToken = nodeOrTokenToReduce.NodeOrToken; 275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\NodeOrTokenToReduce.cs (2)
8SyntaxNodeOrToken NodeOrToken, 10SyntaxNodeOrToken OriginalNodeOrToken);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SymbolKeyTests.cs (1)
1520foreach (var child in node.ChildNodesAndTokens())
Microsoft.Extensions.Logging.Generators (4)
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithSimpleName.cs (4)
255foreach (var child in node.ChildNodesAndTokens()) 342foreach (var childNode in childNodesAndTokens) 346foreach (var child in childNodesAndTokens.Reverse()) 441foreach (SyntaxNodeOrToken child in node.ChildNodesAndTokens())
Microsoft.Interop.JavaScript.JSImportGenerator (2)
JSExportGenerator.cs (2)
255new SyntaxNodeOrToken[]{ 264new SyntaxNodeOrToken[]{
Microsoft.VisualStudio.LanguageServices (1)
Venus\ContainedLanguageCodeSupport.cs (1)
237var newMember = newRoot.GetAnnotatedNodesAndTokens(annotation).Single();