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