240 references to AsNode
Microsoft.CodeAnalysis (20)
Syntax\CommonSyntaxNodeRemover.cs (1)
35var node = nodesAndSeparators[nodeIndex].AsNode();
Syntax\SeparatedSyntaxList.cs (1)
441var node = nodesWithSeps[insertionIndex].AsNode();
Syntax\SyntaxNavigator.cs (8)
124stack.Push(child.AsNode()!.ChildNodesAndTokens().GetEnumerator()); 171stack.Push(child.AsNode()!.ChildNodesAndTokens().Reverse().GetEnumerator()); 455var token = GetFirstToken(child.AsNode()!, predicate, stepInto); 462else if (child.IsNode && child.AsNode() == node) 505var token = GetLastToken(child.AsNode()!, predicate, stepInto); 512else if (child.IsNode && child.AsNode() == node) 563var token = GetFirstToken(child.AsNode()!, predicate, stepInto); 617var token = GetLastToken(child.AsNode()!, predicate, stepInto);
Syntax\SyntaxNode.cs (3)
1283return this.GetAnnotatedNodesAndTokens(syntaxAnnotation).Where(n => n.IsNode).Select(n => n.AsNode()!); 1293return this.GetAnnotatedNodesAndTokens(annotationKind).Where(n => n.IsNode).Select(n => n.AsNode()!); 1488var node = curNode.AsNode();
Syntax\SyntaxNode.Iterators.cs (3)
20? DescendantNodesAndTokensImpl(span, descendIntoChildren, true, includeSelf).Where(e => e.IsNode).Select(e => e.AsNode()!) 432var nodeValue = value.AsNode(); 467stack.PushChildren(value.AsNode()!, descendIntoChildren);
Syntax\SyntaxNodeExtensions_Tracking.cs (1)
204foreach (var node in root.GetAnnotatedNodesAndTokens(IdAnnotationKind).Select(n => n.AsNode()!))
Syntax\SyntaxNodeOrToken.cs (1)
817return nodeOrToken.AsNode();
Syntax\SyntaxNodeOrTokenList.cs (1)
87: nodesAndTokens[0].AsNode();
Syntax\SyntaxWalker.cs (1)
42Visit(child.AsNode()!);
Microsoft.CodeAnalysis.CodeStyle (11)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
96ValuePattern.AsNode(), expression);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (1)
77var childNode = child.AsNode()!;
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
58var nameNode = memberAccessSyntax.ChildNodesAndTokens().Reverse().FirstOrDefault().AsNode();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (2)
120if (!AreSemanticallyEquivalentWorker(semanticModel1, semanticModel2, c1.AsNode(), c2.AsNode(), predicate))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
328=> node.GetAnnotatedNodesAndTokens(syntaxAnnotation).Select(n => n.AsNode()).OfType<T>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeOrTokenExtensions.cs (1)
18node = nodeOrToken.AsNode();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
62var currentNode = currentNodeOrToken.AsNode()!;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (1)
214_lazyReplacedExpression = (TExpressionSyntax)_lazySemanticRootOfReplacedExpression.GetAnnotatedNodesAndTokens(annotation).Single().AsNode()!;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (1)
175=> node.GetAnnotatedNodesAndTokens(annotationKind).Where(nt => nt.IsNode).Select(nt => nt.AsNode()!);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SyntaxPath.cs (1)
147nodeOrToken.AsNode() is TNode n)
Microsoft.CodeAnalysis.CodeStyle.Fixes (10)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
378var siblingNode = sibling.AsNode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (9)
235(currentNodeOrToken.IsToken || currentNodeOrToken.AsNode() is TExpressionSyntax or TStatementSyntax or TCrefSyntax)) 241? nodeOrToken.Parent.ReplaceNode(nodeOrToken.AsNode()!, currentNodeOrToken.AsNode()!) 251var currentNode = currentNodeOrToken.AsNode()!; 252if (this.NodeRequiresNonSpeculativeSemanticModel(nodeOrToken.AsNode()!)) 256var newRoot = root.ReplaceNode(nodeOrToken.AsNode()!, currentNode.WithAdditionalAnnotations(marker)); 265semanticModelForReduce = GetSpeculativeSemanticModel(ref currentNode, semanticModel, nodeOrToken.AsNode()!); 282reducedNodesMap[nodeOrToken.AsNode()!] = currentNodeOrToken.AsNode()!;
Microsoft.CodeAnalysis.CSharp (13)
Binder\Binder.cs (1)
733if (node.AsNode() is ForEachStatementSyntax foreachSyntax)
Binder\SwitchBinder.cs (2)
121key = label.IdentifierNodeOrToken.AsNode(); 459var node = ((SourceLabelSymbol)label).IdentifierNodeOrToken.AsNode();
Compilation\MemberSemanticModel.cs (1)
792label.IdentifierNodeOrToken.AsNode() == declarationSyntax)
CSharpExtensions.cs (1)
357var node = i.AsNode();
Parser\Blender.Cursor.cs (1)
139var node = CurrentNodeOrToken.AsNode();
Parser\Blender.Reader.cs (2)
210node: (CSharp.CSharpSyntaxNode)currentNodeOrToken.AsNode(), 264(nodeOrToken.IsNode && IsIncomplete((CSharp.CSharpSyntaxNode)nodeOrToken.AsNode())))
Symbols\Source\SourceLabelSymbol.cs (2)
48var node = _identifierNodeOrToken.AsNode(); 100node = _identifierNodeOrToken.AsNode()!.FirstAncestorOrSelf<SwitchLabelSyntax>();
Syntax\CSharpSyntaxWalker.cs (1)
46var asNode = child.AsNode();
Syntax\SyntaxFactory.cs (1)
1484if (element.IsNode && !(element.AsNode() is TNode))
Syntax\SyntaxNodeRemover.cs (1)
232var node = (TNode)item.AsNode()!;
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
39var node = child.AsNode();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
181var node = (TupleElementSyntax)nodeOrToken.AsNode();
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
50nodesAndTokens.Add(createElement(null, (ExpressionSyntax)nodeOrToken.AsNode()!));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
675if (item.AsNode() is ArgumentSyntax node && node.NameColon != null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1821var type = InferTypeForFirstParameterOfLambda(parameterName, child.AsNode());
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
CodeActions\SyncNamespace\CSharpSyncNamespaceTestsBase.cs (1)
178annotations = n.AsNode().GetAnnotations(WarningAnnotation.Kind);
Microsoft.CodeAnalysis.CSharp.Features (24)
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (3)
257.AsNode() as T; 263return root.GetAnnotatedNodesAndTokens(ReferenceAnnotation).Select(n => (IdentifierNameSyntax)n.AsNode()).ToImmutableArray(); 289return (VariableDeclaratorSyntax)annotatedNodesOrTokens.First().AsNode();
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
120var node = (AttributeArgumentSyntax?)item.AsNode(); 142var node = (AttributeArgumentSyntax?)item.AsNode();
ConvertAnonymousType\CSharpConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
62list[^2].AsNode()! 74: CreateArgument((AnonymousObjectMemberDeclaratorSyntax)declOrComma.AsNode()!);
EditAndContinue\BreakpointSpans.cs (1)
160return nodeOrToken.AsNode()!.GetLastToken().Span.End;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
743yield return (nodeOrToken.AsNode()!, DefaultStatementPart); 747var node = nodeOrToken.AsNode();
EditAndContinue\SyntaxComparer.cs (2)
1557var leftNode = oldNodeOrToken.AsNode(); 1558var rightNode = newNodeOrToken.AsNode();
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (2)
172newEnclosingStatement = updatedRoot.GetAnnotatedNodesAndTokens(enclosingStatementAnnotation).Single().AsNode(); 176sourceNode = updatedRoot.GetAnnotatedNodesAndTokens(sourceNodeAnnotation).Last().AsNode();
Highlighting\KeywordHighlighters\ReturnStatementHighlighter.cs (2)
63if (!child.AsNode().IsReturnableConstruct()) 64HighlightRelatedKeywords(child.AsNode(), spans);
Highlighting\KeywordHighlighters\YieldStatementHighlighter.cs (2)
67if (!child.AsNode().IsReturnableConstruct()) 69HighlightRelatedKeywords(child.AsNode(), spans);
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
39var node = child.AsNode();
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
181var node = (TupleElementSyntax)nodeOrToken.AsNode();
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (1)
50nodesAndTokens.Add(createElement(null, (ExpressionSyntax)nodeOrToken.AsNode()!));
Structure\Providers\AccessorDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.AsNode() is AccessorDeclarationSyntax);
Structure\Providers\EnumDeclarationStructureProvider.cs (1)
33&& (!nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax);
Structure\Providers\TypeDeclarationStructureProvider.cs (1)
41&& (!nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\InteractiveSemanticModelTests.cs (1)
291exprSynList = GetExprSyntaxList(child.AsNode(), exprSynList);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelAPITests.cs (1)
4792GetExpressionSyntax(child.AsNode(), exprSynList);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (21)
IncrementalParsing\IncrementalParsingTests.cs (2)
1988Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode().ToFullString(), incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode().ToFullString());
LexicalAndXml\XmlDocCommentTests.cs (1)
1291var classdecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode();
ParentChecker.cs (1)
53var node = nodeOrToken.AsNode();
Syntax\SyntaxAnnotationTests.cs (15)
161var node = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 171var node2 = newRoot.GetAnnotatedNodesAndTokens(annotation1).Single().AsNode(); 284var firstNode = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 287var lastChildOfFirstNode = children.Last(t => t.IsNode).AsNode(); 295var firstNodeInNewTree = GetAllNodesAndTokens(newRoot).First(t => t.IsNode).AsNode(); 299var rightNode = firstNodeInNewTree.ChildNodesAndTokens().Last(t => t.IsNode).AsNode(); 440var oldNode = destTreeNodeOrTokenEnumerator.Current.AsNode(); 441var newNode = sourceTreeNodeOrTokenEnumerator.Current.AsNode().CopyAnnotationsTo(oldNode); 542return root.ReplaceNode(oldNodeOrToken.AsNode(), newNodeOrToken.AsNode()); 594var newNode = nodeOrToken.AsNode().WithAdditionalAnnotations(annotation); 595newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceNode(nodeOrToken.AsNode(), newNode); 611TestAnnotation(annotation, root, oldNodeOrToken.AsNode()); 620var annotatedNode = results.Single().AsNode(); 829return _nodeOrTokenMap[node].AsNode().CopyAnnotationsTo(base.Visit(node));
Syntax\SyntaxNodeTests.cs (2)
1808var namespaceNode = rootNode.ChildNodesAndTokens()[1].AsNode(); 1811Assert.Equal(namespaceNode, nodeOrToken.AsNode());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CSharpTestBase.cs (1)
1575synList = GetSyntaxNodeList(child.AsNode(), synList);
SemanticModelTestBase.cs (1)
51exprSynList = GetExprSyntaxList(child.AsNode(), exprSynList);
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Classification\Worker.cs (1)
79ClassifyNode(nodeOrToken.AsNode()!);
Recommendations\CSharpRecommendationServiceRunner.cs (1)
238while (currentExpression.ChildNodesAndTokens().Last().AsNode() is ExpressionSyntax child &&
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (1)
197return Visit(nodeOrToken.AsNode());
Simplification\Simplifiers\NameSimplifier.cs (2)
148replacementNode = annotatedNodeOrToken.AsNode().CopyAnnotationsTo(replacementNode); 161replacementNode = annotatedNodeOrToken.AsNode().CopyAnnotationsTo(replacementNode);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
675if (item.AsNode() is ArgumentSyntax node && node.NameColon != null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1821var type = InferTypeForFirstParameterOfLambda(parameterName, child.AsNode());
Microsoft.CodeAnalysis.Features (18)
CodeRefactorings\AddAwait\AbstractAddAwaitCodeRefactoringProvider.cs (1)
95current = current.ChildNodesAndTokens().FirstOrDefault().AsNode() as TExpressionSyntax;
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
726: ConvertArgument(generator, parameterNamingRule, isRecord, (TArgumentSyntax)arg.AsNode()!);
ExtractMethod\InsertionPoint.cs (1)
43return root.GetAnnotatedNodesAndTokens(_annotation).SingleOrDefault().AsNode();
ExtractMethod\MethodExtractor.TriviaResult.cs (2)
38var callsite = root.GetAnnotatedNodesAndTokens(callsiteAnnotation).SingleOrDefault().AsNode(); 39var method = root.GetAnnotatedNodesAndTokens(methodDefinitionAnnotation).SingleOrDefault().AsNode();
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
377var childNode = nodeOrToken.AsNode();
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
90rootExpression = current.AsNode();
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
96ValuePattern.AsNode(), expression);
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
58var nameNode = memberAccessSyntax.ChildNodesAndTokens().Reverse().FirstOrDefault().AsNode();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
378var siblingNode = sibling.AsNode();
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 (2)
95var left = _exprsAndOperators[i - 1].AsNode(); 97var right = _exprsAndOperators[i + 1].AsNode();
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)
312var item = itemsAndSeparators[i].AsNode()!;
Microsoft.CodeAnalysis.Test.Utilities (3)
Syntax\NodeHelpers.cs (2)
83retVal = node.AsNode().GetRootNode(); 137retVal = GetNodeInfo(nodeOrToken.AsNode());
Syntax\XmlHelpers.cs (1)
103xml = ToXml(node.AsNode(), syntaxTree, options);
Microsoft.CodeAnalysis.VisualBasic (9)
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (1)
121Dim asNode = child.AsNode()
Scanner\Blender.vb (1)
120Dim child = node.ChildThatContainsPosition(position).AsNode()
Syntax\SyntaxNodeFactories.vb (1)
990If element.IsNode AndAlso Not (TypeOf element.AsNode() Is TNode) Then
Syntax\SyntaxNodeRemover.vb (1)
159Dim node = DirectCast(item.AsNode(), TNode)
Syntax\VisualBasicSyntaxNode.vb (2)
339Dim d As DirectiveTriviaSyntax = DirectCast(child.AsNode, VisualBasicSyntaxNode).GetFirstDirective(predicate) 365Dim d As DirectiveTriviaSyntax = DirectCast(child.AsNode, VisualBasicSyntaxNode).GetLastDirective(predicate)
Syntax\VisualBasicSyntaxTree.vb (1)
403Return InDocumentationComment(node.AsNode)
Syntax\VisualBasicSyntaxWalker.vb (1)
41Dim asNode = child.AsNode()
VisualBasicExtensions.vb (1)
456Dim node = i.AsNode
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Analyzers\VisualBasic\Analyzers\OrderModifiers\VisualBasicOrderModifiersDiagnosticAnalyzer.vb (1)
35Dim declarationStatement = TryCast(child.AsNode(), DeclarationStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
138If n.IsNode AndAlso DirectCast(n.AsNode(), ArgumentSyntax).IsNamed Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (2)
207Return InferTypeInTupleExpression(tupleExpression, DirectCast(argsAndCommas(commaIndex + 1).AsNode(), SimpleArgumentSyntax)) 992Dim type = InferTypeForFirstParameterOfLambda(parameterName, child.AsNode)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (1)
src\Features\VisualBasicTest\Utils.vb (1)
60Dim foundNode = child.AsNode().FindFirstNodeOfType(Of T)()
Microsoft.CodeAnalysis.VisualBasic.Features (10)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
245Yield DirectCast(nodeOrToken.AsNode(), IdentifierNameSyntax)
Completion\KeywordRecommenders\PreprocessorDirectives\PreprocessorHelpers.vb (1)
50Visit(child.AsNode())
EditAndContinue\SyntaxComparer.vb (2)
1333Dim leftNode = oldNodeOrToken.AsNode() 1334Dim rightNode = newNodeOrToken.AsNode()
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (3)
359If lastBlockStatement IsNot Nothing AndAlso nodeOrToken.AsNode() Is lastBlockStatement Then 366If lastBlockStatement IsNot Nothing AndAlso nodeOrToken.AsNode() Is lastBlockStatement Then 393Dim node = nodeOrToken.AsNode()
Highlighting\KeywordHighlighters\TryBlockHighlighter.vb (1)
66Dim child = childNodeOrToken.AsNode()
LineSeparators\VisualBasicLineSeparatorService.vb (1)
31Dim node = nodeOrToken.AsNode()
src\Analyzers\VisualBasic\Analyzers\OrderModifiers\VisualBasicOrderModifiersDiagnosticAnalyzer.vb (1)
35Dim declarationStatement = TryCast(child.AsNode(), DeclarationStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
Utils.vb (1)
60Dim foundNode = child.AsNode().FindFirstNodeOfType(Of T)()
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (12)
Compilation\SemanticModelAPITests.vb (12)
2450Dim v3 = DirectCast(v2.ChildNodesAndTokens()(1).AsNode(), LocalDeclarationStatementSyntax) 2465v3 = DirectCast(v2.ChildNodesAndTokens()(2).AsNode(), LocalDeclarationStatementSyntax) 2481Dim v4 = DirectCast(v2.ChildNodesAndTokens()(7).AsNode(), LocalDeclarationStatementSyntax) 2494v4 = DirectCast(v2.ChildNodesAndTokens()(8).AsNode(), LocalDeclarationStatementSyntax) 2507v4 = DirectCast(v2.ChildNodesAndTokens()(9).AsNode(), LocalDeclarationStatementSyntax) 2520Dim v5 = DirectCast(v2.ChildNodesAndTokens()(11).AsNode(), AssignmentStatementSyntax) 2577Dim v3 = DirectCast(v2.ChildNodesAndTokens()(1).AsNode(), LocalDeclarationStatementSyntax) 2592v3 = DirectCast(v2.ChildNodesAndTokens()(2).AsNode(), LocalDeclarationStatementSyntax) 2606Dim v4 = DirectCast(v2.ChildNodesAndTokens()(7).AsNode(), LocalDeclarationStatementSyntax) 2619v4 = DirectCast(v2.ChildNodesAndTokens()(8).AsNode(), LocalDeclarationStatementSyntax) 2632v4 = DirectCast(v2.ChildNodesAndTokens()(9).AsNode(), LocalDeclarationStatementSyntax) 2645Dim v5 = DirectCast(v2.ChildNodesAndTokens()(11).AsNode(), AssignmentStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (23)
Parser\ParseStatements.vb (4)
363Dim subMain = TryCast(moduleM.ChildNodesAndTokens()(1).AsNode, MethodBlockSyntax) 364Dim ifStmt = TryCast(subMain.ChildNodesAndTokens()(1).AsNode, SingleLineIfStatementSyntax) 578Dim subMain = TryCast(moduleM.ChildNodesAndTokens()(1).AsNode, MethodBlockSyntax) 582Assert.Equal(SyntaxKind.InvocationExpression, DirectCast(subMain.ChildNodesAndTokens()(2).AsNode, ExpressionStatementSyntax).Expression.Kind)
Syntax\SyntaxAnnotationTests.vb (15)
147Dim node = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode() 157Dim node2 = newRoot.GetAnnotatedNodesAndTokens(annotation1).Single().AsNode() 266Dim firstNode = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode() 269Dim lastChildOfFirstNode = Enumerable.Last(children, Function(t) t.IsNode).AsNode() 277Dim firstNodeInNewTree = GetAllNodesAndTokens(newRoot).First(Function(t) t.IsNode).AsNode() 281Dim rightNode = Enumerable.Last(firstNodeInNewTree.ChildNodesAndTokens(), Function(t) t.IsNode).AsNode() 406Dim oldNode = destTreeNodeOrTokenEnumerator.Current.AsNode() 407Dim newNode = sourceTreeNodeOrTokenEnumerator.Current.AsNode().CopyAnnotationsTo(oldNode) 499Return root.ReplaceNode(oldNodeOrToken.AsNode(), newNodeOrToken.AsNode()) 539Dim newNode = nodeOrToken.AsNode().WithAdditionalAnnotations(annotation) 540newRoot = tree.GetRoot().ReplaceNode(nodeOrToken.AsNode(), newNode) 554TestAnnotation(annotation, root, oldNodeOrToken.AsNode()) 562Dim annotatedNode = results.Single().AsNode() 761Return Me._nodeOrTokenMap(node).AsNode().CopyAnnotationsTo(MyBase.Visit(node))
TestSyntaxNodes.vb (4)
255VerifyAllSpans(node.AsNode) 280VerifyAllSpans(list(i).AsNode) 1879Assert.Same(firstMember1, firstMember3.AsNode) 1887Assert.Same(firstMember1, firstMember3.AsNode)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (5)
ParserTestUtilities.vb (5)
411For Each child In node.AsNode.ChildNodesAndTokens() 779For Each child In node.AsNode.ChildNodesAndTokens() 801For Each child In node.AsNode.ChildNodesAndTokens() 823For Each child In node.AsNode.ChildNodesAndTokens() 852For Each child In node.AsNode.ChildNodesAndTokens()
Microsoft.CodeAnalysis.VisualBasic.Workspaces (11)
Classification\Worker.vb (2)
64ClassifyXmlNode(nodeOrToken.AsNode()) 210ClassifyNode(child.AsNode())
Classification\Worker.XmlClassifier.vb (2)
320ClassifyXmlName(DirectCast(lastChild.AsNode(), XmlNameSyntax)) 322ClassifyXmlBracketedName(DirectCast(lastChild.AsNode(), XmlBracketedNameSyntax))
CodeCleanup\VisualBasicCodeCleanerService.vb (1)
53ProcessNode(child.AsNode(), result)
Simplification\Reducers\AbstractVisualBasicReducer.AbstractReductionRewriter.vb (1)
181Return Visit(nodeOrToken.AsNode)
Simplification\Simplifiers\NameSimplifier.vb (2)
90replacementNode = annotatedNodeOrToken.AsNode().CopyAnnotationsTo(replacementNode) 99replacementNode = annotatedNodeOrToken.AsNode().CopyAnnotationsTo(replacementNode)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
138If n.IsNode AndAlso DirectCast(n.AsNode(), ArgumentSyntax).IsNamed Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (2)
207Return InferTypeInTupleExpression(tupleExpression, DirectCast(argsAndCommas(commaIndex + 1).AsNode(), SimpleArgumentSyntax)) 992Dim type = InferTypeForFirstParameterOfLambda(parameterName, child.AsNode)
Microsoft.CodeAnalysis.Workspaces (23)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (4)
154oldStack.Push(currentOld.AsNode()!.ChildNodesAndTokens().GetEnumerator()); 155newStack.Push(currentNew.AsNode()!.ChildNodesAndTokens().GetEnumerator()); 222oldStack.Push(currentOld.AsNode()!.ChildNodesAndTokens().Reverse().GetEnumerator()); 223newStack.Push(currentNew.AsNode()!.ChildNodesAndTokens().Reverse().GetEnumerator());
Differencing\AbstractSyntaxComparer.cs (1)
150var descendantNode = descendant.AsNode();
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
87var node = current.AsNode();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (2)
120if (!AreSemanticallyEquivalentWorker(semanticModel1, semanticModel2, c1.AsNode(), c2.AsNode(), predicate))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
328=> node.GetAnnotatedNodesAndTokens(syntaxAnnotation).Select(n => n.AsNode()).OfType<T>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeOrTokenExtensions.cs (1)
18node = nodeOrToken.AsNode();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
62var currentNode = currentNodeOrToken.AsNode()!;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (1)
214_lazyReplacedExpression = (TExpressionSyntax)_lazySemanticRootOfReplacedExpression.GetAnnotatedNodesAndTokens(annotation).Single().AsNode()!;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (1)
175=> node.GetAnnotatedNodesAndTokens(annotationKind).Where(nt => nt.IsNode).Select(nt => nt.AsNode()!);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SyntaxPath.cs (1)
147nodeOrToken.AsNode() is TNode n)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (9)
235(currentNodeOrToken.IsToken || currentNodeOrToken.AsNode() is TExpressionSyntax or TStatementSyntax or TCrefSyntax)) 241? nodeOrToken.Parent.ReplaceNode(nodeOrToken.AsNode()!, currentNodeOrToken.AsNode()!) 251var currentNode = currentNodeOrToken.AsNode()!; 252if (this.NodeRequiresNonSpeculativeSemanticModel(nodeOrToken.AsNode()!)) 256var newRoot = root.ReplaceNode(nodeOrToken.AsNode()!, currentNode.WithAdditionalAnnotations(marker)); 265semanticModelForReduce = GetSpeculativeSemanticModel(ref currentNode, semanticModel, nodeOrToken.AsNode()!); 282reducedNodesMap[nodeOrToken.AsNode()!] = currentNodeOrToken.AsNode()!;
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SymbolKeyTests.cs (1)
1524GetAllSymbols(model, child.AsNode(), list, predicate);
System.Text.Json.SourceGeneration (3)
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithSimpleName.cs (3)
259var childNode = child.AsNode()!; 349nodeStack.Append(child.AsNode()!); 446SyntaxNode? childNode = child.AsNode()!;