170 references to AsToken
Microsoft.CodeAnalysis (33)
Syntax\CommonSyntaxNodeRemover.cs (1)
44nodesAndSeparators[nodeIndex + 1].AsToken() is var nextSeparator &&
Syntax\SeparatedSyntaxList.cs (2)
166return _list.Where(n => n.IsToken).Select(n => n.AsToken()); 416if (previous.IsToken && !KeepSeparatorWithPreviousNode(previous.AsToken()))
Syntax\SyntaxNavigator.cs (8)
111var token = GetFirstToken(child.AsToken(), predicate, stepInto); 158var token = GetLastToken(child.AsToken(), predicate, stepInto); 446var token = GetFirstToken(child.AsToken(), predicate, stepInto); 496var token = GetLastToken(child.AsToken(), predicate, stepInto); 554var token = GetFirstToken(child.AsToken(), predicate, stepInto); 570else if (child.IsToken && child.AsToken() == current) 608var token = GetLastToken(child.AsToken(), predicate, stepInto); 624else if (child.IsToken && child.AsToken() == current)
Syntax\SyntaxNode.cs (7)
1036yield return nodeOrToken.AsToken(); 1046return this.DescendantNodesAndTokens(descendIntoChildren, descendIntoTrivia).Where(sn => sn.IsToken).Select(sn => sn.AsToken()); 1054return this.DescendantNodesAndTokens(span, descendIntoChildren, descendIntoTrivia).Where(sn => sn.IsToken).Select(sn => sn.AsToken()); 1127var token = element.AsToken(); 1301return this.GetAnnotatedNodesAndTokens(syntaxAnnotation).Where(n => n.IsToken).Select(n => n.AsToken()); 1309return this.GetAnnotatedNodesAndTokens(annotationKind).Where(n => n.IsToken).Select(n => n.AsToken()); 1497return curNode.AsToken();
Syntax\SyntaxNode.Iterators.cs (3)
471var token = value.AsToken(); 547var token = value.AsToken(); 588var token = value.AsToken();
Syntax\SyntaxNodeOrToken.cs (11)
172token = AsToken()!; 232return this.AsToken().Span; 362return this.AsToken().LeadingTrivia; 386return this.AsToken().TrailingTrivia; 401return AsToken().WithLeadingTrivia(trivia); 421return AsToken().WithTrailingTrivia(trivia); 469return this.AsToken().GetDiagnostics(); 633return this.AsToken().WithAdditionalAnnotations(annotations); 664return this.AsToken().WithoutAnnotations(annotations); 789return nodeOrToken.AsToken(); 856foreach (var trivia in node.AsToken().LeadingTrivia)
Syntax\SyntaxWalker.cs (1)
49VisitToken(child.AsToken());
Microsoft.CodeAnalysis.CodeStyle (7)
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
65CheckToken(context, notificationOption, child.AsToken());
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
90ValuePattern.AsToken(),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeOrTokenExtensions.cs (1)
60=> nodeOrToken.AsNode(out var node) ? node.WithAppendedTrailingTrivia(trivia) : nodeOrToken.AsToken().WithAppendedTrailingTrivia(trivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
284: (nodeOrToken.AsToken(), nodeOrToken.AsToken());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
57if (!IsOnSingleLine(syntaxFacts, currentNodeOrToken.AsToken(), currentLeading, currentTrailing))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (1)
178=> node.GetAnnotatedNodesAndTokens(annotationKind).Where(nt => nt.IsToken).Select(nt => nt.AsToken());
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (4)
242: nodeOrToken.Parent.ReplaceToken(nodeOrToken.AsToken(), currentNodeOrToken.AsToken()); 286reducedTokensMap[nodeOrToken.AsToken()] = currentNodeOrToken.AsToken();
Microsoft.CodeAnalysis.CSharp (12)
Compilation\MemberSemanticModel.cs (1)
767label.IdentifierNodeOrToken.AsToken() == declarationSyntax.Identifier)
CSharpExtensions.cs (2)
336return nodeOrToken.AsToken().ApplyDirectives(stack); 364builder.AddSeparator(i.AsToken());
Parser\Blender.Reader.cs (3)
211token: (InternalSyntax.SyntaxToken)currentNodeOrToken.AsToken().Node); 242(nodeOrToken.IsToken && ((CSharpSyntaxNode)nodeOrToken.AsToken().Node).ContainsSkippedText && nodeOrToken.Parent.ContainsDiagnostics)) 263if ((nodeOrToken.IsToken && nodeOrToken.AsToken().IsMissing) ||
Symbols\Source\SourceLabelSymbol.cs (1)
59var tk = _identifierNodeOrToken.AsToken();
Syntax\CSharpSyntaxNode.cs (2)
246var token = child.AsToken(); 286var token = child.AsToken();
Syntax\CSharpSyntaxWalker.cs (1)
58this.VisitToken(child.AsToken());
Syntax\SyntaxNodeRemover.cs (2)
227visited = this.VisitListSeparator(item.AsToken()); 256var separator = withSeps[i + 1].AsToken();
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
290ProcessTriviaList(list, child.AsToken().LeadingTrivia); 291ProcessTriviaList(list, child.AsToken().TrailingTrivia);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
48nodesAndTokens.Add(nodeOrToken.AsToken());
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
61t => t.IsToken ? t.AsToken().WithoutTrivia() : s_omittedArgument));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
668if (item.IsToken && item.AsToken() == token)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
317.GetAnnotatedNodesAndTokens(s_plusEqualsTokenAnnotation).Single().AsToken()
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
CodeActions\SyncNamespace\CSharpSyncNamespaceTestsBase.cs (1)
182annotations = n.AsToken().GetAnnotations(WarningAnnotation.Kind);
Microsoft.CodeAnalysis.CSharp.Features (8)
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
115if (item.IsToken && item.AsToken() == token) 137if (item.IsToken && item.AsToken() == token)
EditAndContinue\SyntaxComparer.cs (2)
1549var leftToken = oldNodeOrToken.AsToken(); 1550var rightToken = newNodeOrToken.AsToken();
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (1)
66var token = node.GetAnnotatedNodesAndTokens(annotation).FirstOrDefault().AsToken();
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
68var openBrace = parent.ChildNodesAndTokens().FirstOrDefault(n => n.Kind() == SyntaxKind.OpenBraceToken).AsToken();
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
48nodesAndTokens.Add(nodeOrToken.AsToken());
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
61t => t.IsToken ? t.AsToken().WithoutTrivia() : s_omittedArgument));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (13)
ParentChecker.cs (1)
24var token = nodeOrToken.AsToken();
Syntax\SyntaxAnnotationTests.cs (11)
193var token = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsToken).AsToken(); 203var token2 = newRoot.GetAnnotatedNodesAndTokens(annotation1).Single().AsToken(); 446var oldToken = destTreeNodeOrTokenEnumerator.Current.AsToken(); 447var newToken = sourceTreeNodeOrTokenEnumerator.Current.AsToken().CopyAnnotationsTo(oldToken); 539return root.ReplaceToken(oldNodeOrToken.AsToken(), newNodeOrToken.AsToken()); 589var newToken = nodeOrToken.AsToken().WithAdditionalAnnotations(annotation); 590newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceToken(nodeOrToken.AsToken(), newToken); 607TestAnnotation(annotation, root, oldNodeOrToken.AsToken()); 634var annotatedToken = results.Single().AsToken(); 839return _nodeOrTokenMap[token].AsToken().CopyAnnotationsTo(base.VisitToken(token));
Syntax\SyntaxListTests.cs (1)
314Assert.Equal(expectedTokenIndex, item.AsToken().Index);
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Classification\Worker.cs (1)
75ClassifyToken(nodeOrToken.AsToken());
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (1)
201return VisitToken(nodeOrToken.AsToken());
Simplification\Simplifiers\NameSimplifier.cs (2)
144identifierToken = annotatedNodeOrToken.AsToken().CopyAnnotationsTo(identifierToken); 157identifierToken = annotatedNodeOrToken.AsToken().CopyAnnotationsTo(identifierToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
290ProcessTriviaList(list, child.AsToken().LeadingTrivia); 291ProcessTriviaList(list, child.AsToken().TrailingTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
668if (item.IsToken && item.AsToken() == token)
Microsoft.CodeAnalysis.EditorFeatures (1)
CodeActions\CodeActionEditHandlerService.cs (1)
376_renameService.StartInlineSession(openDocument, resolvedRenameToken.AsToken().Span, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Structure\AbstractSyntaxNodeStructureProviderTests.cs (1)
47var previousToken = root.DescendantNodesAndTokens(descendIntoTrivia: true).TakeWhile(nodeOrToken => nodeOrToken != node).LastOrDefault(nodeOrToken => nodeOrToken.IsToken).AsToken();
Microsoft.CodeAnalysis.Features (15)
BraceMatching\AbstractBraceMatcher.cs (1)
33let tok = child.AsToken()
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionAnalyzer.cs (1)
77var token = child.AsToken();
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (1)
70var token = child.AsToken();
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (1)
264return root.GetAnnotatedNodesAndTokens(annotation).FirstOrDefault().AsToken();
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
65CheckToken(context, notificationOption, child.AsToken());
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
90ValuePattern.AsToken(),
Structure\Syntax\BlockSpanCollector.cs (2)
57GetBlockSpans(nodeOrToken.AsToken(), spans); 58previousToken = nodeOrToken.AsToken();
Wrapping\AbstractWrapper.cs (2)
52var firstToken = item.IsToken ? item.AsToken() : item.AsNode()!.GetFirstToken(); 53var lastToken = item.IsToken ? item.AsToken() : item.AsNode()!.GetLastToken();
Wrapping\BinaryExpression\BinaryExpressionCodeActionComputer.cs (1)
96var opToken = _exprsAndOperators[i].AsToken();
Wrapping\ChainedExpression\ChainedExpressionCodeActionComputer.cs (1)
175=> chunk.Sum(s => s.IsNode ? s.AsNode().Width() : s.AsToken().Width());
Wrapping\Edit.cs (2)
68var leftLastToken = left.IsToken ? left.AsToken() : left.AsNode()!.GetLastToken(); 69var rightFirstToken = right.IsToken ? right.AsToken() : right.AsNode()!.GetFirstToken();
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
443var comma = itemsAndSeparators[i].AsToken();
Microsoft.CodeAnalysis.Test.Utilities (3)
Syntax\NodeHelpers.cs (2)
87retVal = node.AsToken().GetRootNode(); 141retVal = GetNodeInfo(nodeOrToken.AsToken());
Syntax\XmlHelpers.cs (1)
107xml = ToXml(node.AsToken(), syntaxTree, options);
Microsoft.CodeAnalysis.VisualBasic (8)
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (1)
125Me.VisitToken(child.AsToken())
Syntax\SyntaxNodeRemover.vb (2)
156visited = Me.VisitListSeparator(item.AsToken()) 181Dim separator = withSeps(i + 1).AsToken()
Syntax\VisualBasicSyntaxNode.vb (2)
345For Each tr In child.AsToken.LeadingTrivia 370Dim token As SyntaxToken = child.AsToken
Syntax\VisualBasicSyntaxTree.vb (1)
400Return InDocumentationComment(node.AsToken)
Syntax\VisualBasicSyntaxWalker.vb (1)
48Me.VisitToken(child.AsToken())
VisualBasicExtensions.vb (1)
460builder.AddSeparator(i.AsToken)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
134If n.IsToken AndAlso n.AsToken() = token Then
Microsoft.CodeAnalysis.VisualBasic.Features (2)
EditAndContinue\SyntaxComparer.vb (2)
1327Dim leftToken = oldNodeOrToken.AsToken() 1328Dim rightToken = newNodeOrToken.AsToken()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (13)
Parser\ParseExpression.vb (1)
1046Assert.Equal("<", el.Content.First.ChildNodesAndTokens(1).AsToken.ValueText)
Syntax\SyntaxAnnotationTests.vb (11)
178Dim token = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsToken).AsToken() 188Dim token2 = newRoot.GetAnnotatedNodesAndTokens(annotation1).Single().AsToken() 410Dim oldToken = destTreeNodeOrTokenEnumerator.Current.AsToken() 411Dim newToken = sourceTreeNodeOrTokenEnumerator.Current.AsToken().CopyAnnotationsTo(oldToken) 496Return root.ReplaceToken(oldNodeOrToken.AsToken(), newNodeOrToken.AsToken()) 536Dim newToken = nodeOrToken.AsToken().WithAdditionalAnnotations(annotation) 537newRoot = tree.GetRoot().ReplaceToken(nodeOrToken.AsToken(), newToken) 550TestAnnotation(annotation, root, oldNodeOrToken.AsToken()) 575Dim annotatedToken = results.Single().AsToken() 769Return Me._nodeOrTokenMap(token).AsToken().CopyAnnotationsTo(MyBase.VisitToken(token))
Syntax\SyntaxListTests.vb (1)
240Assert.Equal(position, item.AsToken.Index)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (9)
ParserTestUtilities.vb (9)
415For Each tr In node.AsToken.LeadingTrivia 422For Each tr In node.AsToken.TrailingTrivia 766Dim tk = node.AsToken 785For Each tr In node.AsToken.LeadingTrivia 790For Each tr In node.AsToken.LeadingTrivia 806For Each tr In node.AsToken.LeadingTrivia 812For Each tr In node.AsToken.LeadingTrivia 827InternalVerifyNoAdjacentTriviaHaveSameKind(node, node.AsToken.LeadingTrivia) 828InternalVerifyNoAdjacentTriviaHaveSameKind(node, node.AsToken.TrailingTrivia)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (8)
Classification\Worker.vb (3)
66ClassifyToken(nodeOrToken.AsToken()) 205ClassifyToken(child.AsToken(), ClassificationTypeNames.PreprocessorKeyword) 207ClassifyToken(child.AsToken())
CodeCleanup\VisualBasicCodeCleanerService.vb (1)
55ProcessToken(child.AsToken(), result)
Simplification\Reducers\AbstractVisualBasicReducer.AbstractReductionRewriter.vb (1)
183Return VisitToken(nodeOrToken.AsToken())
Simplification\Simplifiers\NameSimplifier.vb (2)
88identifierToken = annotatedNodeOrToken.AsToken().CopyAnnotationsTo(identifierToken) 97identifierToken = annotatedNodeOrToken.AsToken().CopyAnnotationsTo(identifierToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
134If n.IsToken AndAlso n.AsToken() = token Then
Microsoft.CodeAnalysis.Workspaces (18)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
120ClassifyToken(nodeOrToken.AsToken());
CodeCleanup\AbstractCodeCleanerService.cs (2)
132var previousTokens = node.GetAnnotatedNodesAndTokens(previousMarkerAnnotation).Where(n => n.IsToken).Select(n => n.AsToken()); 133var nextTokens = node.GetAnnotatedNodesAndTokens(nextMarkerAnnotation).Where(n => n.IsToken).Select(n => n.AsToken());
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (1)
163ProcessToken(syntaxFacts, child.AsToken(), matches);
FindSymbols\FindReferences\FindReferenceCache.cs (1)
171var token = current.AsToken();
FindSymbols\Shared\AbstractSyntaxIndex.cs (1)
159if (ContainsIfDirective(child.AsToken(), ifDirectiveKind))
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (2)
81var token = child.AsToken(); 83ProcessToken(semanticModel, child.AsToken());
Shared\Utilities\SemanticMap.Walker.cs (1)
29var childToken = child.AsToken();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeOrTokenExtensions.cs (1)
60=> nodeOrToken.AsNode(out var node) ? node.WithAppendedTrailingTrivia(trivia) : nodeOrToken.AsToken().WithAppendedTrailingTrivia(trivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
284: (nodeOrToken.AsToken(), nodeOrToken.AsToken());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
57if (!IsOnSingleLine(syntaxFacts, currentNodeOrToken.AsToken(), currentLeading, currentTrailing))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (1)
178=> node.GetAnnotatedNodesAndTokens(annotationKind).Where(nt => nt.IsToken).Select(nt => nt.AsToken());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (4)
242: nodeOrToken.Parent.ReplaceToken(nodeOrToken.AsToken(), currentNodeOrToken.AsToken()); 286reducedTokensMap[nodeOrToken.AsToken()] = currentNodeOrToken.AsToken();