3388 references to DescendantNodes
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
269var allNodes = comp.SyntaxTrees.SelectMany(s => s.GetRoot().DescendantNodes());
Microsoft.Analyzers.Extra.Tests (4)
SyntaxNodeExtensionsTests.cs (4)
54var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 86var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 149var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 179var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault();
Microsoft.AspNetCore.App.Analyzers (3)
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (1)
96.DescendantNodes()
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (1)
43&& parentNode.DescendantNodes().Count() > 1;
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
281.DescendantNodes()
Microsoft.AspNetCore.App.CodeFixes (1)
Authorization\AddAuthorizationBuilderFixer.cs (1)
68nodes = lambdaBlockBody.DescendantNodes();
Microsoft.CodeAnalysis (1)
Syntax\SyntaxTreeExtensions.cs (1)
35node = root.DescendantNodes(n => n.FullSpan.Contains(change)).LastOrDefault();
Microsoft.CodeAnalysis.CodeStyle (5)
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
105.DescendantNodes(n => n is TNamespaceSyntax)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
151if (operationBlock.Syntax.DescendantNodes(descendIntoTrivia: true)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
210foreach (var node in analysisRoot.DescendantNodes())
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
35node = root.DescendantNodes(n => n.FullSpan.Contains(change)).LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
262foreach (var node in containerDeclaration.DescendantNodes())
Microsoft.CodeAnalysis.CodeStyle.Fixes (6)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
135nodes = docComment.DescendantNodes(descendIntoChildren: _ => true)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
192var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n)).OfType<TReturnStatementSyntax>();
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
633foreach (var localDeclarationStatement in containingMemberDeclaration.DescendantNodes().OfType<TLocalDeclarationStatementSyntax>()) 787foreach (var memberDecl in newRoot.DescendantNodes().Where(n => n.HasAnnotation(s_memberAnnotation))) 831memberDeclaration.DescendantNodes()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
238currentNodeOrToken = newRoot.DescendantNodes().Single(c => c.HasAnnotation(marker));
Microsoft.CodeAnalysis.CSharp.CodeStyle (15)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>();
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
371foreach (var descendentNode in enclosingBlockOfLocalStatement.DescendantNodes())
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
113if (parent.DescendantNodes().OfType<StatementSyntax>().Count() <= 1)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
56foreach (var node in propertyDeclaration.DescendantNodes())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
552foreach (var identifier in containingBlock.DescendantNodes().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
252foreach (var identifierName in searchScope.DescendantNodes().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
245foreach (var descendentNode in block.DescendantNodes())
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
357foreach (var descendentNode in _enclosingBlock.DescendantNodes())
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (3)
169foreach (var descendentNode in enclosingBlock.DescendantNodes()) 210foreach (var descendentNode in enclosingBlock.DescendantNodes()) 231foreach (var descendentNode in enclosingBlock.DescendantNodes())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
449=> node.DescendantNodes(n => n == node || !n.IsReturnableConstruct()).Any(n => n is YieldStatementSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
379foreach (var localFunction in node.DescendantNodes().Where(CSharpSyntaxFacts.Instance.IsLocalFunctionStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
255var originalIdentifierNodes = originalLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText)); 261var replacedIdentifierNodes = replacedLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (2)
47var descendentXmlElements = nodeStructure.DescendantNodes().OfType<XmlElementSyntax>(); 62.DescendantNodes(descendIntoChildren: _ => true, descendIntoTrivia: false)
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
400.DescendantNodes(node => node is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax)
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
127unaryPattern.DescendantNodes().OfType<DeclarationPatternSyntax>().Any())
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
282parameterList.DescendantNodes().OfType<SimpleNameSyntax>(),
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
56foreach (var typeArgumentList in nameofInvocation.DescendantNodes().OfType<TypeArgumentListSyntax>().OrderByDescending(t => t.SpanStart))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
45foreach (var child in memberDeclaration.DescendantNodes())
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (10)
CodeGeneration\SyntaxGeneratorTests.cs (2)
42var statement = root.DescendantNodes().Single(n => n is ReturnStatementSyntax); 76var statement = root.DescendantNodes().Single(n => n is ReturnStatementSyntax);
Formatting\FormattingEngineTests.cs (1)
2223var newRoot = root.InsertNodesBefore(root.DescendantNodes().Last(), [entry]);
SymbolKey\SymbolKeyTestBase.cs (7)
252var usingNodes = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>(); 350var labels = body.DescendantNodes().OfType<LabeledStatementSyntax>(); 358var swlabels = body.DescendantNodes().OfType<SwitchLabelSyntax>(); 372IEnumerable<ExpressionSyntax> exprs = body.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>(); 373IEnumerable<ExpressionSyntax> tmp = body.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 375tmp = body.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>(); 378tmp = body.DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (294)
CodeGen\CodeGenAsyncMethodBuilderOverrideTests.cs (2)
895var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray(); 947var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenAwaitForeachTests.cs (31)
936var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1661var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1721var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1865var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1902var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1942var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1979var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2013var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2969var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3034var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3119var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3237var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3292var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3350var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3546var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3594var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3715var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4239var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4462var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4536var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4646var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 4745var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 5049var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 5130var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 5356var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 6439var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9107var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9183var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9261var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9322var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9393var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
CodeGen\CodeGenCheckedTests.cs (3)
2915var xNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression; 2922var checkedNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single(); 2947var xNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression;
CodeGen\CodeGenDeconstructTests.cs (46)
96var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 101var right = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 1111var deconstruction = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1128var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1366var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1423var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1467var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1508var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1561var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1668var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2688var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3130var lhs = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().First(); 3135var lhsNested = tree.GetRoot().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1); 3178var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3184var x234 = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 3189var x34 = tree.GetRoot().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1); 3242var x123 = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3248var x23 = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3280var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3286var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 3330var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3336var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2); 3443var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3447var literal = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3479var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3483var literal = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3635return tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == name).Single(); 3640return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 3645return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 3662return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 4042var deconstructionForeach = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 4405var collection = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Expression; 5472var firstX1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "x1").Single(); 5504var firstY = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").First(); 5509var secondY = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").ElementAt(1); 5535var firstX = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").First(); 5540var secondX = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").ElementAt(1); 6408var yz = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 6413var y = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 7067var discard = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(); 7238var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 7520var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 8358var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 8585var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 8629var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ElementAt(1); 9010var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
CodeGen\CodeGenForEachTests.cs (1)
1758var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\CodeGenFunctionPointersTests.cs (20)
3062var addressOfs = syntaxTree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().ToArray(); 3114var addressOf = syntaxTree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 3339var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Initializer!.Value.IsKind(SyntaxKind.AddressOfExpression)).ToArray(); 3410var declarator = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3457var declarator = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3568var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3620var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3671var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3710var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 4115var variableDeclaratorSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 4919.DescendantNodes() 7415var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 7517var functionPointerSyntaxes = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray(); 7573var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7593functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7642var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7662functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7729var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7747functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 10804var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenInterpolatedString.cs (1)
37var interpolatedStrings = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
CodeGen\CodeGenLocalFunctionTests.cs (6)
146var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 147var creation = localFunction.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 5749.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5824.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5897var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6162var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
CodeGen\CodeGenOperators.cs (3)
5409ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5699ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5735ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
CodeGen\CodeGenRefLocalTests.cs (6)
4033var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4036var refVar = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single(); 4070var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4073var refVar = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single(); 4104var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4107var refInt = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single();
CodeGen\CodeGenTupleEqualityTests.cs (47)
362var tupleX = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 381var tupleY = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Last(); 682var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 688var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 713var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 769var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 793var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 806var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 854var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 902var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 951var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1001var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1008var lastEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 1055var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1089var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1121var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1152var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1211var defaults = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1311var lastTuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Last(); 1397var literals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>(); 1408var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1463var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1497var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 1557var nulls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>(); 1566var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 1594var lastLiteral = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Last(); 1619var rightTuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 1675var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1683var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1707var addition = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 1776var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1782var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1918var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1924var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 2574var firstEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 2582var secondEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 2642var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 3278var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3684var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3808var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3911var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 4036var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 4083var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 4184var lastNull = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Last(); 4276var comparison = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 5122var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 5158var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
CodeGen\CodeGenTupleTest.cs (120)
1609var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3218var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3251var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3464var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3635var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3686var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3932var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3989var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4022var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4024var result = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "result").Single(); 4154var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4839var invocation1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 4844var invocation2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(2); 5075var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5119var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5160var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(0); 5164var memberAccess2 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(1); 5168var memberAccess3 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(2); 5204var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5473var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 7497var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7530var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7568var tuples = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 7631var tuples = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 8291var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8322var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8377var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8406var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8435var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8483var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8517var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8550var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8579var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8626var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8661var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8690var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8719var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8749var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8804var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8834var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8893var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8940var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9013var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9070var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9142var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9223var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9306var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9854var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9905var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9947var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9993var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 10059var t1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 10098var t1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(2); 10101var t2 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 10132var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 12693var node = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 13974var nameofNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "nameof").Single(); 13981var typeofNodes = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().ToArray(); 14245var m1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M1").Single(); 14261var m2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M2").Single(); 14275var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").First(); 14289var p1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "P1").First(); 14306var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M3").Single(); 14324var m4 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M4").Single(); 14331var m5 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single(); 14338var m6 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M6").Single(); 14433var e1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "E1").Single(); 14447var m5 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single(); 14454var v1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v1").Single(); 14464var v2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v2").Single(); 16539var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 16566var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 16603var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17210var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17271var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17330var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17368var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17401var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17434var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19229var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19291var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19394var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19425var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19479var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19537var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19660var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19704var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19735var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 20357var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 21350var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 22855var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 24180var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "elem2").ToArray(); 24196var type = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().Single(); 24259var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24269var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24322var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24332var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24386var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24396var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24459var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24469var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24532var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24542var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24606var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24616var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 25024var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 25053var y = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(0); 25058var z = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(1); 25084var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 25703var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25774var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25839var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25881var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 25911var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 26223var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 26295var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26328var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26361var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26394var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 27567var literal = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
CodeGen\ForeachTest.cs (1)
1687var decl = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\IndexAndRangeTests.cs (2)
34return (model, root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList()); 3857var receivers = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Select(e => e.Expression).ToArray();
CodeGen\ObjectAndCollectionInitializerTests.cs (2)
1107var node = tree.GetRoot().DescendantNodes().OfType<Syntax.ObjectCreationExpressionSyntax>().Last(); 3589var node = tree.GetRoot().DescendantNodes().OfType<Syntax.ObjectCreationExpressionSyntax>().Single();
CodeGen\PatternTests.cs (3)
5004var switchExpressions = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray(); 5130var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 5279var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (33)
CodeGen\IndexAndRangeTests.cs (18)
91var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Skip(2).First(); 332var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 419var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 506var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 624var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 1573var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 1808var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 2263var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 2678var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 2841var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3019var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3133var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3304var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3455var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3641var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3731var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3817var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3890var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last();
Emit\NumericIntPtrTests.cs (15)
699var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 1917var nodes = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>(); 1969var nodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(); 6009var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 6245var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 6621var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 6853var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 8126var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 10547var returnStatements = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray(); 10686var methods = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 11173var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11196var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11224var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11249var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11294var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (652)
Attributes\AttributeTests.cs (19)
87var nodes = Parse(aliases).GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>(); 707var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 710var m0 = semanticModel.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().Last()); 748var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 752var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 812var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 813var interpolationSyntax = root.DescendantNodes().OfType<InterpolationSyntax>().Single(); 817var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 854var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 858var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 895var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 899var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 934var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().First(); 938var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().First(); 7537var attrArgSyntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>(); 7578var attrArgSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 11637var firstArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().First(); 11641var secondArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Skip(1).First(); 11645var thirdArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Skip(2).Single();
Attributes\AttributeTests_RefReadOnly.cs (4)
1379var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1421var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1450var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1477var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
Attributes\AttributeTests_WellKnownAttributes.cs (7)
5768var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 9550var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9599var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9655var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(n => n.Identifier.ValueText == "OnBehaviorAttached"); 11398var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 11423var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 11454var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Diagnostics\DiagnosticAnalyzerTests.cs (4)
3682var field1 = tree1.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration.Variables.Single().Identifier; 3749var localDecl1 = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 4152var baseListNode = root.DescendantNodes().OfType<BaseListSyntax>().Single(); 4310var localDeclaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Diagnostics\GetDiagnosticsTests.cs (3)
782var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1061var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1549var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
FieldKeywordTests.cs (9)
1275var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Select(arg => arg.Expression).ToArray(); 1333var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Select(arg => arg.Expression).ToArray(); 9474return tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>(). 10490var previousAccessor = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 10493var modifiedAccessor = modifiedTree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 10495var expr = modifiedAccessor.DescendantNodes().OfType<FieldExpressionSyntax>().Single(); 10524var previousAccessor = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 10527var modifiedAccessor = modifiedTree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 10529var expr = modifiedAccessor.DescendantNodes().OfType<FieldExpressionSyntax>().Single();
FirstClassSpanTests.cs (4)
2824var arg = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2857var casts = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToImmutableArray(); 5001var aVariable = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 5004var d1Access = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>()
FlowAnalysis\FlowTests.cs (1)
5841var declarations = tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToImmutableArray();
FlowAnalysis\IterationJumpYieldStatementTests.cs (1)
914var foreachNode = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
FlowAnalysis\RegionAnalysisTests.cs (21)
5487var methodBlock = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().First(); 5488var foreachStatement = methodBlock.DescendantNodes().OfType<ForEachStatementSyntax>().First(); 5489var foreachBlock = foreachStatement.DescendantNodes().OfType<BlockSyntax>().First(); 5490var lambdaExpression = methodBlock.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().First(); 5491var lambdaBlock = lambdaExpression.DescendantNodes().OfType<BlockSyntax>().First(); 5536var node = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 5580var node = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 5623var node = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 6217var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6228var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6418var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().FirstOrDefault(); 8099var expr = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 8127var expr = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 14121var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 14144var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 14169var decls = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToArray(); 14176var binOps = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 14207var decl = tree.GetRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Single(); 14212var binOps = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 14252var decl = tree.GetRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Last(); 14258var binOps = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray();
OverloadResolutionPriorityTests.cs (8)
444var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 700var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 760var accesses = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray(); 808var creation = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 979var secondCtor = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Skip(ctorToForce).First(); 2313var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 2411var invocation = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 2583var symbols = tree.GetRoot().DescendantNodes()
RefReadonlyParameterTests.cs (3)
1525var local = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7103var cref = docComment.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Select(attr => attr.Cref).Single(); 7131var cref = docComment.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Select(attr => attr.Cref).Single();
RefStructInterfacesTests.cs (114)
6629var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 6766var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 6882var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7014var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7143var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7473var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7576var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 7663var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7766var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 7882var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 7985var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 8076var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8176var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8269var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8369var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8442var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8444var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8548var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8648var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8932var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9019var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9136var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9223var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9332var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9387var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9500var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9587var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9715var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 9811var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9936var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10020var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10151var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10247var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10348var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10350var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10443var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10445var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10543var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10630var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10740var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10827var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10980var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 11067var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 11199var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11295var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11423var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11507var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11607var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11702var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 12149var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12417var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 12662var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12925var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13192var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13454var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 14152var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14259var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 14493var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14600var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 14855var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 14966var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 15206var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15310var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15554var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15658var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15733var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15735var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15988var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 16096var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16759var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16761var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16824var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16826var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16889var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16891var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16973var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16975var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17061var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17063var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17154var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17156var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17251var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17253var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17335var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17337var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17656var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17763var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17853var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17960var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18076var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 18183var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 18276var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18380var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18477var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18581var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18653var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18655var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18761var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18865var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19129var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19200var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19300var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19371var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19473var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19528var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19625var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19696var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19864var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19967var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 19969var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 21239var lambda = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 21245var localFunctions = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 21306var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 21708var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray();
Semantics\CollectionExpressionTests.cs (51)
201var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 236var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 4770var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7534var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8257var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8328var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8412var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8497var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 14234var returnValue = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14310var returnValue = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14383var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 14446var cast = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14451var value = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Last().Expression; 14570var cast = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14575var value = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Last().Expression; 14653var nestedCollection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 14742var nestedCollection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 15080var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 26013var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26139var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26253var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26311var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26382var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26464var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26530var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26591var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26661var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26836var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26901var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "CreateCollection"); 26957var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 28620var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28664var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28710var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28754var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28797var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28840var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 28879var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 28912var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 28946var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28999var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29065var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29126var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29202var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 29245var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29292var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 32304var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32399var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32441var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32486var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 33465var collectionExpression = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().First(); 33506var collectionExpression = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().First();
Semantics\InlineArrayTests.cs (16)
2359var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2394var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2428var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2508var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").First(); 6033var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").First(); 6199var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 8118var f = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left; 8835var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").Single().Parent; 9203var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").Single(); 10547var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 11291var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 15208var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").ToArray(); 16495var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").First().Parent; 18583var f = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression; 18909var f = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression; 19246var collection = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression;
Semantics\OutVarTests.cs (85)
178Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 386Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 423Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 461Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 499Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 537Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 575Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 622Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 659Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 697Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 737Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 776Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 816Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 833return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 838return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 854return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 860return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 865return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 870return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 1279forStatement.Statement.DescendantNodes().OfType<ForStatementSyntax>().Any(f => f.Condition == null)) 5313var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 5583var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 9702var d = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 10269var d = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 11077var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 11335var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 17749var x2Decl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 18444var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 21370var e = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single(); 32232var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single()); 32272var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single()); 32312var a = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "a").Single()); 32385var bDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single(); 32483var x1Decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 32506var one = node0.DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 32521var x1Decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 33506var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "x").Single(); 33694var z1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "z1").First(); 34329var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34330var rankSpecifierOld = method.DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 34543var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34544var rankSpecifierOld = method.DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 35179var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35218var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35262var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35293var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35332var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35364var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35400var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35439var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35469var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35506var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35668var identifierAfter = statementAfter.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "G"); 35697var foreachStatement = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 35852var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 35898var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 35982var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 36001var blockBodySyntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 36026var expressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36049var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 36122var expressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36146var blockBodySyntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 36170var propertyExpressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().ElementAt(1); 36175var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 36230var node3 = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36323var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test3").Last(); 36363var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36366var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36371Assert.True(model.TryGetSpeculativeSemanticModel(method.Body.SpanStart + 1, method.DescendantNodes().OfType<AttributeSyntax>().Single(), out speculativeModel)); 36409var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36412var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Skip(1).First(); 36416Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36449var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36452var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36457var equalsValue = method.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 36491var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36494var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36498Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36526var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36529var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36534var equalsValue = method.DescendantNodes().OfType<ParameterSyntax>().Single() 36535.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 36564var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36567var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36571Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
Semantics\ParamsCollectionTests.cs (22)
119var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Take(3).ToArray(); 218var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 334var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 517var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 662var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 1406var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2530var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2666var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2757var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2791parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2955var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2986parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 3596var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 3886var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 4340var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First()); 4346parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Skip(1).First()); 5893var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").Single(); 5895var f2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F2").Single(); 5975var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").Single(); 5977var f2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F2").Single(); 9072var parameterDecl = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "paramsParameter").Single(); 12533var node = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\PatternMatchingTestBase.cs (6)
37return tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Parent.Kind() == SyntaxKind.DeclarationPattern || p.Parent.Kind() == SyntaxKind.VarPattern); 47return tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 52return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 62return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 428Assert.Empty(tree.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()); 459var node = tree.GetRoot().DescendantNodes().OfType<T>().ElementAt(index);
Semantics\PatternMatchingTests.cs (37)
849var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 1432var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1433var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1482var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1483var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1591var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1592var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1656var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1657var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1662var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 1663var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 1668var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray(); 1669var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 1739var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 1740var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 1745var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray(); 1746var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 2702var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2703var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2747var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2748var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2791var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2792var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2843var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2844var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3040var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 3041var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3087var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 3088var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3265foreach (var isExpression in tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>()) 3445var declaration = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3577var node = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().First(); 6573var caseDefault = tree.GetRoot().DescendantNodes().OfType<CasePatternSwitchLabelSyntax>().First(); 11365var exprs = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 11389var locals = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 11410var syntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().Single(); 11467var syntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().Single();
Semantics\PatternMatchingTests_ListPatterns.cs (11)
3319var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 3324var localDeclarations = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3618var nodes = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>(); 3675var nodes = tree.GetRoot().DescendantNodes() 3720var designations = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4085var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4172var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4249var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4363var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4405var nodes = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>(); 4556var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
Semantics\PatternMatchingTests_Scope.cs (73)
678var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 679var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 713tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 719var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 720var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 947var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 948var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 982tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 988var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 989var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2222var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2358var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2421var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2486var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 2556var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 2712var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 6525var d = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 6590var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6591var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 6594var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6595var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6601var x6Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single(); 6602var x6Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single(); 6605var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single(); 6606var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 6610var x14Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray(); 6611var x14Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single(); 6679var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6680var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 6683var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6684var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6690var x6Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single(); 6691var x6Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single(); 6694var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single(); 6695var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 6699var x14Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray(); 6700var x14Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single(); 6838var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 6839var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 6845var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single(); 6846var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 6850var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6851var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6884bool success = model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, statement, out model); 6930var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6931var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 6936var d = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 10589var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 10590var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 10597var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").Single(); 10598var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").Single(); 10601var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single(); 10602var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").Single(); 10605var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 10606var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 10612var x5Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x5").Single(); 10613var x5Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x5").ToArray(); 10617var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").ToArray(); 10618var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 10627var x9Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x9").Single(); 10628var x9Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x9").Single(); 10631var x10Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x10").Single(); 10632var x10Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x10").Single(); 10635var x11Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x11").Single(); 10636var x11Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x11").ToArray(); 10640var x12Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x12").Single(); 10641var x12Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x12").ToArray(); 10685var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 10686var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 10720tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 10726var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 10727var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 12211var e = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single();
Semantics\PatternMatchingTests2.cs (5)
720foreach (var designation in tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>()) 727foreach (var ident in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 2020var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2061var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2881var switches = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray();
Semantics\PatternMatchingTests3.cs (12)
49var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 109var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 160var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 205var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 256var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 299var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 346var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1611var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 1889var strDecl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "str").ToArray(); 1893var arrDecl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "arr").ToArray(); 4107var patterns = tree.GetRoot().DescendantNodes().OfType<PatternSyntax>().ToArray(); 4334var patterns = tree.GetRoot().DescendantNodes().OfType<PatternSyntax>().ToArray();
Semantics\PatternMatchingTests4.cs (13)
1010var dpcss = tree.GetRoot().DescendantNodes().OfType<PositionalPatternClauseSyntax>().ToArray(); 4017var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4086var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4159var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4231var @is = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 4275var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4322var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4404var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4486var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4568var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4650var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4734var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4828var x = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().First();
Semantics\PatternMatchingTests5.cs (9)
427var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 564var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 795var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 841var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 895var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 1106var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1186var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1237var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1289var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
Semantics\PatternSwitchTests.cs (6)
1515var sRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s").Single(); 1517var iRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i").Single(); 1519var s2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s2").Single(); 1521var i2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i2").Single(); 3252var node = tree.GetRoot().DescendantNodes() 3283var node = tree.GetRoot().DescendantNodes()
Semantics\PrimaryConstructorTests.cs (50)
420var parameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 961var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 1003var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1072var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 1085var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 1184var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 1194var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 1220var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last(); 1300var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 1311var y = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First(); 1324var test = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First(); 1365var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1411var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1422var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1467var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1483var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1526var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1551var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1615var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1640var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1814var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1854var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1897var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1967var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 2118var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 2173Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 2217Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 2221var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2300var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 2325Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 2356Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 2360var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2425var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2474tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First(); 2484tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First(); 2489var baseWithoutParens = tree.GetRoot().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single(); 2641var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2652var typeDeclaration = tree.GetRoot().DescendantNodes().OfType<TypeDeclarationSyntax>().Single(); 2679var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2716var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2752var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 6091var x = doc.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 6832var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 6858var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 6859var attrApplication = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 6860var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 7794var p1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").Single(); 8756var p1s = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray(); 9162var p1s = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray(); 19784var indexer = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
Semantics\RecordTests.cs (58)
282var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 448var parameterSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 454var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 480var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 1816var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 2489var x = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left; 8091var withExpr1 = root.DescendantNodes().OfType<WithExpressionSyntax>().First(); 8130var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8603var withExpr = root.DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8610var xId = withExpr.DescendantNodes().Single(id => id.ToString() == "X"); 8630var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 8717var withExpr = root.DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8735var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 8865var withExpr1 = root.DescendantNodes().OfType<WithExpressionSyntax>().First(); 8878var withExpr2 = root.DescendantNodes().OfType<WithExpressionSyntax>().Skip(1).Single(); 21189var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 21202var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 21302var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 21313var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 21339var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last(); 21419var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 21430var y = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First(); 21443var test = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First(); 21484var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21530var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21541var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21586var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21602var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21645var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21670var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21734var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21759var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21933var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21970var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22010var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22045var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22124var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 22275var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 22330Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 22374Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 22378var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 22457var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 22482Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 22513Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 22517var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 22962var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().First(); 23416var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().ElementAt(1); 24688var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24699var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Single(); 24723var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24757var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24792var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 28232var x = doc.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 28389var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 30416var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 30440var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 30441var attrApplication = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 30442var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (4)
EndToEndTests.cs (4)
493var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 614var literals = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 701var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().SelectAsArray(node => model.GetInterceptableLocation(node)); 880var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Features (36)
ChangeSignature\CSharpChangeSignatureService.cs (2)
779.DescendantNodes(descendIntoTrivia: true) 819var identifier = nameAttribute.DescendantNodes(descendIntoTrivia: true).OfType<IdentifierNameSyntax>().FirstOrDefault();
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (2)
150foreach (var node in parentBlock.DescendantNodes()) 302foreach (var id in localFunction.DescendantNodes().OfType<IdentifierNameSyntax>())
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
390=> node.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax)
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
38var namespaceDecls = compilationUnit.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (2)
312var designation = leftPattern.DescendantNodes() 594var nodes = editor.OriginalRoot.DescendantNodes().Where(IsFixableNode).ToArray();
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
287var yieldStatementsCount = memberDeclarationSyntax.DescendantNodes().OfType<YieldStatementSyntax>()
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
754if (memberDeclarationNode.DescendantNodes().OfType<ReturnStatementSyntax>().Count() == 1)
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
96var namespaceDecl = root.DescendantNodes().OfType<BaseNamespaceDeclarationSyntax>().FirstOrDefault();
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
500foreach (var descendant in interpolation.DescendantNodes().OfType<ExpressionSyntax>())
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (2)
149var throwExpressionsAndStatements = member.DescendantNodes().Where(n => n.Kind() is SyntaxKind.ThrowExpression or SyntaxKind.ThrowStatement); 190block.DescendantNodes().OfType<ThrowStatementSyntax>().Any(t => t.Expression is null))
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
129.DescendantNodes(d => d.Span.IntersectsWith(span))
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
435var declarations = statement.DescendantNodes()
Formatting\CSharpNamespaceDeclarationNewDocumentFormattingProvider.cs (1)
47var declarations = root.DescendantNodes().OfType<BaseNamespaceDeclarationSyntax>();
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
433var localFunctions = innermostCommonBlock.DescendantNodes().Where(node => node.IsKind(SyntaxKind.LocalFunctionStatement) && matches.Any(match => match.Span.OverlapsWith(node.Span))); 443var localFunctionCalls = innermostCommonBlock.DescendantNodes().Where(node => node is InvocationExpressionSyntax invocationExpression &&
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>();
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
371foreach (var descendentNode in enclosingBlockOfLocalStatement.DescendantNodes())
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
113if (parent.DescendantNodes().OfType<StatementSyntax>().Count() <= 1)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
56foreach (var node in propertyDeclaration.DescendantNodes())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
552foreach (var identifier in containingBlock.DescendantNodes().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
252foreach (var identifierName in searchScope.DescendantNodes().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
245foreach (var descendentNode in block.DescendantNodes())
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
357foreach (var descendentNode in _enclosingBlock.DescendantNodes())
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (3)
169foreach (var descendentNode in enclosingBlock.DescendantNodes()) 210foreach (var descendentNode in enclosingBlock.DescendantNodes()) 231foreach (var descendentNode in enclosingBlock.DescendantNodes())
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (2)
47var descendentXmlElements = nodeStructure.DescendantNodes().OfType<XmlElementSyntax>(); 62.DescendantNodes(descendIntoChildren: _ => true, descendIntoTrivia: false)
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
400.DescendantNodes(node => node is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax)
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
127unaryPattern.DescendantNodes().OfType<DeclarationPatternSyntax>().Any())
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
282parameterList.DescendantNodes().OfType<SimpleNameSyntax>(),
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
56foreach (var typeArgumentList in nameofInvocation.DescendantNodes().OfType<TypeArgumentListSyntax>().OrderByDescending(t => t.SpanStart))
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (19)
EditAndContinue\SyntaxUtilitiesTests.cs (19)
24foreach (var oldNode in oldRoot.DescendantNodes().Where(n => n.FullSpan.Length > 0)) 87var leftPosition = leftRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(2).SpanStart; // 0 within Console.WriteLine(0) 134var leftPosition = leftRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(5).SpanStart; // 3 within Console.WriteLine(3) 184var m0 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M0"); 185var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 186var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2"); 187var m3 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M3"); 189var f1 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f1"); 190var f2 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f2"); 192var l1 = m3.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "l1").Initializer. 193DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 195var l2 = m3.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "l2").Initializer. 196DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 198var l3 = m3.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "l3").Initializer. 199DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 252var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "X"); 253var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 254var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2"); 255var f = m2.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f");
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (91)
IOperation\IOperationTests.cs (11)
181var m = comp.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<BlockSyntax>().Single(); 260var m = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 311var op = (IForLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<ForStatementSyntax>().Single()); 352var m = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 379var op = (IForEachLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 413var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 463var assignments = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().ToArray(); 509var statement = tree.GetRoot().DescendantNodes().OfType<StatementSyntax>().Single(); 588var literal = root.DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 667var catchBlock = syntaxTree.GetRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single(); 711var fieldInitializer = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last().Value;
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (4)
409var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 489var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 847var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 902var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
IOperation\IOperationTests_ICoalesceAssignmentOperation.cs (1)
253var m = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_ICoalesceOperation.cs (11)
36var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 147var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 262var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 377var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 493var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 606var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 721var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 837var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 951var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1053var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1168var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
IOperation\IOperationTests_IConstructorBodyOperation.cs (19)
40var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 67var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 123var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 189var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 257var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 323var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 398var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 487var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 514var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 589var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 651var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 721var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 796var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 865var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 955var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1072var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1092var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1125var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1163var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Skip(1).Single();
IOperation\IOperationTests_IConversionExpression.cs (1)
5292var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
IOperation\IOperationTests_IFieldReferenceExpression.cs (2)
707var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 711var methodDecl = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_IFixedStatement.cs (1)
693var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
IOperation\IOperationTests_ILocalFunctionStatement.cs (2)
1793var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First())); 1848var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First()));
IOperation\IOperationTests_IMethodBodyOperation.cs (27)
35var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 56var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 109var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 171var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 243var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 285var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 333var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 400var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 444var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First(); 506var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First(); 562var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 581var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 613var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 657var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 704var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 723var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 755var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 799var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 846var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 865var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 897var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 938var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 978var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 1000var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 1035var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 1080var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 1124var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
IOperation\IOperationTests_IObjectCreationExpression.cs (6)
782var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1069var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1295var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1574var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2276var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2400var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M");
IOperation\IOperationTests_ISymbolInitializer.cs (1)
33var nodes = tree.GetRoot().DescendantNodes().Where(n => n is VariableDeclarationSyntax || n is PropertyDeclarationSyntax).ToArray();
IOperation\IOperationTests_IVariableDeclaration.cs (5)
925var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1215var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2301var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2362var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2830var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1288)
Semantics\AccessCheckTests.cs (4)
743IAliasSymbol aliasA = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()) as IAliasSymbol; 761var discards = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken).ToArray(); 897IAliasSymbol SomeAlias = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()); 911IMethodSymbol IntegerPlus = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single()).Symbol as IMethodSymbol;
Semantics\AnonymousFunctionTests.cs (6)
983var anonymousMethodSyntax = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 984var simpleLambdaSyntax = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 985var parenthesizedLambdaSyntax = root.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 1017var anonymousMethodSyntax = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 1018var simpleLambdaSyntax = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 1019var parenthesizedLambdaSyntax = root.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
Semantics\AwaitExpressionTests.cs (2)
84var awaitExpression = tree.GetRoot().DescendantNodes().OfType<AwaitExpressionSyntax>().First(); 273var decl = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().AsSingleton();
Semantics\BetterCandidates.cs (4)
1087var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1164var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1212var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1265var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Semantics\BindingAsyncTests.cs (3)
58var simple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 61var parens = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 87var del = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Semantics\BindingTests.cs (27)
2365var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single(); 2384var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single(); 2724.DescendantNodes() 2736.DescendantNodes() 2780.DescendantNodes() 2835.DescendantNodes() 2847.DescendantNodes() 2888var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2925var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2931var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName)); 2967var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2973var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName)); 3037var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3051var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3117var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3131var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3190var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3205var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3275var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3290var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3380var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "MathMin").Single().Parent; 3732var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "E").Single().Parent; 3912var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "G").First(); 3939var lambda = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(s => s.Parameter.Identifier.Text == "x"); 3985var ids = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ToArray(); 4026var ids = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ToArray(); 4038var ifStmt = tree.GetRoot().DescendantNodes().OfType<IfStatementSyntax>().First();
Semantics\ColorColorTests.cs (9)
1817var memberAccess = syntaxRoot.DescendantNodes().Single(node => node.IsKind(SyntaxKind.SimpleMemberAccessExpression)) as MemberAccessExpressionSyntax; 1882var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1892var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1939var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1949var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1996var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 2006var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 2046var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 2055var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
Semantics\ConditionalOperatorTests.cs (3)
1346var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 1400var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 1447var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single();
Semantics\ConstantTests.cs (2)
2923var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 3521var initializer = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value;
Semantics\DeconstructionTests.cs (46)
1839var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3765var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3943var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4169var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4171var refs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>(); 4237var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4256var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4314var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4372var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4391var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4445var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4507foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 4515var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4579var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4665var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4722var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4759var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4837var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4942var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4988var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 5046var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 5130Assert.False(tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 5186var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5205var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5259var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5330var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5349var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5403var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5478foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 5486var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5546var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5654var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5673var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5709var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5764var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5783var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5819var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5878foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 5886var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5925var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5986var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6029var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6069var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6111var two = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "2").Single(); 6151var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6554var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
Semantics\DelegateTypeTests.cs (35)
749var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 795var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 895var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 938var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 996var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 1036var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 1211var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1247var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1332var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1372var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1415var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1459var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1554var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1634var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1684var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1734var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1784var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1834var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1884var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1934var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1980var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 2028var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 3603var exprs = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToArray(); 8028var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 8051var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 10386var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Initializer != null); 11084var nodes = tree.GetRoot().DescendantNodes(); 11170var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray(); 12110var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 14732var syntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 14777var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 19792var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 19800typeInfo = model.GetTypeInfo(declarator.Initializer!.Value.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single()); 19834var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 19842typeInfo = model.GetTypeInfo(declarator.Initializer!.Value.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single());
Semantics\DynamicTests.cs (186)
3860var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3893var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3921var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3949var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 4000var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 4976var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 4985var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5059node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5100var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5109var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5182node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5223var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5232var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5306node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5341var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5346var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5382var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5387var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5426var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5431var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5470var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5475var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5514var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5519var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5578var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5616var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5655var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "e").Single(); 5691var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5696var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5732var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5737var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5777var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5782var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5822var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5827var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5867var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5872var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5935var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5974var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6022var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6031var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6104node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6145var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6154var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6227node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6265var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6274var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6347node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6377var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6382var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6419var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6424var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6466var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6471var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6510var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6515var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6552var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6559foreach (var elementAccess in tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>()) 6571var increment = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 6606var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6613foreach (var elementAccess in tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>()) 6671var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6680var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6736node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6780var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6789var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6845node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6890var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6899var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6956node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6991var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6996var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7059var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7068var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7118node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7162var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7171var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7230node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7275var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7284var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7346node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7391var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7400var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7463node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7504var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7513var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7581var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7590var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7642node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7686var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7695var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7748node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7792var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7801var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7854node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7895var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7905var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7967var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7976var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8029node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8073var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8082var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8135node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8178var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8187var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8239node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8283var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8292var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8348node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8392var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8401var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8457node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8501var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8510var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8566node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8620var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8677node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8724var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8729var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8793var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8798var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8861var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8870var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8926var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9016var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9107var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9197var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9253var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9314var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9435var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9555var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9669var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9780var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9891var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 10009var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10014node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10022var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10092node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10137var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10142node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10150var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10220node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10265var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10270node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10278var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10348node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10419var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10424node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10432var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10500node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10553var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10558node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10566var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10647node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10701var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10706node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10714var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10797node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10971var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10976node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10984var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11063node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 11100var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11105var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11184var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11189var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11262var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11267var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11317var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11326var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11370var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11379var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11419var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11450var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11455var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11494var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11499var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11535var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11540var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11584var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11593var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11636var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11645var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11680var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11685var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
Semantics\ExpressionBodiedMemberTests.cs (23)
42.DescendantNodes() 426var node = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 475var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 506var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 535var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 540Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single().Body.Position)); 542var node2 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single() 543.Body.DescendantNodes().OfType<AssignmentExpressionSyntax>() 575var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 580Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single().Body.Position)); 582var node2 = tree.GetRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single() 583.Body.DescendantNodes().OfType<AssignmentExpressionSyntax>() 616Assert.Equal(1, tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Count()); 649var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 680var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 711var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 742var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 777var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 808var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 839var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 874var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 913var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 1021var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
Semantics\ForEachTests.cs (6)
2129var loopSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2181var loopSyntaxes = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 2885var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3326var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3360var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3421var node = tree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.ForEachStatement).OfType<ForEachStatementSyntax>().Single();
Semantics\FunctionPointerTests.cs (50)
201var initializer1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First().Initializer!.Value; 203var parameter = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments.Single(); 205var initializer2 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Last().Initializer!.Value; 293foreach (var literal in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(v => v.Initializer!.Value)) 351var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 402var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 454var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 502var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 600var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList(); 839var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList(); 882var variableDeclaratorSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 942var variableDeclaratorSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 978var variableDeclaratorSyntaxes = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1046var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1126var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1271var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1366var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1507var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1564var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1615var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1662var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1695var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1728var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1775var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1822var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1855var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1888var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1936var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2054var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2088var localSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2226.DescendantNodes() 2283.DescendantNodes() 2356.DescendantNodes() 2430.DescendantNodes() 2498.DescendantNodes() 2595.DescendantNodes() 2668.DescendantNodes() 3178var invocations = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList(); 3297var invocations = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList(); 3376var isPatterns = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().ToArray(); 3433var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3475var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3528var binaryExpressions = syntaxTree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 3582var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3583var funcPtrTypeSyntax = isPattern.DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 3677var paramTypes = syntaxTree.GetRoot().DescendantNodes() 3805VariableDeclarationSyntax fieldDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration; 3815.DescendantNodes() 3817.Single().DescendantNodes() 3949var parameterDecls = syntaxTree.GetRoot().DescendantNodes()
Semantics\FuzzTests.cs (1)
53foreach (var node in tree.GetRoot().DescendantNodes())
Semantics\GenericConstraintsTests.cs (4)
3140var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3170var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3196var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3225var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Semantics\GlobalUsingDirectiveTests.cs (42)
3842var ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3844var aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3868ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3870aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3890aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3899ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3901aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3918aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3932ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3934aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3952ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3954aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3968aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3977ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3979aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3990aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4004ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4006aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4024ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4026aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4040aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4049ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4051aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4062aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4076ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4078aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4090ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4092aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4100aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4111ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4113aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4133ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4135aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4149ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4151aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4243var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4251node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4279node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4287node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4295node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4303node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4315node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Semantics\ImplicitObjectCreationTests.cs (23)
56var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 131var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 178var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 228var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 842var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 883var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 1706var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1866var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1896var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1926var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1978var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2036var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2071var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2125var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 2217var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2514var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2565var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2922var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 3215var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4157var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4184var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Single(); 4531var nodes = (from node in tree.GetRoot().DescendantNodes() 4574var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "aParameter").Single();
Semantics\IndexAndRangeTests.cs (9)
898var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 918var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 939var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 1122var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray(); 1251var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(1); 1284var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(2); 1317var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(3); 1341var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray(); 1384var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray();
Semantics\InitOnlyMemberTests.cs (6)
2521var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3140AccessorDeclarationSyntax accessorDecl = root.DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3154.DescendantNodes() 3192var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 4143var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4148var delegateSyntax = tree.GetRoot().DescendantNodes().OfType<DelegateDeclarationSyntax>().Single();
Semantics\InteractiveUsingTests.cs (2)
87var syntax = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 117var syntax = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
Semantics\InterceptorsTests.cs (32)
46var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().SelectAsArray(node => model.GetInterceptableLocation(node)); 179var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1378Assert.Collection(source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(), 1983var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2094var node1 = root.DescendantNodes().First(node => node is IdentifierNameSyntax name && name.Identifier.Text == "Prop"); 2097var node2 = root.DescendantNodes().Single(node => node is ObjectCreationExpressionSyntax); 2100var node3 = root.DescendantNodes().Last(node => node is IdentifierNameSyntax name && name.Identifier.Text == "Program"); 2286var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 3543var interceptableName = sourceTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last().GetInterceptableNameSyntax()!; 6152var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7298var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7348if (tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList() is not [var node, var otherNode]) 7500var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7541var node = sourceTree1.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7587var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7633var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7684var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7709var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7755var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7796var node = source.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 7837var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7881var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7924var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7977var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8023var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8082var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8142var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8197var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8252var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8302var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8360var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "RS().M()"); 8424var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "new S().M()");
Semantics\InterpolationTests.cs (3)
4599var descendentNodes = tree.GetRoot().DescendantNodes(); 4602.Where(b => b.DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().Any()) 4825SyntaxNode syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\IteratorTests.cs (5)
458var yieldNode = (YieldStatementSyntax)tree.GetRoot().DescendantNodes().Where(n => n is YieldStatementSyntax).SingleOrDefault(); 481var yieldNode = (YieldStatementSyntax)tree.GetRoot().DescendantNodes().Where(n => n is YieldStatementSyntax).SingleOrDefault(); 578var node = tree.GetRoot().DescendantNodes().OfType<YieldStatementSyntax>().First(); 609var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 647var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Semantics\LambdaDiscardParametersTests.cs (8)
68var underscores = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ToString() == "_").ToArray(); 386var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); 417var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray(); 422var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 448var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 482var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 513var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 566var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray();
Semantics\LambdaTests.cs (77)
841ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(). 849var exprs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 941var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1035.DescendantNodes() 1089.DescendantNodes() 1124.DescendantNodes() 1178var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; 1206var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 1238var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; 1513var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1548var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1582var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1614var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1979var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AnonymousMethodExpression)).Single(); 2120var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2121var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2166var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2167var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2212var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2213var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2258var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2259var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2304var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2305var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2334var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2335var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2361var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2362var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2415foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2461foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2507foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2540foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2573foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2610foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2662var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); 2997ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); 3004ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); 3013ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 3039ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); 3046ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); 3054ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 3612var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); 3893var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3937var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().ToImmutableArray(); 3977var a = (IdentifierNameSyntax)tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; 3986var m = newTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3990a = (IdentifierNameSyntax)newTree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; 4093var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 4122var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4157var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4185var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4212var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4787var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4872var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4927var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4954var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4982var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 5028var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 5636var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6509var parameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6819var discard = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6848var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6897var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 7011var action = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.ValueText == "Action"); 7108var lambdas = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray(); 8010var lambdas = tree.GetRoot().DescendantNodes() 8058var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 8059var equalsValue = lambda.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 8087var newLambda = newMethod.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 8118var decls = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToImmutableArray(); 8126var defaultValue = decls[1].DescendantNodes().OfType<LambdaExpressionSyntax>().Single() 8127.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 8132var lhs = decls[2].DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 8157var defaultValue = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single() 8158.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 8360var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 8393var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Semantics\LocalFunctionTests.cs (48)
349.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 353var x = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 394var a = tree.GetRoot().DescendantNodes() 405.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 409a = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ElementAt(2); 451var attributeSyntax = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 493var localFunction = tree.GetRoot().DescendantNodes() 541var localFunction = tree.GetRoot().DescendantNodes() 805var localFunction = tree.GetRoot().DescendantNodes() 852var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 968var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 1022var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().ToList(); 1060var attrSyntax = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 1720var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.ValueText == "x").Single(); 1767var a = root.DescendantNodes() 1785var clsCompliant = root.DescendantNodes() 1842var a = root.DescendantNodes() 1860var clsCompliant = root.DescendantNodes() 2373LocalFunctionStatementSyntax declaration = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 2587var exprs = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToImmutableArray(); 4686var descendents = tree.GetRoot().DescendantNodes(); 4724var descendents = tree.GetRoot().DescendantNodes(); 4962var b2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b2").Single(); 4965var b1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b1").Single(); 6489var exprs = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray(); 6536var exprs = tree.GetRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray(); 6550return tree.GetRoot().DescendantNodes(). 7038var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 7098var nodes = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 7360=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7383return node.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "TParameter").Single(); 7451return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == identifier).Single().SpanStart; 7455=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7458=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 7532=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7585=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7639var tParameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 8684var parameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 8739var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8742var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8779var nameofExpression = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8941=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 8964return node.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "parameter").Single(); 9445=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 9552var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 9763=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 10172var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 10385var localFunction = root.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
Semantics\LockTests.cs (9)
45var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 50var lockStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().Single(); 55var memberAccessExpression = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 489var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList(); 550var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().Single(); 575var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList(); 604var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 628var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 699var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList();
Semantics\LookupTests.cs (9)
1501var node = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "m.M").Single(); 1643var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "returne<double>").First(); 1670var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "System.Object").First(); 1725var syntaxes = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 2014var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 2044var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression; 2074var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression; 2100var node = tree.GetRoot().DescendantNodes().OfType<GenericNameSyntax>().Single(); 2122var node = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single();
Semantics\MethodTypeInferenceTests.cs (4)
859return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 864return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 1047var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1077var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Semantics\NameOfTests.cs (19)
685var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 711var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 746var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 793var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 830var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 866var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Nested").OfType<ExpressionSyntax>().First(); 912var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "A.Extension").OfType<ExpressionSyntax>().First(); 945var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 977var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1017return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1049var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1091return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1131var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1174return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1212var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1255return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1422var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "X1.Extension").OfType<ExpressionSyntax>().First(); 3043var firstGeneric = root.DescendantNodes().OfType<GenericNameSyntax>().First(); 3044var lastGeneric = root.DescendantNodes().OfType<GenericNameSyntax>().Last();
Semantics\NativeIntegerTests.cs (18)
1789var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 2346var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 2466var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 3634var nodes = tree.GetRoot().DescendantNodes().ToArray(); 4118var nodes = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().ToArray(); 6061var nodes = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>(); 6109var nodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(); 9495var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 9730var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 10107var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 10332var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 12381var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 15317var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15338var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15361var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15389var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15412var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15442var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref;
Semantics\NonTrailingNamedArgumentsTests.cs (15)
45var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 367var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 393var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 423var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 455var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 484var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 534var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 569var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 598var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 652var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 679var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 710var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 744var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 776var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 983var nodes = tree.GetCompilationUnitRoot().DescendantNodes();
Semantics\NullableContextTests.cs (17)
67var classDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 68var methodDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().SpanStart; 102var classDecl1 = syntaxTree1.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 103var classDecl2 = syntaxTree2.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 350var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single(); 389var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 424var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First().Value; 579var syntaxNodes = tree.GetRoot().DescendantNodes(); 731var methodDeclarations = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 1771var returnStatements = syntaxTree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray(); 1841var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single().Right; 1878var attributeArguments = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 1927var attributeArguments = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 1969var equalsValueClauses = syntaxTree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray(); 2009var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Select(f => f.Declaration.Variables[0]).ToArray(); 2048var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToArray(); 2228var typeOf = syntaxTree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Semantics\NullableConversionTests.cs (1)
804var target = syntaxTree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList()[2];
Semantics\NullableReferenceTypesTests.cs (143)
1754var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 1788var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 1841var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 1867var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray(); 1892var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray(); 1963var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 2276var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2315var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2347var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2381var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2479var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 3334foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 3693var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 3699var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName)); 4526var firstCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().First(); 4530var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 4562var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 4594var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 5169var declaration = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7769var specifier = tree.GetRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 10534var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 13511var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single(); 34983var outVar = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 35000var varDecl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Where(d => d.Declaration.Type.IsVar).Single(); 56076var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56082var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56106var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56112var invocationNode = tree.GetRoot().DescendantNodes().OfType<ImplicitArrayCreationExpressionSyntax>().Single(); 56139var defaultNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56145var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56176var defaultNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56182var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56212var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56246var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56277var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56304var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56310var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56344var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56378var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56409var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56437var newNode = tree.GetRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First(); 56442var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56472var newNode = tree.GetRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First(); 56477var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56508var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56513var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56588var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 56591var invocationNode2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 56619var lambdaNode = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Last(); 56624var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 59017var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59022var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclarationSyntax>().First(); 59051var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59079var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59111var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59140var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59173var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59205var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59238var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First(); 59272var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First(); 59298var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59327var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59356var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 62841var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>().ToImmutableArray(); 65890var function1 = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Last(); 65894var function2 = tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 65899var object2 = tree2.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>() 71252var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71288var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71329var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71366var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71403var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71438var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71471var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71508var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71780var discards = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Select(a => a.Left).ToArray(); 71874var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71921var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71960var discardPatterns = tree.GetRoot().DescendantNodes().OfType<DiscardPatternSyntax>().ToArray(); 73763var node = tree.GetRoot().DescendantNodes().OfType<EnumMemberDeclarationSyntax>().ElementAt(1); 81259var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 94281var localDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 97757var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 99086var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 111770var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 111824var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 113192var arrays = tree.GetRoot().DescendantNodes().OfType<ArrayTypeSyntax>().ToArray(); 113594var decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 113625var decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 113803var decl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 114028var decl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145375var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145382var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145416var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145423var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145456var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145463var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145494var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145501var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145532var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145539var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145572var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145605var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145636var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145643var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145675var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145682var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145952var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145983var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 146016var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 146298var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146337var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146377var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146416var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146454var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 146455var cast = ifStatement.DescendantNodes().OfType<CastExpressionSyntax>().Single(); 146464var assignment = newIfStatement.DescendantNodes() 154801var locals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 154869var locals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 155997var identifiers = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "global::Program").ToArray(); 156747var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 156750var invocationNode2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 157581var declarators = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray(); 157629var method1 = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()); 157631var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 158061var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158097var item = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 158192var item = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 158230var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158271var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158311var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158345var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158382var item = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 158477var item = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 158525var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158567var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158604var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158815var declarations = tree.GetRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 160690var stackallocNode = tree.GetRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().Single(); 161241var arms = syntaxTree.GetRoot().DescendantNodes().OfType<SwitchExpressionArmSyntax>().ToImmutableArray(); 161245var identifiers = unreachableArm.DescendantNodes().OfType<IdentifierNameSyntax>().ToImmutableArray(); 161287var sections = syntaxTree.GetRoot().DescendantNodes().OfType<SwitchSectionSyntax>().ToImmutableArray(); 161291var identifiers = unreachableSection.DescendantNodes().OfType<IdentifierNameSyntax>().ToImmutableArray();
Semantics\NullCoalesceAssignmentTests.cs (5)
38var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 76var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 119var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 158var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 184var defaultLiteral = syntaxRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().Where(expr => expr.IsKind(SyntaxKind.DefaultLiteralExpression)).Single();
Semantics\ObjectAndCollectionInitializerTests.cs (19)
3471var nodes = (from node in tree.GetRoot().DescendantNodes() 3519var nodes = (from node in tree.GetRoot().DescendantNodes() 3576var nodes = (from node in tree.GetRoot().DescendantNodes() 3612var nodes = (from node in tree.GetRoot().DescendantNodes() 3649var nodes = (from node in tree.GetRoot().DescendantNodes() 3691var objectCreation = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 3741var objectCreation = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 3785var objectCreation = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3814var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3837var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3861var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3935var nodes = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().Skip(1).Single().Expressions; 4017var nodes = tree.GetRoot().DescendantNodes().OfType<GenericNameSyntax>().ToArray(); 4058var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4096var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4136var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4168var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4227var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 4281var propertyAccess = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left;
Semantics\OperatorTests.cs (20)
47var orNodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 2985var negOne = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 2991var boolPlusPlus = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(0); 2997var errorPlusPlus = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(1); 6939var syntax = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 7056var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 7211var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 7330var methodBody = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body; 7488var nodes = (from node in tree.GetRoot().DescendantNodes() 7704var nodes = (from node in tree.GetRoot().DescendantNodes() 7873var nodes = (from node in tree.GetRoot().DescendantNodes() 8033var nodes = (from node in tree.GetRoot().DescendantNodes() 8554var nodes = (from node in tree.GetRoot().DescendantNodes() 8589var nodes = tree.GetRoot().DescendantNodes().Where(node => node is BinaryExpressionSyntax || node is AssignmentExpressionSyntax).ToArray(); 8633var nodes = (from node in tree.GetRoot().DescendantNodes() 8683var nodes = (from node in tree.GetRoot().DescendantNodes() 8757var nodes = (from node in tree.GetRoot().DescendantNodes() 8812var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 11337var negNode = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 11418var fieldInitializerOperations = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>()
Semantics\OverloadResolutionPerfTests.cs (2)
982var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<Syntax.InvocationExpressionSyntax>().Last(); 1060var exprs = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToImmutableArray();
Semantics\OverloadResolutionTests.cs (9)
7149var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7259var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7433var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7474var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9071var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9419var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 11763var expr = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 11812var expr = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11862var expr = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
Semantics\QueryTests.cs (13)
2357var unknownAccessorDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>(); 2384var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2385var fromClause1 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num1"))).Single() as FromClauseSyntax; 2386var fromClause2 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num2"))).Single() as FromClauseSyntax; 2429foreach (var ordering in tree.GetCompilationUnitRoot().DescendantNodes().OfType<OrderingSyntax>()) 2484var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2548var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2583var orderingClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AscendingOrdering)).Single() as OrderingSyntax; 2716var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Where(x => x.ToFullString() == "from i in expr1 let ").Single(); 2742var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Single(); 3377tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem2")) 3386tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem1")) 3607foreach (var ordering in queryStatement.DescendantNodes().OfType<OrderingSyntax>())
Semantics\RawInterpolationTests_Handler.cs (3)
2900var descendentNodes = tree.GetRoot().DescendantNodes(); 2903.Where(b => b.DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().Any()) 3126SyntaxNode syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\RecordStructTests.cs (24)
534var creation = tree.GetRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single(); 554var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 574var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 596var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2307var x = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2331var x = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2594var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2605var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Single(); 2629var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2663var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2698var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 3243var x = doc.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 3285var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 3333var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 3384var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 5849var parameterSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 5855var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 5891var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 6925var with = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 7606var with = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8811var withExpr = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 10772tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First(); 10782tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First(); 10787var baseWithoutParens = tree.GetRoot().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single();
Semantics\RefEscapingTests.cs (9)
69var decl = root.DescendantNodes() 5784var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 5790var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 5796var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 5802var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13); 5884var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 5890var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 5896var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 5902var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
Semantics\RefFieldTests.cs (65)
11025var decls = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 11099var delegateTypesAndLambdas = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray(); 11128var value = decl.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 11221var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 11389var lambdas = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 11981var expr = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 12061var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12130var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12198var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12380var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>(). 12419var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12567var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>(). 12599var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12793var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 12830var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12976var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13006var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 13151var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13206var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13265var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13308var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13337var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13362var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13382var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13404var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13439var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13503var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13579var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13650var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13714var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14355var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14397var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14522var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14598var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 14843var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 14874var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 15051var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 15077var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 15132var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 16550var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 16591var anonymousMethod = tree.GetRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 16630var anonymousMethod = tree.GetRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 16726var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); 16775var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Last(); 17946var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "f").ToArray(); 23384var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 23452var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 24454var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 24490var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 24527var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 25294var delegateTypesAndLambdas = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray(); 25314var value = decl.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 27351foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27403foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27455foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27610var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27700var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27820var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27921var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27966var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28026var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28256var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28304var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 29394var fieldInitializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 29437var constructorSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
Semantics\RefLocalsAndReturnsTests.cs (10)
4750var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4778var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4806var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4834var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4862var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4890var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4924var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 5210var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5254var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5293var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
Semantics\ScriptSemanticsTests.cs (5)
244var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First(); 561var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First(); 1313var x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1342x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1357x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
Semantics\SemanticErrorTests.cs (3)
7488var node = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 13327var node = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 24224var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().First();
Semantics\StackAllocInitializerTests.cs (8)
367var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 443var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 1045var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 1147var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 2359var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray(); 2465var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 2565var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray(); 2649var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
Semantics\StackAllocSpanExpressionsTests.cs (2)
53var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 127var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>();
Semantics\StructConstructorTests.cs (3)
1050var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1145var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1242var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
Semantics\SuppressAccessibilityChecksTests.cs (8)
54var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 72var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 87var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 96statement.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single()); 123var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().Body; 169var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 215AccessorDeclarationSyntax accessorDecl = root.DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 229.DescendantNodes()
Semantics\SwitchTests.cs (1)
1154var node = syntaxTree.GetRoot().DescendantNodes().First(x => x.IsKind(SyntaxKind.SimpleMemberAccessExpression));
Semantics\SyntaxTreeRootTests.cs (1)
108Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SyntaxTree);
Semantics\TargetTypedConditionalOperatorTests.cs (2)
668var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 689var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
Semantics\TargetTypedDefaultTests.cs (35)
42var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 142var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 194var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 242var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 279var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 324var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 518var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 564var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 607var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 665var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 746var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 835var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 864var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1140var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1255var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1629var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1734var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1800var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1871var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1909var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2089var def = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(0); 2331var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2412var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2455var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2481var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3055var def = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3342var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3381var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3512var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3575var default1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3583var default2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(0); 3590var default3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(1); 3597var default4 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(2); 3671var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3711var nodes = tree.GetCompilationUnitRoot().DescendantNodes();
Semantics\TopLevelStatementsTests.cs (87)
194var localRef = unit1.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 235var localDecl = unit1.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 257foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()) 319var localRef = unit1.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 358var localDecl = unit2.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 408foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()) 481var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 492var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 500var localRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single(); 533var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 540var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray(); 573var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 584var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 591var localRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single(); 698var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 699var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "s").Single(); 871var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()); 873Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol); 877var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()); 879Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol); 985var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First()); 987Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").First()).Symbol); 989var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).Single()); 991Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Skip(1).Single()).Symbol); 1040var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First()); 1042Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol); 1407var nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1425nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1520var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "c").Single(); 1592foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 1598foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 1685var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 1706var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 1858var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 1882var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2084var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2100var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2248var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2266var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2426var labelDecl = tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 2446var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2919var nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2924nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2").Single(); 2941nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2946nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1").Single(); 3941var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray(); 4090var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray(); 4215var declarator = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4216var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 4510var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()); 4512Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol); 4516var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4518Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol); 4574var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4576Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").First()).Symbol); 4578var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First()); 4580Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Skip(1).Single()).Symbol); 4623var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4625Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol); 4893var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 4894var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single(); 4950var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single()); 4952Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol); 4956var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single()); 4959Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol); 4978var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 4979var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single(); 6030var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 6034var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray(); 6046localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 6086var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6160.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 6232var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6276var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6277var localRef = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 6316var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6317var localRef = syntaxTree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 6366var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6368var localRef = syntaxTree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 8578var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 8651var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 8673var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single(); 8695var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single(); 9677var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 9681Assert.Equal(OperationKind.Literal, model.GetOperation(tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind); 9707model.TryGetSpeculativeSemanticModel(root.DescendantNodes().Single(n => n is ExpressionStatementSyntax { Parent: GlobalStatementSyntax }).Span.End, nodeToSpeculate, out var speculativeModelInTopLevel); 9712model.TryGetSpeculativeSemanticModel(root.DescendantNodes().Single(n => n is ExpressionStatementSyntax { Parent: BlockSyntax }).Span.End, nodeToSpeculate, out var speculativeModelOutsideTopLevel);
Semantics\TryCatchTests.cs (1)
45var catchClause = tree.GetCompilationUnitRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single();
Semantics\TypeOfTests.cs (1)
33var node = (ObjectCreationExpressionSyntax)tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "new C(0)").Last();
Semantics\UnsafeTests.cs (29)
5197var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 5383Assert.True(tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>(). 6329var decl = root.DescendantNodes() 6388var decl = root.DescendantNodes() 7257var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7294var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 7323var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7361var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7404var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7535var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Last(); 7845var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 7912var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 8158var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8225var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8283var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8381foreach (var declarationSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().IsKind(SyntaxKind.VoidKeyword))) 8861foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 8911foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 9323foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 10177var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(3).Reverse().ToArray(); 10223var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 10224var dereferences = tree.GetCompilationUnitRoot().DescendantNodes().Where(syntax => syntax.IsKind(SyntaxKind.PointerIndirectionExpression)).ToArray(); 10297var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 10626var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 10688var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 10748var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 11305var stackAllocSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().Single(); 11837var parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 11877var foreachSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\UsingStatementTests.cs (8)
60var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 69var memberAccessExpression = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1341var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1376var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1853var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1865var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1881var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1894var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
Semantics\Utf8StringsLiteralsTests.cs (14)
2970var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2998var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3026var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3054var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3082var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3110var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3138var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3166var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3194var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3222var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3250var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3278var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3306var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 4081foreach (var node in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(b => b.IsKind(SyntaxKind.AddExpression)))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (626)
Compilation\GetSemanticInfoBrokenCodeTests.cs (6)
200Assert.Empty(tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>()); 202foreach (var identifierSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 224var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 245var typeOfSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 267var literalSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 300var identifierSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(n => n.Identifier.ValueText == "CompletionItem");
Compilation\GetSemanticInfoTests.cs (33)
1674var varIdentifier = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(n => n.ToString() == "var"); 2356var lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 2566var expr = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 3607var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3632var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3665var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3701var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4106var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 4161var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 4292var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedTypeArgumentSyntax>().Single(); 4355var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.ValueText == "b"); 4400var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); 4436var fieldSyntax = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 4490var memberAccessSyntax = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4535var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 4589var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 4641var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4687int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; 4732int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; 4752var trueLiteral = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4785var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 4828var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 4875var statement = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 5478var invocationSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5484var parameterSyntax = invocationSyntax.DescendantNodes().OfType<ParameterSyntax>().First(); 5521var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5535var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5582var nullSyntax = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 5620var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5667var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5720var methodGroupSyntax = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; 5988var foreachSyntaxNode = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 6045var typeParameters = tree.GetRoot().DescendantNodes().OfType<TypeParameterSyntax>().ToArray();
Compilation\GetUnusedImportDirectivesTests.cs (1)
93var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
Compilation\SemanticModelAPITests.cs (105)
43var m = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(decl => decl.Identifier.ValueText == "M"); 46var accesses = m.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 51accesses = m2.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 110var invoke = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>() 138var accesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 175var assignment = root.DescendantNodes().OfType<ParenthesizedExpressionSyntax>().Single(); 202var rx = root.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 209var rxDecl = root.DescendantNodes().OfType<ForStatementSyntax>().Single().Declaration; 234var rx = root.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 241var rxDecl = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 256var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 276var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 295var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryClauseSyntax>().First(); 315var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryClauseSyntax>().First(); 334var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<GotoStatementSyntax>().First(); 353var paramdecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 375var paramdecl1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 377var paramdecl2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 404var nsArray = tree.GetCompilationUnitRoot().DescendantNodes().Where(node => node.IsKind(SyntaxKind.NamespaceDeclaration)).ToArray(); 425var nsArray = tree.GetCompilationUnitRoot().DescendantNodes().Where(node => node.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)).ToArray(); 871var pType01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 872var pType02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Last(); 880var pMethod01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 881var pMethod02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last(); 898var pParam01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 899var pParam02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); 925var exprs = root.DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 966var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 967var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 1007var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().First(); 1008var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().First(); 1041var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1072var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1113var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1157var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1193var descendants = tree.GetCompilationUnitRoot().DescendantNodes(); 1232var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1265var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 1278var aliasQualifiedSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 1306var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 1311var aliasQualifiedSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 1338var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<NameEqualsSyntax>().Single().Name; 1341var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1361var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 1390var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1728var aliasDecl = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1739var fieldDecl = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 1962var lambdaExpression = speculatedStatement.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().FirstOrDefault(); 2026var oldSyntax = root.DescendantNodes() 2046var thisSyntax = expr.DescendantNodes().OfType<ThisExpressionSyntax>().Single(); 2072var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2092newSyntax = oldSyntax.ReplaceNode(oldSyntax.DescendantNodes().OfType<CastExpressionSyntax>().Single(), newArgument); 2109newSyntax = oldSyntax.ReplaceNode(oldSyntax.DescendantNodes().OfType<CastExpressionSyntax>().Single(), newArgument); 2141var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 2310var accessorSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 2313var statementSyntax = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2683var lambdaExpression = blockStatement.Statements[0].DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().FirstOrDefault(); 2921var cref = typeDecl.DescendantNodes(descendIntoTrivia: true).OfType<TypeCrefSyntax>().Single(); 2961var cref = typeDecl.DescendantNodes(descendIntoTrivia: true).OfType<TypeCrefSyntax>().Single(); 3006var cref = typeDecl.DescendantNodes(descendIntoTrivia: true).OfType<TypeCrefSyntax>().Single(); 3127var syntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(). 3230var omittedArraySize = typeSyntax.DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Single(); 3259var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3271var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3300var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3312var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3341var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3375var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3388var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3417var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3429var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3458var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3470var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3499var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3611var crefSyntax = root.DescendantNodes(descendIntoTrivia: true).OfType<QualifiedCrefSyntax>().Single(); 3741var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3785var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3786var typeInfo = model.GetTypeInfo(localFunctionBody.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!); 3819var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3846var syntax = tree.GetRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 3873var methodDecl = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 3910var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3911var init0 = method.Body.Statements[0].DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 3920var init1 = method.Body.Statements[2].DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 3927var init2 = method.Body.Statements[4].DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 4107var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4144var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4187var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4211var actual = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 4239var actual = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 4277var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4427var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 4460Assert.Equal("DEBUG", model.GetConstantValue(root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single())); 4477var declarationExpression = root.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4541var declarationExpression = root.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").Single(); 4625var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").ToArray(); 4644var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M"); 4661var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4676var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4692var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "NotNullWhen"); 4708var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4727var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4743var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4758var identifier = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<IdentifierNameSyntax>().First();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (48)
38var rxDecl = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 60var rxDecl = root.DescendantNodes().OfType<ForStatementSyntax>().Single().Declaration; 3177var accessorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3847var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedExpressionSyntax>().First(); 3901var param = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "name").First(); 3922var usingDirectives = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3999var typeofSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 4127var call = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4145call = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4415var lambda = (SimpleLambdaExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(x => x is SimpleLambdaExpressionSyntax); 4440var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4446var lookupSymbols = model.LookupSymbols(conversionDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.ImplicitConversionName); 4471var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4477var lookupSymbols = model.LookupSymbols(conversionDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.ExplicitConversionName); 4502var operatorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OperatorDeclarationSyntax>().Single(); 4508var lookupSymbols = model.LookupSymbols(operatorDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.AdditionOperatorName); 4604var node = (DefaultExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Where(i => i is DefaultExpressionSyntax).First(); 4691var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4706var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4721var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4741var enumDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EnumDeclarationSyntax>().Single(); 4742var eventDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EventDeclarationSyntax>().Single(); 4767var structDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StructDeclarationSyntax>().First(); 4768var interfaceDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InterfaceDeclarationSyntax>().Last(); 4797var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4820var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4843var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4866var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4889var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4912var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4935var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4958var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4993var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5039var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5088var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5111var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5206var node = tree.GetRoot().DescendantNodes().Single(node => node is IdentifierNameSyntax { Identifier: { ValueText: "b" } }); 5222var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5243var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5264var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5304var initializers = root.DescendantNodes() 5355var thingInitializer = root.DescendantNodes() 5399var initializers = root.DescendantNodes() 5447var initializers = root.DescendantNodes() 5490var initializers = root.DescendantNodes() 5541var thingInitializer = root.DescendantNodes() 5585var initializers = root.DescendantNodes() 5633var initializers = root.DescendantNodes()
Compilation\SemanticModelGetSemanticInfoTests.cs (8)
14484var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Last(); 14656var argumentSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 14789var nodes = (from node in tree.GetRoot().DescendantNodes() 14885var nodes = (from node in tree.GetRoot().DescendantNodes() 14996var nodes = (from node in tree.GetRoot().DescendantNodes() 15375foreach (var qc in tree.GetRoot().DescendantNodes().OfType<QueryClauseSyntax>()) 15380var qe = tree.GetRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Single(); 15434var syntax = tree.GetCompilationUnitRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.ThisExpression);
DocumentationComments\CrefTests.cs (9)
5697foreach (var id in cref.DescendantNodes().OfType<NameSyntax>()) 5753var parameterTypeContainingType = parameterType.DescendantNodes().OfType<SimpleNameSyntax>().First(); 5797var typeSyntax = cref.DescendantNodes().OfType<SimpleNameSyntax>().First(); 6046var typeParameterSyntax = crefSyntax.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 6070var methodNameSyntax = crefSyntax.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 6190var parameterTypeSyntax = crefSyntax.DescendantNodes().OfType<CrefParameterSyntax>().Single().Type; 6245DescendantNodes().OfType<CrefParameterSyntax>().Single(). 6246DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 6619return docComments.SelectMany(docComment => docComment.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Select(attr => attr.Cref));
DocumentationComments\DocumentationCommentIDTests.cs (4)
31var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 144var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<GotoStatementSyntax>().Single().Expression; 165var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 309var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<FromClauseSyntax>().Single();
DocumentationComments\ParameterTests.cs (1)
842return docComments.SelectMany(docComment => docComment.DescendantNodes().OfType<XmlNameAttributeSyntax>().Select(attr => attr.Identifier));
SymbolDisplay\SymbolDisplayTests.cs (29)
5622var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6062var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 6072methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 6609var local = root.DescendantNodes() 6652var local = root.DescendantNodes() 6686var local = root.DescendantNodes() 6748var queryExpression = root.DescendantNodes().OfType<QueryExpressionSyntax>().First(); 6781var local = root.DescendantNodes() 6842var declarator = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6875var declarator = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6920var declarator = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7039var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7077var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7115var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7175var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7247var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7507var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7660var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7688var structure = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.RawKind == (int)VisualBasic.SyntaxKind.StructureStatement); 7909var variable = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Variable; 8004var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 8064var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 8096var continuation = tree.GetRoot().DescendantNodes().OfType<QueryContinuationSyntax>().Single(); 8399var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement); 8450var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement); 8484var name = tree.GetRoot().DescendantNodes().OfType<VisualBasic.Syntax.VariableDeclaratorSyntax>().Single(); 8875var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 8931var binaryExpression = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 9024var preprocessingNameSyntax = tree.GetRoot().DescendantNodes(descendIntoTrivia: true)
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (1)
1005var nodes = syntaxTree.GetRoot().DescendantNodes();
Symbols\AnonymousTypesSymbolTests.cs (1)
1640var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single();
Symbols\CheckedUserDefinedOperatorsTests.cs (10)
7210var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7211var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7282var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7283var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7353var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7354var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7426var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7427var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7490var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7491var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
Symbols\ConversionTests.cs (4)
2069var castSyntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 2076var forEachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2139var syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 2173var syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Symbols\CorLibrary\CorTypes.cs (2)
294var node = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 359var node = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Symbols\CovariantReturnTests.cs (2)
379foreach (var declaration in tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>()) 2622foreach (var localDeclaration in vbTree.GetRoot().DescendantNodes().OfType<VisualBasic.Syntax.LocalDeclarationStatementSyntax>())
Symbols\DestructorTests.cs (2)
407var destructorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single(); 413var finalizeSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Name;
Symbols\EnumTests.cs (1)
353var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.BitwiseNotExpression);
Symbols\ExtensionMethodTests.cs (9)
227syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single()).Symbol; 2952var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3010var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3139var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 3778var member = (MemberAccessExpressionSyntax)syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3866var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 3913var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 3958var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 4008var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
Symbols\FunctionPointerTypeSymbolTests.cs (25)
52.DescendantNodes() 124var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 204var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 285syntaxTree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(), 339var functionPointers = syntaxTree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray(); 405var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 485var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 602var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 685.DescendantNodes() 1149.DescendantNodes() 1260.DescendantNodes() 1317.DescendantNodes() 1428.DescendantNodes() 1685var mDeclSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Skip(2).Single(); 1697var varDecl = mDeclSyntax.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1711var assignment = mDeclSyntax.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1730InvocationExpressionSyntax invocationExpressionSyntax = mDeclSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1746var returnExpression = mDeclSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!; 1796var methodDecls = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 1799.SelectMany(m => m.DescendantNodes().OfType<FunctionPointerTypeSyntax>()) 1820var decls = m2DeclSyntax.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1841var invocations = m2DeclSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1867var variableDeclaratorSyntax = m3DeclSyntax.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 1877var invocationExpr = m3DeclSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1926var decls = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
Symbols\GenericConstraintTests.cs (2)
7393var nest = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Nest").Single(); 7418var nest = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Nest").Single();
Symbols\ImplicitClassTests.cs (3)
73IEnumerable<IdentifierNameSyntax> identifiers = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>(); 116var namespaceDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 117var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Symbols\IndexerTests.cs (1)
2844ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().FirstOrDefault();
Symbols\LocalFunctionTests.cs (4)
35var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 56var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 77var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 100var localsSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
Symbols\Metadata\MetadataTypeTests.cs (2)
372var id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First(); 387id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First();
Symbols\RelaxedShiftOperatorTests.cs (6)
102var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 146var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 190var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 234var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 278var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 322var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Symbols\RequiredMembersTests.cs (1)
7646var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Symbols\Source\BaseClassTests.cs (1)
2031var baseY = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "y").OfType<ExpressionSyntax>().First();
Symbols\Source\DelegateTests.cs (4)
738var anonymousMethod = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 765var anonymousMethod = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 827ExpressionSyntax lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 834lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Symbols\Source\EnumTests.cs (1)
979var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EnumDeclarationSyntax>().ToArray();
Symbols\Source\EventTests.cs (4)
435var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 441var parameterSyntax = lambdaSyntax.DescendantNodes().OfType<ParameterSyntax>().First(); 481var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 487var parameterSyntax = lambdaSyntax.DescendantNodes().OfType<ParameterSyntax>().First();
Symbols\Source\ExternAliasTests.cs (4)
408var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 434var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 479var externAliasSyntax = root.DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 480var usingSyntax = root.DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
Symbols\Source\FileModifierTests.cs (20)
1233var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1367var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1433var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1491var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1805var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last(); 1880var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last(); 2600var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 2639var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 3510var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 3559var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 3612var invoked = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3641var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3711var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3773var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3814var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3977var methodNameSyntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 4124var voidTypeSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single().Type!; 4410var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 4454var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 4477var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single();
Symbols\Source\LocalTests.cs (1)
59var expressionSyntax = tree.GetRoot().DescendantNodes().
Symbols\Source\MethodTests.cs (7)
236var node = tree.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).First(); 264var node = tree.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Last(); 289var node = tree.DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Single(); 310var node = tree.DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Single(); 2540var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 2571var type = syntax.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 2572var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
Symbols\Source\NullablePublicAPITests.cs (180)
55var arrayAccesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 89var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 570return syntaxTree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.LocalFunctionStatementSyntax>().Select(func => semanticModel.GetDeclaredSymbol(func)).Cast<IMethodSymbol>().ToArray(); 945var invocations = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(); 1002var variables = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 1096var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 1123_ = model.GetTypeInfoAndVerifyIOperation(root.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value); 1219var dCast = (CastExpressionSyntax)root.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 1263var conditional = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 1361var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 1362var conditionalAccessExpression = root.DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single(); 1363var ternary = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 1441var returnStatement = root.DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 1443var yReference = ((MemberAccessExpressionSyntax)newSource.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression).Expression; 1513var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 1514var conditionalAccessExpression = root.DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single(); 1515var ternary = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().ElementAt(1); 1569var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 1570var conditionalAccessExpression = root.DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single(); 1571var ternary = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 1626var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 1627var varDecl = lambda.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1669var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 1670var varDecl = lambda.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1712var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 1713var varDecl = lambda.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1851var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1894var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1939var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 1986var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2047var declarations = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().ToList(); 2056var symbols = variable.DescendantNodes().OfType<SingleVariableDesignationSyntax>().Select(s => model.GetDeclaredSymbol(s)).Cast<ILocalSymbol>().ToList(); 2090var declarations = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().ToList(); 2099var symbols = variable.DescendantNodes().OfType<SingleVariableDesignationSyntax>().Select(s => model.GetDeclaredSymbol(s)).Cast<ILocalSymbol>().ToList(); 2133var s2Assignment = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 2134var lastDeclaration = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 2136var newDeclarator = newDeclaration.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2176var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2218var declaration = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2248var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2283var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2327var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2368var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2413var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2453var declarations = root.DescendantNodes().OfType<ForEachStatementSyntax>().ToList(); 2501var declarations = root.DescendantNodes().OfType<ForEachStatementSyntax>().ToList(); 2546var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2595var declarations = root.DescendantNodes().OfType<ForEachStatementSyntax>().ToList(); 2629var sRef = root.DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "s").Single(); 2663var select = root.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Select").Single(); 2701var select = root.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Select").Single(); 2737var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2783var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2826var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2875var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2916var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2927var lhs = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single().Left; 2957var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 2999var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 3041var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 3101var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 3148var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 3193var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 3258var indexers = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray().AsSpan(); 3310var elementAccesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray().AsSpan(); 3359var elementAccesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray(); 3405var operators = root.DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().ToList(); 3450var operators = root.DescendantNodes().OfType<BinaryExpressionSyntax>().ToList(); 3488var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3495var o1Ref = lambda.DescendantNodes() 3498.DescendantNodes() 3507var mDeclaration = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(m => m.Identifier.ValueText == "M"); 3537var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3540var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3549var o1Ref = innerLambda.DescendantNodes() 3552.DescendantNodes() 3560var o2Ref = innerLambda.DescendantNodes() 3563.DescendantNodes() 3598var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3601var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3610var o1Ref = innerLambda.DescendantNodes() 3613.DescendantNodes() 3621var o2Ref = innerLambda.DescendantNodes() 3624.DescendantNodes() 3661var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3664var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3667var o2Reference = localFunction.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o2"); 3697var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3698var typeInfo = model.GetTypeInfo(localFunctionBody.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!); 3732var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3733var typeInfo = model.GetTypeInfo(localFunctionBody.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!); 3769var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3770var o1Ref = lambda.DescendantNodes() 3773.DescendantNodes() 3808var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3810var parameter = lambda.DescendantNodes().OfType<ParameterSyntax>().Single(); 3854var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3856var o2Declaration = lambda.DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 3862var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3863var innerO2Reference = innerLambda.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o2"); 3868var @foreach = lambda.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3871foreach (var singleVarDesignation in lambda.DescendantNodes().OfType<SingleVariableDesignationSyntax>()) 3876var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3879var o8Declaration = localFunction.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3913var fieldLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3915var o1Reference = fieldLambda.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o1"); 3917var o2Decl = fieldLambda.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3927var propertyLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3929var o3Reference = propertyLambda.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o3"); 3931var o4Decl = propertyLambda.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3978var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3981var innerLambda1 = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3991var innerLambda2 = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 4047var lambda = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 4050var o2Decl = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4053var o1Ref = root.DescendantNodes().OfType<AttributeArgumentSyntax>().Last().Expression; 4056var o2Ref = root.DescendantNodes().OfType<ParameterSyntax>().Last().Default.Value; 4062var localFunction = root.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4065var speculativeO2Ref = speculativeAttribute.DescendantNodes().OfType<AttributeArgumentSyntax>().Single().Expression; 4114var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 4116var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 4117var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4120var position = localFunction.DescendantNodes().OfType<VariableDeclarationSyntax>().Single().Span.End; 4177var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 4179var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 4181var nestedLocalFunction = (IMethodSymbol)model.GetDeclaredSymbol(lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().ElementAt(1)); 4211var attributeUsage = root.DescendantNodes().OfType<AttributeSyntax>().ElementAt(1); 4242var typeOf = syntaxTree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 4272var default0 = root.DescendantNodes().OfType<EqualsValueClauseSyntax>().ElementAt(0).Value; 4275var default1 = root.DescendantNodes().OfType<EqualsValueClauseSyntax>().ElementAt(1).Value; 4306var default0 = root.DescendantNodes().OfType<AttributeArgumentSyntax>().ElementAt(0).Expression; 4309var default1 = root.DescendantNodes().OfType<AttributeArgumentSyntax>().ElementAt(1).Expression; 4335var exprs = tree.GetRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ToArray(); 4365var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4370var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4393var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4398var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4421var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4428var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4451var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4458var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4481var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4488var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4511var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4520var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4543var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4553var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4576var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4581var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4604var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4611var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4637var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 4642var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4668var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 4675var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4699var initializer = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4730var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Where(p => p.IsKind(SyntaxKind.SuppressNullableWarningExpression)).ToList(); 4780var invocations = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(); 4816var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 4903.DescendantNodes() 4914var newAccess = newBody.DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4933var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4966var ternary = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 5010var tupleLiteral = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5049var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 5052var assignmentsInLambda = constructor.DescendantNodes().OfType<AssignmentExpressionSyntax>().ToArray(); 5065var switchExpressionInput = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single().GoverningExpression; 5102var binaryRight = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right; 5134var binaryRight = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right; 5162var binaryRightArgument = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right.DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; 5197var xUsage = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Expression; 5232var xUsage = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Expression; 5255var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5278var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5310var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5333var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5355var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5400var collectionExprs = root.DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 5457var collectionExprs = root.DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray();
Symbols\Source\UpdatedContainingSymbolAndNullableAnntotationTests.cs (2)
36var varDeclarators = root.DescendantNodes().OfType<VariableDeclaratorSyntax>(); 41Symbol m2 = model.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(1)).GetSymbol();
Symbols\Source\UsingAliasTests.cs (2)
697var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single(); 740var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single();
Symbols\StaticAbstractMembersInInterfacesTests.cs (28)
8453var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 9041var node = postfixOp != "" ? (ExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First() : tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().First(); 9356var node = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().First(); 9755var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 10752var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 10945var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 11135var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " y").Single(); 11329var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11583var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11960var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(n => n.ToString() == "x " + op + "= 1").Single(); 12139var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 13180var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Right; 13266var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 13388var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 14089var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 14098node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments[0].Expression; 14714var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 15120var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 15388var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 19560var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19643var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19735var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19824var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 28773var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 30280var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().First(); 30471var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 30937var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().First();
Symbols\SymbolEqualityTests.cs (33)
41var invocations = root.DescendantNodes().OfType<BinaryExpressionSyntax>().ToList(); 84var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 124var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 165var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 411var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 412var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 449var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 450var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 480var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 481var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 523var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 524var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 554var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 555var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 590var create1Syntax = (InvocationExpressionSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.InvocationExpression); 591var create2Syntax = (InvocationExpressionSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.InvocationExpression); 625var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 626var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 674var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.ClassDeclaration).DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 675var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.ClassDeclaration).DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 726var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 727var member2Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 776var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 777var member2Syntax = (IdentifierNameSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.IdentifierName); 827var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 828var member2Syntax = (IdentifierNameSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.SimpleMemberAccessExpression).DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.IdentifierName); 888var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 889var member2Syntax = (IdentifierNameSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.IdentifierName); 935var lambdaSyntax = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 961var syntaxNode = syntaxTree.GetRoot().DescendantNodes().
Symbols\SymbolExtensionTests.cs (5)
101var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 119var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 137var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 156var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.Text == "var"); 252var method = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Method").Single()).Symbol.GetSymbol<MethodSymbol>();
Symbols\TypeTests.cs (1)
1854var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Symbols\UnsignedRightShiftTests.cs (13)
123var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 124var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First(); 626var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 627var shift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First(); 1176var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 1177var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First(); 1584var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 1585var shift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First(); 1983var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2235var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2377var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 2511var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2608var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (85)
Diagnostics\DiagnosticTest.cs (1)
1984var nodes = ParseWithRoundTripCheck(text).GetRoot().DescendantNodes(descendIntoTrivia: true);
LexicalAndXml\PreprocessorTests.cs (1)
4566var nodes = root.DescendantNodes(descendIntoTrivia: true);
Parsing\CrefParsingTests.cs (1)
31var attr = structure.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Single();
Parsing\LocalFunctionParsingTests.cs (2)
1228var m = Assert.IsType<MethodDeclarationSyntax>(file.DescendantNodes() 1289Assert.True(file.DescendantNodes().Any(n => n.Kind() == SyntaxKind.LocalFunctionStatement && !n.ContainsDiagnostics));
Parsing\NameAttributeValueParsingTests.cs (1)
32var attr = structure.DescendantNodes().OfType<XmlNameAttributeSyntax>().Single();
Parsing\ParserErrorMessageTests.cs (7)
3767var methodDeclaration = (MethodDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is MethodDeclarationSyntax); 3770var delegateDeclaration = (DelegateDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is DelegateDeclarationSyntax); 3773var localFunctionStatement = (LocalFunctionStatementSyntax)tree.GetRoot().DescendantNodes().Single(node => node is LocalFunctionStatementSyntax); 3776var lambdaExpression = (ParenthesizedLambdaExpressionSyntax)tree.GetRoot().DescendantNodes().Single(node => node is ParenthesizedLambdaExpressionSyntax); 3779var anonymousMethodExpression = (AnonymousMethodExpressionSyntax)tree.GetRoot().DescendantNodes().Single(node => node is AnonymousMethodExpressionSyntax); 3782var indexerDeclaration = (IndexerDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is IndexerDeclarationSyntax); 3785var operatorDeclaration = (OperatorDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is OperatorDeclarationSyntax);
Parsing\ParsingErrorRecoveryTests.cs (10)
7937var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 7941var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 7958var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 7962var ns = root.DescendantNodes().OfType<FileScopedNamespaceDeclarationSyntax>().Single(); 7979var structDecl = root.DescendantNodes().OfType<StructDeclarationSyntax>().Single(); 7982var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 8002var structDecl = root.DescendantNodes().OfType<StructDeclarationSyntax>().Single(); 8006var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 8026var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 8030var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single();
Parsing\StatementParsingTests.cs (1)
3467var filterClause = root.DescendantNodes().OfType<CatchFilterClauseSyntax>().Single();
Parsing\VerbatimCrefParsingTests.cs (1)
31var attr = structure.DescendantNodes().OfType<XmlTextAttributeSyntax>().Single();
Syntax\FieldAndValueKeywordTests.cs (1)
1277var expr = syntaxTree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
Syntax\LambdaUtilitiesTests.cs (1)
57var methodDef = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(d => d.Identifier.ValueText == "M").Single();
Syntax\SyntaxListTests.cs (3)
332var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 356var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 402return tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
Syntax\SyntaxNodeTests.cs (34)
85var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 103var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 122var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 135var nodes = statement.DescendantNodes().ToList(); 139nodes = statement.DescendantNodes(descendIntoTrivia: true).ToList(); 145nodes = statement.DescendantNodes(n => n is StatementSyntax).ToList(); 149nodes = statement.DescendantNodes(n => n is StatementSyntax, descendIntoTrivia: true).ToList(); 516var identifierNodes = expr.DescendantNodes().OfType<IdentifierNameSyntax>().ToList(); 735var identifier = root.DescendantNodes(descendIntoTrivia: true).Single(n => n is IdentifierNameSyntax); 911tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 912tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 922tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 923tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 2115expr.DescendantNodes().OfType<ExpressionSyntax>(), 2725var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2759var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2794var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2832var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2872var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2904var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2921var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().LastOrDefault(); 2937var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().LastOrDefault(); 2996var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3037var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3081var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3123var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3165var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3205var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3248var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3289var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3313var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().FirstOrDefault(); 3590var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3880var a = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 3881var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e");
Syntax\SyntaxRewriterTests.cs (7)
349var typeName = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.GenericName)).Single(); 363var before = root.DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 382var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 401var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 516var newRoot = root.RemoveNode(root.DescendantNodes().First(), SyntaxRemoveOptions.KeepDirectives); 601var ifStmt1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<IfStatementSyntax>().Single(); 651var xmlNode = oldRoot.DescendantNodes(descendIntoTrivia: true).OfType<XmlEmptyElementSyntax>().Single();
Syntax\TrackNodeTests.cs (14)
24var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 35var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 47var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 56var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 66var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 81var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 97var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 109var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 122var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 126var replacedExpr = trackedExpr.ReplaceNodes(trackedExpr.DescendantNodes().OfType<IdentifierNameSyntax>(), (original, changed) => currentA); 134var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 138var replacedExpr = trackedExpr.ReplaceNodes(trackedExpr.DescendantNodes().OfType<IdentifierNameSyntax>(), (original, changed) => currentA); 149var ids = expr.DescendantNodes().OfType<IdentifierNameSyntax>().ToList(); 167var ids = expr.DescendantNodes().OfType<IdentifierNameSyntax>().ToList();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
774return tree.GetRoot().DescendantNodes().OfType<T>().Where(e => e.ToString() == text);
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
CodeGen\WinMdEventTests.cs (1)
671var syntax = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
CodeGen\WinRTCollectionTests.cs (1)
7424var add = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Add").Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
Simplification\Simplifiers\NameSimplifier.cs (1)
643simplifiedNode.DescendantNodes().Any(n => n is PointerTypeSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
449=> node.DescendantNodes(n => n == node || !n.IsReturnableConstruct()).Any(n => n is YieldStatementSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
379foreach (var localFunction in node.DescendantNodes().Where(CSharpSyntaxFacts.Instance.IsLocalFunctionStatement))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
255var originalIdentifierNodes = originalLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText)); 261var replacedIdentifierNodes = replacedLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
45foreach (var child in memberDeclaration.DescendantNodes())
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (8)
CodeGeneration\SyntaxGeneratorTests.cs (5)
2662var summary = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlElementSyntax>().First(); 2686var summary = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlElementSyntax>().First(); 2711var text = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlTextSyntax>().First(); 2734var text = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlTextSyntax>().First(); 4581var decl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().First();
Formatting\FormattingElasticTriviaTests.cs (1)
111var decl = generator.GetDeclaration(root.DescendantNodes().OfType<VariableDeclaratorSyntax>().First(vd => vd.Identifier.Text == "f2"));
Formatting\FormattingTreeEditTests.cs (2)
43var param = root.DescendantNodes().OfType<ParameterSyntax>().First(); 56var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Semantics\SpeculationAnalyzerTestsBase.cs (2)
36var initialNode = initialTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? initialExpression)); 39var replacementNode = replacementTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? replacementExpression));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
CodeFixes\CodeFixServiceTests.cs (1)
1202var variableDeclarations = context.SemanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax>();
CodeGeneration\AbstractCodeGenerationTests.cs (2)
94var expression = simplifiedRootNode.DescendantNodes().OfType<EqualsValueClauseSyntax>().First().Value; 115var expression = simplifiedRootNode.DescendantNodes().OfType<EqualsValueSyntax>().First().Value;
SymbolFinder\DependentTypeFinderTests.cs (1)
647var firstDecl = csRoot.DescendantNodes().First(d => d is CSharp.Syntax.TypeDeclarationSyntax);
Utilities\SymbolEquivalenceComparerTests.cs (2)
1891var invocation = method_root.DescendantNodes().OfType<TInvocation>().FirstOrDefault(); 1893invocation ??= method_root.Parent.DescendantNodes().OfType<TInvocation>().First();
Microsoft.CodeAnalysis.Features (18)
ChangeSignature\DelegateInvokeMethodReferenceFinder.cs (1)
96var nodes = root.DescendantNodes();
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (1)
177=> root.DescendantNodes(n => n is TCompilationUnitSyntax or TNamespaceDeclarationSyntax)
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
267.DescendantNodes(spine.Contains)
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
837? container.DescendantNodes().First()
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
155var identifiers = containingMember.DescendantNodes().OfType<TIdentifierNameSyntax>();
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
194var ifStatements = editor.OriginalRoot.DescendantNodes().OfType<TIfStatementSyntax>().ToArray();
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (1)
69var typeNames = member.DescendantNodes().Where(n => IsQualifiedOrSimpleName(n) && !n.Span.IsEmpty);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
195foreach (var coalesceNode in syntax.DescendantNodes().OfType<TBinaryExpressionSyntax>())
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
185foreach (var child in condition.Syntax.DescendantNodes().OfType<TExpressionSyntax>())
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
200var variablesInExpression = expression.DescendantNodes();
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (1)
65var variablesInExpression = _expression.DescendantNodes().OfType<TIdentifierNameSyntax>();
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
156=> node.AncestorsAndSelf().OfType<TNamespaceDeclarationSyntax>().Count() + node.DescendantNodes().OfType<TNamespaceDeclarationSyntax>().Count();
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
105.DescendantNodes(n => n is TNamespaceSyntax)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
151if (operationBlock.Syntax.DescendantNodes(descendIntoTrivia: true)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
135nodes = docComment.DescendantNodes(descendIntoChildren: _ => true)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
192var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n)).OfType<TReturnStatementSyntax>();
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (2)
633foreach (var localDeclarationStatement in containingMemberDeclaration.DescendantNodes().OfType<TLocalDeclarationStatementSyntax>()) 831memberDeclaration.DescendantNodes()
Microsoft.CodeAnalysis.Features.UnitTests (3)
FindUsages\DefinitionItemFactoryTests.cs (3)
1452var f = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is LocalFunctionStatementSyntax)); 1518var x = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is VariableDeclaratorSyntax)); 1589var r = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is FromClauseSyntax));
Microsoft.CodeAnalysis.Test.Utilities (3)
CommonTestBase.cs (1)
648foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes())
Diagnostics\CommonDiagnosticAnalyzers.cs (2)
2600var fields = context.Tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.FieldDeclarationSyntax>(); 2850foreach (var localDecl in root.DescendantNodes().OfType<CSharp.Syntax.LocalDeclarationStatementSyntax>())
Microsoft.CodeAnalysis.UnitTests (7)
CommonSyntaxTests.cs (4)
210var exprB = expr.DescendantNodes().OfType<CSharp.Syntax.IdentifierNameSyntax>().First(n => n.Identifier.ToString() == "b"); 216nodes: trackedExpr.DescendantNodes().OfType<CSharp.Syntax.ExpressionSyntax>(), 231var exprB = expr.DescendantNodes().OfType<CSharp.Syntax.IdentifierNameSyntax>().First(n => n.Identifier.ToString() == "b"); 239nodes: trackedExpr.DescendantNodes().OfType<CSharp.Syntax.ExpressionSyntax>(),
Diagnostics\OperationTests.cs (3)
277var methodBodySyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Last(); 310var literal = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 323var classDecl = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
47For Each node In context.Node.DescendantNodes()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (2)
297.DescendantNodes() _ 305.DescendantNodes() _
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Attributes\AttributeTests.vb (1)
2103Dim expr = tree.GetRoot().DescendantNodes().OfType(Of BinaryExpressionSyntax).First()
Microsoft.CodeAnalysis.VisualBasic.Features (9)
AddImport\VisualBasicAddImportFeatureService.vb (2)
150node = CType(node, XmlCrefAttributeSyntax).Reference.DescendantNodes().OfType(Of IdentifierNameSyntax).FirstOrDefault() 152node = CType(node, CrefReferenceSyntax).DescendantNodes().OfType(Of IdentifierNameSyntax).FirstOrDefault()
ChangeSignature\VisualBasicChangeSignatureService.vb (2)
619.DescendantNodes(descendIntoTrivia:=True) _ 692Dim nodes = root.DescendantNodes()
EditAndContinue\SyntaxUtilities.vb (2)
226Return ImmutableArray.CreateRange(body.DescendantNodes(AddressOf LambdaUtilities.IsNotLambda). 232Return ImmutableArray.CreateRange(body.DescendantNodes(Function(n) TypeOf n IsNot ExpressionSyntax).
EncapsulateField\VisualBasicEncapsulateFieldService.vb (1)
74Dim fields = root.DescendantNodes(Function(n) n.Span.IntersectsWith(span)) _
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.CallSiteContainerRewriter.vb (1)
49Dim nodesToRemove = result.DescendantNodes(Function(n) n.ContainsAnnotations).Where(Function(n) n.HasAnnotation(s_removeAnnotation))
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedMembers\VisualBasicRemoveUnusedMembersDiagnosticAnalyzer.vb (1)
47For Each node In context.Node.DescendantNodes()
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (3)
EditAndContinue\SyntaxUtilitiesTests.vb (3)
18For Each oldNode In oldRoot.DescendantNodes().Where(Function(n) n.FullSpan.Length > 0) 68Dim leftPosition = leftRoot.DescendantNodes().OfType(Of LiteralExpressionSyntax).ElementAt(2).SpanStart '0 within Console.WriteLine(0) 109Dim leftPosition = leftRoot.DescendantNodes().OfType(Of LiteralExpressionSyntax).ElementAt(5).SpanStart '3 within Console.WriteLine(3)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (42)
Compilation\SemanticModelAPITests.vb (24)
69Dim children = tree.GetCompilationUnitRoot().DescendantNodes() 111Dim node = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax).Skip(1).First 151Dim node = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax).Skip(1).First 193Dim descendants = tree.GetCompilationUnitRoot().DescendantNodes() 495Dim crefSyntax = root.DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).Single() 592Dim originalExpression = originalStatement.DescendantNodes().Where(Function(syntax) syntax.Kind = SyntaxKind.ObjectCreationExpression).FirstOrDefault() 596speculatedExpression = speculatedStatement.DescendantNodes().OfType(Of CastExpressionSyntax).Single() 980Dim lambdaExpressionHeader = speculatedStatement.DescendantNodes().OfType(Of LambdaHeaderSyntax)().FirstOrDefault() 1040Dim rangeArg = root.DescendantNodes().OfType(Of RangeArgumentSyntax).Single() 1079Dim rangeArg = root.DescendantNodes().OfType(Of RangeArgumentSyntax).Single() 1387Dim localDecl = tree.GetRoot().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax)().Single() 1707Dim lambdaExpressionHeader = speculatedMethod.Statements(0).DescendantNodes().OfType(Of LambdaHeaderSyntax)().FirstOrDefault() 1982Dim initializer = statementSyntax.DescendantNodes().Single(Function(n) n.ToString() = "Me.goo") 2017Dim initializer = statementSyntax.DescendantNodes().Single(Function(n) n.ToString() = "Me.goo") 2777Dim node = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MemberAccessExpressionSyntax).First() 2814Dim node = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MemberAccessExpressionSyntax).First() 2850Dim node = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of BinaryExpressionSyntax).First() 2945Dim decl = root.DescendantNodes(). 2986Dim decl = root.DescendantNodes(). 4025Dim nodes = From n In tree.GetCompilationUnitRoot().DescendantNodes() Where n.Kind = SyntaxKind.IdentifierName Select CType(n, IdentifierNameSyntax) 4060Dim assignments = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax)() 4507Dim xmlString = root.DescendantNodes(descendIntoTrivia:=True).OfType(Of XmlStringSyntax).Single() 4586For Each interp In root.DescendantNodes().OfType(Of InterpolatedStringExpressionSyntax) 4615Dim node = root.DescendantNodes().OfType(Of QualifiedNameSyntax).Single()
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (2)
2854Dim nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of ModifiedIdentifierSyntax)() 2888Dim nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of PropertyStatementSyntax)()
Compilation\SuppressAccessibilityChecksTests.vb (7)
55Dim invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 68Dim invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 81Dim invocation = syntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 88Dim creationExpression = speculativeSemanticModel.GetTypeInfo(statement.DescendantNodes().OfType(Of ObjectCreationExpressionSyntax)().Single()) 119Dim expr = DirectCast(root.DescendantNodes().OfType(Of SingleLineLambdaExpressionSyntax)().Single().Body, ExpressionSyntax) 188Dim invocation = syntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 257.DescendantNodes() _
FlowAnalysis\IterationJumpYieldStatementTests.vb (1)
1345Dim foreachBlock = tree.GetRoot.DescendantNodes.OfType(Of ForEachBlockSyntax).Single
Semantics\BinaryOperators.vb (3)
987Dim nodes = (From node In tree.GetRoot().DescendantNodes() 1327Dim nodes = (From node In tree.GetRoot().DescendantNodes() 1422Dim nodes = (From node In tree.GetRoot().DescendantNodes()
Semantics\QueryExpressions_LookupSymbols.vb (1)
764Dim node = tree.GetRoot().DescendantNodes().OfType(Of QueryExpressionSyntax)().First()
Semantics\QueryExpressions_SemanticModel.vb (1)
2963Dim node = tree.GetRoot().DescendantNodes().OfType(Of QueryExpressionSyntax)().First()
Semantics\SyntaxTreeRootTests.vb (1)
79Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType(Of ClassStatementSyntax)().Single().SyntaxTree)
Semantics\UnaryOperators.vb (2)
666Dim nodes = (From node In tree.GetRoot().DescendantNodes() 818Dim node1 = (From node In tree.GetRoot().DescendantNodes()
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (6)
DocumentationComments\DocCommentTests.vb (4)
12248Dim node1 = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single() 12254Dim node = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "Integer").Single() 12308Dim node1 = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single() 12314Dim node = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "System.Int32").Single()
SymbolsTests\AnonymousDelegates\AnonymousDelegates_CreationAndEmit.vb (1)
490Dim x = tree.GetRoot().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (1)
2058Dim x = tree.GetRoot().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (32)
Parser\ParseAsyncTests.vb (5)
371Dim asyncExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray() 375Dim invocationExpression = tree.GetRoot().DescendantNodes.OfType(Of InvocationExpressionSyntax).ToArray() 379Dim allParsedExpressions = tree.GetRoot().DescendantNodes.OfType(Of ExpressionSyntax)() 436Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray() 440Dim awaitParsedAsIdentifier = tree.GetRoot().DescendantNodes.OfType(Of IdentifierNameSyntax).Where(Function(id) id.Identifier.ValueText.Equals("Await")).ToArray()
Parser\ParseErrorTests.vb (1)
4763Dim emptyStatement = tree.GetRoot().DescendantNodes().OfType(Of EmptyStatementSyntax).Single()
Parser\ParseExpression.vb (4)
2249Dim nodes = tree.GetRoot().DescendantNodes().ToArray() 2266Dim nodes = tree.GetRoot().DescendantNodes().ToArray() 2283Dim nodes = tree.GetRoot().DescendantNodes().ToArray() 2301Dim nodes = tree.GetRoot().DescendantNodes().ToArray()
Parser\ParseIteratorTests.vb (5)
152Dim yieldStatements = tree.GetRoot().DescendantNodes.OfType(Of YieldStatementSyntax)().ToArray() 156Dim methodSyntaxList = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)().ToArray() 224Dim yieldStatements = tree.GetRoot().DescendantNodes.OfType(Of YieldStatementSyntax)().ToArray() 362Dim actual = From expression In tree.GetRoot().DescendantNodes() 409Dim yieldStatements = tree.GetRoot().DescendantNodes.OfType(Of YieldStatementSyntax).ToArray()
Syntax\SyntaxListTests.vb (2)
261Dim node = tree.GetRoot().DescendantNodes().OfType(Of CollectionInitializerSyntax)().First() 287Dim node = tree.GetRoot().DescendantNodes().OfType(Of CollectionInitializerSyntax)().First()
Syntax\SyntaxRewriterTests.vb (7)
499Dim xmlNode = oldRoot.DescendantNodes(descendIntoTrivia:=True).OfType(Of XmlEmptyElementSyntax)().Single() 532Dim before = root.DescendantNodes().OfType(Of LiteralExpressionSyntax)().Single() 551Dim invocation = root.DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 570Dim invocation = root.DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 636Dim field = tree.GetRoot().DescendantNodes().OfType(Of FieldDeclarationSyntax).Single() 663Dim field = tree.GetRoot().DescendantNodes().OfType(Of FieldDeclarationSyntax).Single() 686Dim newRoot = root.RemoveNode(root.DescendantNodes().First(), SyntaxRemoveOptions.KeepDirectives)
TestSyntaxNodes.vb (8)
1286expr.DescendantNodes().OfType(Of ExpressionSyntax)(), 1319Dim expA = invocation.DescendantNodes().OfType(Of ExpressionSyntax).First(Function(n) n.ToString() = "a") 1356Dim expA = invocation.DescendantNodes().OfType(Of ExpressionSyntax).First(Function(n) n.ToString() = "a") 2263Dim identifier = root.DescendantNodes(descendIntoTrivia:=True).Single(Function(n) TypeOf n Is IdentifierNameSyntax) 2372Dim e = expression.DescendantNodes().OfType(Of IdentifierNameSyntax)().First(Function(n) n.Identifier.ValueText = "e") 2389Dim e = expression.DescendantNodes().OfType(Of IdentifierNameSyntax)().First(Function(n) n.Identifier.ValueText = "e") 2411Dim nodes = statement.DescendantNodes().ToList() 2415nodes = statement.DescendantNodes(descendIntoTrivia:=True).ToList()
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (2)
297.DescendantNodes() _ 305.DescendantNodes() _
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (6)
CodeGeneration\SyntaxGeneratorTests.vb (5)
1108Dim node = tree.GetRoot().DescendantNodes().First() 2491Dim summary = cls.DescendantNodes(descendIntoTrivia:=True).OfType(Of XmlElementSyntax)().First() 2511Dim summary = cls.DescendantNodes(descendIntoTrivia:=True).OfType(Of XmlElementSyntax)().First() 2532Dim text = cls.DescendantNodes(descendIntoTrivia:=True).OfType(Of XmlTextSyntax)().First() 2552Dim text = cls.DescendantNodes(descendIntoTrivia:=True).OfType(Of XmlTextSyntax)().First()
Formatting\FormattingTests.vb (1)
4204Dim propertyBlock = (Await document.GetSyntaxRootAsync()).DescendantNodes().OfType(Of PropertyBlockSyntax).Single()
Microsoft.CodeAnalysis.Workspaces (4)
Differencing\AbstractSyntaxComparer.cs (1)
106foreach (var descendant in child.DescendantNodes(DescendIntoChildren))
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
35node = root.DescendantNodes(n => n.FullSpan.Contains(change)).LastOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
262foreach (var node in containerDeclaration.DescendantNodes())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
238currentNodeOrToken = newRoot.DescendantNodes().Single(c => c.HasAnnotation(marker));
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
340var decl = root.DescendantNodes().OfType<CS.Syntax.ClassDeclarationSyntax>().First();
Microsoft.CodeAnalysis.Workspaces.UnitTests (18)
CodeCleanup\CodeCleanupTests.cs (3)
302var accessor = root.DescendantNodes().OfType<VisualBasic.Syntax.AccessorBlockSyntax>().Last(); 309var newAccessor = newRoot.DescendantNodes().OfType<VisualBasic.Syntax.AccessorBlockSyntax>().Last(); 312accessor = root.DescendantNodes().OfType<VisualBasic.Syntax.AccessorBlockSyntax>().Last();
FindReferencesTests.cs (4)
183SyntaxNode declareMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.DeclareStatementSyntax>().FirstOrDefault(); 184SyntaxNode normalMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodStatementSyntax>().ToList()[1]; 222var propertyStatement = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyStatementSyntax>().FirstOrDefault(); 286var methodlist = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax>().ToList();
SolutionTests\SolutionTests.cs (2)
3235var classNode = syntaxRoot.DescendantNodes().OfType<CS.Syntax.ClassDeclarationSyntax>().Single(); 3240var classNode = syntaxRoot.DescendantNodes().OfType<VB.Syntax.ClassStatementSyntax>().Single();
SymbolKeyTests.cs (5)
620var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).Symbol).ToList(); 656var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).GetAnySymbol()).ToList(); 679var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.UsingDirectiveSyntax>().Select(s => model.GetDeclaredSymbol(s)).ToList(); 1275var node = root.DescendantNodes().OfType<CSharp.Syntax.GenericNameSyntax>().Single(); 1571foreach (var token in root.DescendantNodes())
SyntaxNodeTests.cs (4)
32var node = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 53var nodes = root.DescendantNodes().Where(n => n is VariableDeclaratorSyntax or ClassDeclarationSyntax).ToList(); 95var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 96var methodDecl = classDecl.DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Microsoft.DotNet.GenFacades (2)
TypeParser.cs (2)
59var allPublicTypes = root.DescendantNodes().OfType<BaseTypeDeclarationSyntax>() 73var allPublicTypes = root.DescendantNodes().OfType<DelegateDeclarationSyntax>()
Microsoft.Gen.ContextualOptions.Unit.Tests (9)
EmitterTests.cs (9)
28.DescendantNodes() 38syntaxTree.GetRoot().DescendantNodes().OfType<StructDeclarationSyntax>().Single().Members.Single().Modifiers, 47.DescendantNodes() 51.DescendantNodes() 63.DescendantNodes() 79.DescendantNodes() 92.DescendantNodes() 107.DescendantNodes() 120.DescendantNodes()
Microsoft.ML.InternalCodeAnalyzer (1)
BestFriendAnalyzer.cs (1)
66foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes(n => !n.IsKind(SyntaxKind.UsingDirective)))
Microsoft.VisualStudio.LanguageServices (2)
Progression\GraphNodeIdCreation.cs (1)
541foreach (var node in currentNode.DescendantNodes())
Progression\GraphQueries\CallsGraphQuery.cs (1)
49foreach (var syntaxNode in (await reference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false)).DescendantNodes())
Microsoft.VisualStudio.LanguageServices.CSharp (1)
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
129var candidateUsing = SyntaxFactory.ParseCompilationUnit("using " + namespaceToImport + ";").DescendantNodes().OfType<UsingDirectiveSyntax>().FirstOrDefault();
Mvc.Api.Analyzers.Test (3)
ActualApiResponseMetadataFactoryTest.cs (3)
78var returnStatement = methodSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().First(); 395var returnStatement = methodSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().First(); 414var returnStatement = methodSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().First();
System.Windows.Forms.Analyzers.CodeFixes.CSharp (3)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (3)
101if (root.DescendantNodes() 110bool hasUsings = root.DescendantNodes() 126.DescendantNodes()
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (3)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (3)
115If root.DescendantNodes(). 124Dim hasImports As Boolean = root.DescendantNodes(). 140DescendantNodes().