1495 references to GetCompilationUnitRoot
IdeCoreBenchmarks (1)
SyntacticChangeRangeBenchmark.cs (1)
45_root = _tree.GetCompilationUnitRoot();
Microsoft.CodeAnalysis.CSharp (5)
Binder\Binder_Initializers.cs (1)
198var syntaxRoot = syntaxTree.GetCompilationUnitRoot();
Compilation\CSharpCompilation.cs (1)
3886var unit = syntaxTree.GetCompilationUnitRoot();
Compilation\SyntaxAndDeclarationManager.cs (3)
204foreach (var directive in tree.GetCompilationUnitRoot().GetLoadDirectives()) 475var newLoadDirectivesSyntax = newTree.GetCompilationUnitRoot().GetLoadDirectives(); 476var loadDirectivesHaveChanged = !oldTree.GetCompilationUnitRoot().GetLoadDirectives().SequenceEqual(newLoadDirectivesSyntax);
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
91var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 189var root = tree.GetCompilationUnitRoot(cancellationToken);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (118)
BreakingChanges.cs (2)
199Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 218Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString());
CodeGen\CodeGenDeconstructTests.cs (8)
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(); 5000var nodes = comp.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf(); 5123var nodes = comp.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf();
CodeGen\CodeGenTupleEqualityTests.cs (46)
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(); 5122var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 5158var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
CodeGen\CodeGenTupleTest.cs (62)
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(); 4154var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 5473var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 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(); 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(); 22614var finalString = startTree.GetCompilationUnitRoot().ToFullString(); 22619var finalText = newTree.GetCompilationUnitRoot().ToFullString(); 22855var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 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();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (5)
Emit\NumericIntPtrTests.cs (5)
11172var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11195var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11223var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11248var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11293var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (29)
Attributes\AttributeTests.cs (3)
5718var m = (ExpressionSyntax)cm.SyntaxTrees[0].GetCompilationUnitRoot().FindToken(index).Parent.Parent; 7537var attrArgSyntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>(); 7578var attrArgSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single();
FlowAnalysis\IterationJumpYieldStatementTests.cs (1)
914var foreachNode = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
FlowAnalysis\RegionAnalysisTests.cs (14)
3102var statement = compilation.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().First(); 4426var index = tree.GetCompilationUnitRoot().ToFullString().IndexOf(".Class)", StringComparison.Ordinal); 4427var tok = tree.GetCompilationUnitRoot().FindToken(index); 4526var stmt1 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString() == "IntPtr p;").Single(); 4527var stmt2 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString().StartsWith(keyword)).First(); 5487var methodBlock = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().First(); 6217var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6228var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6314var root = tree.GetCompilationUnitRoot(); 6353var root = tree.GetCompilationUnitRoot(); 6380var root = tree.GetCompilationUnitRoot(); 6418var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().FirstOrDefault(); 6446var root = tree.GetCompilationUnitRoot(); 7909var stmt = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<ForEachStatementSyntax>().Single().Statement;
RefReadonlyParameterTests.cs (2)
7102var docComment = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 7130var docComment = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single();
Semantics\OutVarTests.cs (4)
34329var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34339syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 34543var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34553syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Semantics\PatternSwitchTests.cs (4)
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();
Semantics\RecordTests.cs (1)
28343var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Microsoft.CodeAnalysis.CSharp.Features (2)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
91var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 189var root = tree.GetCompilationUnitRoot(cancellationToken);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (11)
IOperation\IOperationTests.cs (2)
587var root = tree.GetCompilationUnitRoot(); 615var root = tree.GetCompilationUnitRoot();
IOperation\IOperationTests_IVariableDeclaration.cs (9)
925var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1215var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 1218syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2301var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2304syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2362var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2365syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2830var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2833syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (277)
Semantics\AccessibilityTests.cs (1)
53s_testModel.IsAccessible(s_testModel.SyntaxTree.GetCompilationUnitRoot().FullSpan.End + 1, s_testSymbol));
Semantics\ArglistTests.cs (1)
959var root = tree.GetCompilationUnitRoot();
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\ConditionalOperatorTests.cs (1)
1288var compUnit = tree.GetCompilationUnitRoot();
Semantics\ConstantTests.cs (1)
2923var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
Semantics\DeconstructionTests.cs (40)
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();
Semantics\ImplicitObjectCreationTests.cs (21)
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();
Semantics\InitOnlyMemberTests.cs (2)
2518var root = tree.GetCompilationUnitRoot(); 3137var root = tree.GetCompilationUnitRoot();
Semantics\InteractiveSemanticModelTests.cs (2)
40var root = tree.GetCompilationUnitRoot(); 275return GetExprSyntaxList(syntaxTree.GetCompilationUnitRoot(), null);
Semantics\LambdaTests.cs (22)
841ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(). 849var exprs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 941var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1034.GetCompilationUnitRoot() 1088.GetCompilationUnitRoot() 1123.GetCompilationUnitRoot() 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; 2120var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2166var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2212var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2258var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2304var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2334var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2361var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 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();
Semantics\LocalFunctionTests.cs (1)
10384var root = tree.GetCompilationUnitRoot();
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\LookupPositionTests.cs (1)
3129SyntaxToken token = model.SyntaxTree.GetCompilationUnitRoot().FindToken(position, findInsideTrivia: true);
Semantics\LookupTests.cs (1)
1369var eof = tree.GetCompilationUnitRoot().FullSpan.End;
Semantics\NativeIntegerTests.cs (6)
15316var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15337var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15360var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15388var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15411var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15441var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
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\OperatorTests.cs (1)
8812var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\OverloadResolutionPerfTests.cs (1)
982var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<Syntax.InvocationExpressionSyntax>().Last();
Semantics\QueryTests.cs (30)
1453var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1662var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1722var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1760var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 2177SelectClauseSyntax selectClause = (SelectClauseSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("select", StringComparison.Ordinal)).Parent; 2207SelectClauseSyntax selectClause = (SelectClauseSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("select w", StringComparison.Ordinal)).Parent; 2234var e = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("x+1", StringComparison.Ordinal)).Parent; 2240e = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("w+1", StringComparison.Ordinal)).Parent; 2299var selectExpression = tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf('5')); 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(); 2897var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single(); 2930var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single(); 3134var selectNode = tree.GetCompilationUnitRoot().FindToken(index).Parent as SelectClauseSyntax; 3162var joinNode = tree.GetCompilationUnitRoot().FindToken(index).Parent as JoinClauseSyntax; 3377tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem2")) 3386tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem1")) 3420var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 3464var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 3511var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test").Single(); 3550var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test2").Single(); 3598var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "QueryExpressionTest").Single();
Semantics\RecordStructTests.cs (3)
3284var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3332var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3383var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\RefEscapingTests.cs (8)
5717var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 5723var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 5729var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 5735var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13); 5817var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 5823var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 5829var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 5835var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
Semantics\ScriptSemanticsTests.cs (5)
244var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First(); 492GetCompilationUnitRoot() as CompilationUnitSyntax). 521var root = tree.GetCompilationUnitRoot(); 537var root = tree.GetCompilationUnitRoot(); 561var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First();
Semantics\SemanticErrorTests.cs (1)
3326var compilationUnit = tree.GetCompilationUnitRoot();
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\SuppressAccessibilityChecksTests.cs (2)
123var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().Body; 212var root = tree.GetCompilationUnitRoot();
Semantics\SyntaxTreeRootTests.cs (1)
113Assert.Throws<InvalidCastException>(() => { var _ = (CSharpSyntaxTree)(Object)tree.GetCompilationUnitRoot(); });
Semantics\TargetTypedConditionalOperatorTests.cs (1)
336var compUnit = tree.GetCompilationUnitRoot();
Semantics\TargetTypedDefaultTests.cs (36)
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(); 2483var digit = tree.GetCompilationUnitRoot().FindToken(source.IndexOf('2')); 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\TryCatchTests.cs (1)
45var catchClause = tree.GetCompilationUnitRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single();
Semantics\UnsafeTests.cs (28)
5197var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 5383Assert.True(tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>(). 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(); 8345foreach (var nullSyntax in tree.GetCompilationUnitRoot().DescendantTokens().Where(token => token.IsKind(SyntaxKind.NullKeyword))) 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 (375)
Compilation\GetSemanticInfoBrokenCodeTests.cs (14)
31VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 109foreach (var expr in GetAllExpressions(tree.GetCompilationUnitRoot())) 134VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 161foreach (var stmt in GetAllStatements(tree.GetCompilationUnitRoot())) 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"); 317VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 332VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 347VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 362foreach (var expr in GetAllExpressions(tree.GetCompilationUnitRoot()))
Compilation\GetSemanticInfoTests.cs (24)
242var testClass = tree.GetCompilationUnitRoot().Members[1] as TypeDeclarationSyntax; 296var c = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 374var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 477var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 530var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 973var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 997var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 1133var root = tree.GetCompilationUnitRoot(); 1674var varIdentifier = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(n => n.ToString() == "var"); 2356var lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 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>(); 4212var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); 4242var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); 4272var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<GenericNameSyntax>().Single(); 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(); 5402var root = tree.GetCompilationUnitRoot(); 5913var tokens = tree.GetCompilationUnitRoot().DescendantTokens();
Compilation\ReferenceManagerTests.cs (3)
894var rd1 = t1.GetCompilationUnitRoot().GetReferenceDirectives().Single(); 895var rd2 = t2.GetCompilationUnitRoot().GetReferenceDirectives().Single(); 896var rd3 = t3.GetCompilationUnitRoot().GetReferenceDirectives().Single();
Compilation\SemanticModelAPITests.cs (95)
136var root = tree.GetCompilationUnitRoot(); 174var root = tree.GetCompilationUnitRoot(); 201var root = tree.GetCompilationUnitRoot(); 233var root = tree.GetCompilationUnitRoot(); 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(); 533var bdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 559var cdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 585var cdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 608var bdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 642var classProgram = tree2.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 673var decl = tree1.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 701var decl = tree1.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 724var bdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 750var adecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 782var root = tree.GetCompilationUnitRoot(); 817var root = tree.GetCompilationUnitRoot(); 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(); 924var root = tree.GetCompilationUnitRoot(); 964var root1 = tree1.GetCompilationUnitRoot(); 965var root2 = tree1.GetCompilationUnitRoot(); 966var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 967var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 1005var root1 = tree1.GetCompilationUnitRoot(); 1006var root2 = tree1.GetCompilationUnitRoot(); 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(); 1408var root = tree.GetCompilationUnitRoot(); 1452var root = tree.GetCompilationUnitRoot(); 1498var root = tree.GetCompilationUnitRoot(); 1547var root = tree.GetCompilationUnitRoot(); 1586var root = tree.GetCompilationUnitRoot(); 1626var root = tree.GetCompilationUnitRoot(); 1644var root = tree.GetCompilationUnitRoot(); 1662var root = tree.GetCompilationUnitRoot(); 1775var root = tree.GetCompilationUnitRoot(); 1826var root = tree.GetCompilationUnitRoot(); 1876var root = tree.GetCompilationUnitRoot(); 1915var root = tree.GetCompilationUnitRoot(); 1952var root = tree.GetCompilationUnitRoot(); 1989var root = tree.GetCompilationUnitRoot(); 2025var root = tree.GetCompilationUnitRoot(); 2072var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2141var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 2168var root = tree.GetCompilationUnitRoot(); 2213var root = tree.GetCompilationUnitRoot(); 2255var root = tree.GetCompilationUnitRoot(); 2347var root = tree.GetCompilationUnitRoot(); 2442var root = tree.GetCompilationUnitRoot(); 2484var root = tree.GetCompilationUnitRoot(); 2529var root = tree.GetCompilationUnitRoot(); 2560var root = tree.GetCompilationUnitRoot(); 2632var root = tree.GetCompilationUnitRoot(); 2669var root = tree.GetCompilationUnitRoot(); 2760var root = tree.GetCompilationUnitRoot(); 2796var root = tree.GetCompilationUnitRoot(); 2811var root = tree.GetCompilationUnitRoot(); 2830var root = tree.GetCompilationUnitRoot(); 2860var root = tree.GetCompilationUnitRoot(); 2890var root = tree.GetCompilationUnitRoot(); 2919var root = tree.GetCompilationUnitRoot(); 2959var root = tree.GetCompilationUnitRoot(); 3004var root = tree.GetCompilationUnitRoot(); 3085var root = tree.GetCompilationUnitRoot(); 3610var root = tree.GetCompilationUnitRoot(); 4475var root = tree.GetCompilationUnitRoot(); 4539var root = tree.GetCompilationUnitRoot(); 4773GetExpressionSyntax(tree.GetCompilationUnitRoot(), exprSynList);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (166)
37var root = tree.GetCompilationUnitRoot(); 59var root = tree.GetCompilationUnitRoot(); 78var root = tree.GetCompilationUnitRoot(); 103var root = tree.GetCompilationUnitRoot(); 123var root = tree.GetCompilationUnitRoot(); 146var root = tree.GetCompilationUnitRoot(); 168var root = tree.GetCompilationUnitRoot(); 188var root = tree.GetCompilationUnitRoot(); 209var root = tree.GetCompilationUnitRoot(); 232var root = tree.GetCompilationUnitRoot(); 256var root = tree.GetCompilationUnitRoot(); 276var root = tree.GetCompilationUnitRoot(); 299var root = tree.GetCompilationUnitRoot(); 332var root = tree.GetCompilationUnitRoot(); 379var root = tree.GetCompilationUnitRoot(); 405var root = tree.GetCompilationUnitRoot(); 428var root = tree.GetCompilationUnitRoot(); 429var node = root.FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("public event D Iter3", StringComparison.Ordinal)).Parent as BasePropertyDeclarationSyntax; 450var root = tree.GetCompilationUnitRoot(); 472var root = tree.GetCompilationUnitRoot(); 497var root = tree.GetCompilationUnitRoot(); 519var root = tree.GetCompilationUnitRoot(); 541var root = tree.GetCompilationUnitRoot(); 566var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 588var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 775var fieldDecl = (FieldDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 797var fieldDecl = (FieldDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 821var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 837var delegateDecl = (DelegateDeclarationSyntax)(tree.GetCompilationUnitRoot().Members[0]); 857var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 881var typeDecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 901var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 938var root = tree.GetCompilationUnitRoot(); 1004var root = tree.GetCompilationUnitRoot(); 1053var namespaceDecl = (BaseNamespaceDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 1081var cu = tree.GetCompilationUnitRoot(); 1124var cu = tree.GetCompilationUnitRoot(); 1171var cu = tree.GetCompilationUnitRoot(); 1210var cu = tree.GetCompilationUnitRoot(); 1246var cu = tree.GetCompilationUnitRoot(); 1280var cu = tree.GetCompilationUnitRoot(); 1330var cu = tree.GetCompilationUnitRoot(); 1380var cu = tree.GetCompilationUnitRoot(); 1433var cu = tree.GetCompilationUnitRoot(); 1481var cu = tree.GetCompilationUnitRoot(); 1529var cu = tree.GetCompilationUnitRoot(); 1593var cu = tree.GetCompilationUnitRoot(); 1627var cu = tree.GetCompilationUnitRoot(); 1665var cu = tree.GetCompilationUnitRoot(); 1709var cu = tree.GetCompilationUnitRoot(); 1813var cu = tree.GetCompilationUnitRoot(); 1869var cu = tree.GetCompilationUnitRoot(); 2006var cu = tree.GetCompilationUnitRoot(); 2050var cu = tree.GetCompilationUnitRoot(); 2250var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2286var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2323var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2359var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2395var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2425var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2457var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2494var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2531var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2562var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[1]; 2591var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[1]; 2616var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2641var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2671var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2699var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2783var root = tree.GetCompilationUnitRoot(); 2810var root = tree.GetCompilationUnitRoot(); 2842var root = tree.GetCompilationUnitRoot(); 2904var root = tree.GetCompilationUnitRoot(); 2934var root = tree.GetCompilationUnitRoot(); 2966var root = tree.GetCompilationUnitRoot(); 3015var root = tree.GetCompilationUnitRoot(); 3042var root = tree.GetCompilationUnitRoot(); 3072var root = tree.GetCompilationUnitRoot(); 3108var root = tree.GetCompilationUnitRoot(); 3138var root = tree.GetCompilationUnitRoot(); 3177var accessorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3211var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[2]).Members[0]; 3234var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3265var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3311var root = tree.GetCompilationUnitRoot(); 3314var paramNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("param1", StringComparison.Ordinal)).Parent; 3340var root = tree.GetCompilationUnitRoot(); 3366var root = tree.GetCompilationUnitRoot(); 3381var root = tree.GetCompilationUnitRoot(); 3405var root = tree.GetCompilationUnitRoot(); 3408var foreachNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("foreach", StringComparison.Ordinal)).Parent; 3426var root = tree.GetCompilationUnitRoot(); 3429var delegateNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("delegate", StringComparison.Ordinal)).Parent; 3445var root = tree.GetCompilationUnitRoot(); 3448var usingNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("using", StringComparison.Ordinal)).Parent; 3477var foreachNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3501var foreachNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3528var foreachNode1 = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3534var foreachNode2 = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("bbb", StringComparison.Ordinal)).Parent; 3565var catchDeclaration = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3586var methodDecl = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Goo", StringComparison.Ordinal)).Parent; 3611var methodDecl = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Goo", StringComparison.Ordinal)).Parent; 3633var cu = tree.GetCompilationUnitRoot(); 3668dynamic methodDecl = (MethodDeclarationSyntax)tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Main", StringComparison.Ordinal)).Parent; 3686var globalStmt = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf('/')).Parent.AncestorsAndSelf().Single(x => x.IsKind(SyntaxKind.GlobalStatement)); 3709var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3737var root = tree.GetCompilationUnitRoot(); 3749var root2 = tree.GetCompilationUnitRoot(); 3847var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedExpressionSyntax>().First(); 3866var node = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantTokens().Where(t => t.ToString() == "Alias").Last().Parent; 3901var param = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "name").First(); 3922var usingDirectives = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3966var attr = (AttributeSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)tree2.GetCompilationUnitRoot()).Members[0]).AttributeLists[0].Attributes[0]; 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(); 4471var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4502var operatorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OperatorDeclarationSyntax>().Single(); 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)); 5124var root = tree.GetCompilationUnitRoot(); 5173var cu = tree.GetCompilationUnitRoot(); 5222var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5243var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5264var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5302var root = tree.GetCompilationUnitRoot(); 5353var root = tree.GetCompilationUnitRoot(); 5397var root = tree.GetCompilationUnitRoot(); 5445var root = tree.GetCompilationUnitRoot(); 5488var root = tree.GetCompilationUnitRoot(); 5539var root = tree.GetCompilationUnitRoot(); 5583var root = tree.GetCompilationUnitRoot(); 5631var root = tree.GetCompilationUnitRoot();
Compilation\SemanticModelGetSemanticInfoTests.cs (3)
14484var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Last(); 14656var argumentSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 15434var syntax = tree.GetCompilationUnitRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.ThisExpression);
DeclarationTests.cs (1)
942_root = CloneNodeAsRoot(_underlyingTree.GetCompilationUnitRoot(CancellationToken.None));
DocumentationComments\CrefTests.cs (1)
6618var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
DocumentationComments\DocumentationCommentCompilerTests.cs (3)
2354var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString(); 2538var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString(); 2907var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString();
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)
841var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
SymbolDisplay\SymbolDisplayTests.cs (2)
6062var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 6072methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Symbols\AnonymousTypesSemanticsTests.cs (1)
2054stack.Push(tree.GetCompilationUnitRoot());
Symbols\AnonymousTypesSymbolTests.cs (1)
1640var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single();
Symbols\AssemblyAndNamespaceTests.cs (1)
331var root = tree.GetCompilationUnitRoot();
Symbols\CompilationCreationTests.cs (1)
55var types = expectedSyntaxTrees.Select(tree => compilation.GetSemanticModel(tree).GetDeclaredSymbol(tree.GetCompilationUnitRoot().Members.Single())).ToArray();
Symbols\ConversionTests.cs (3)
393var variableDeclarator = (VariableDeclaratorSyntax)tree.GetCompilationUnitRoot() 400var sourceExpression1 = (ExpressionSyntax)tree.GetCompilationUnitRoot() 406var sourceExpression2 = (ExpressionSyntax)tree.GetCompilationUnitRoot()
Symbols\DestructorTests.cs (2)
407var destructorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single(); 413var finalizeSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Name;
Symbols\ExtensionMethodTests.cs (7)
227syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single()).Symbol; 2431var expr = ((ExpressionStatementSyntax)((GlobalStatementSyntax)tree.GetCompilationUnitRoot().Members[0]).Statement).Expression; 2727var node = tree.GetCompilationUnitRoot().FindToken(code.IndexOf("GetHashCode", StringComparison.Ordinal)).Parent; 2737node = tree.GetCompilationUnitRoot().FindToken(code.IndexOf("Cast<T1>", StringComparison.Ordinal)).Parent; 2952var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3010var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3139var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList();
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 (5)
1289var indexerAccessSyntax = GetElementAccessExpressions(tree.GetCompilationUnitRoot()).Single(); 2531var actual = GetElementAccessExpressions(tree.GetCompilationUnitRoot()).Select(syntax => model.GetSymbolInfo(syntax).Symbol.ToTestDisplayString()); 2615var elementAccessSyntaxes = GetElementAccessExpressions(tree.GetCompilationUnitRoot()); 2702var elementAccessSyntaxes = GetElementAccessExpressions(tree.GetCompilationUnitRoot()); 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\MethodEqualityTests.cs (1)
208var root = tree.GetCompilationUnitRoot();
Symbols\Source\BaseClassTests.cs (2)
271var classA = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 308var classA = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0];
Symbols\Source\DeclaringSyntaxNodeTests.cs (5)
155var node = tree.GetCompilationUnitRoot().FindToken(position).Parent.FirstAncestorOrSelf<TNode>(); 263var declaratorA1 = tree.GetCompilationUnitRoot().FindToken(posA1).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>(); 307var declaratorQ = tree.GetCompilationUnitRoot().FindToken(posQ).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>(); 314var declaratorX = tree.GetCompilationUnitRoot().FindToken(posX).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>(); 321var declaratorZ = tree.GetCompilationUnitRoot().FindToken(posZ).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
Symbols\Source\DelegateTests.cs (2)
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\ExternAliasTests.cs (3)
350var root = tree.GetCompilationUnitRoot() as CompilationUnitSyntax; 408var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 434var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single();
Symbols\Source\UsingAliasTests.cs (15)
31var root = tree.GetCompilationUnitRoot(); 88var root = tree.GetCompilationUnitRoot(); 148var root = tree.GetCompilationUnitRoot(); 203var root = tree.GetCompilationUnitRoot(); 268var root = tree.GetCompilationUnitRoot(); 295var root = tree.GetCompilationUnitRoot(); 341var root = tree.GetCompilationUnitRoot(); 382var root = tree.GetCompilationUnitRoot(); 403var root = tree.GetCompilationUnitRoot(); 422var root = tree.GetCompilationUnitRoot(); 441var root = tree.GetCompilationUnitRoot(); 460var root = tree.GetCompilationUnitRoot(); 479var root = tree.GetCompilationUnitRoot(); 500var root = tree.GetCompilationUnitRoot(); 523UsingDirectiveSyntax usingAlias = syntaxTree.GetCompilationUnitRoot().Usings.First();
Symbols\TypeTests.cs (1)
1854var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (663)
Diagnostics\LocationsTests.cs (1)
455var token = syntaxTree.GetCompilationUnitRoot().FindToken(sampleProgram.IndexOf("ct", StringComparison.Ordinal));
IncrementalParsing\BinaryExpression.cs (3)
31var type = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 207TypeDeclarationSyntax classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 216var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
IncrementalParsing\ChangingIdentifiers.cs (2)
274TypeDeclarationSyntax classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 282var method = newTree.GetCompilationUnitRoot().Members[0] as MethodDeclarationSyntax;
IncrementalParsing\CompoundAssignment.cs (2)
146var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 156var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
IncrementalParsing\GrammarAmbiguities.cs (3)
91Assert.False(originalTree.GetCompilationUnitRoot().ContainsDiagnostics); 95dynamic r = incrementalTree.GetCompilationUnitRoot(); 103var incrementalRoot = syntaxTree.GetCompilationUnitRoot();
IncrementalParsing\IncrementalParsingTests.cs (104)
505WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 537WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 585WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 846WalkTreeAndVerify(withCloseBraceDeletedTree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 915var fullText = newTree.GetCompilationUnitRoot().ToFullString(); 963var finalString = startTree.GetCompilationUnitRoot().ToFullString(); 967var finalText = newTree.GetCompilationUnitRoot().ToFullString(); 977var finalString = startTree.GetCompilationUnitRoot().ToFullString(); 981var output = newTree.GetCompilationUnitRoot().ToFullString(); 1191Assert.Equal(0, syntaxTree.GetCompilationUnitRoot().Errors().Length); 1211Assert.Equal(0, syntaxTree.GetCompilationUnitRoot().Errors().Length); 1230Assert.Equal(0, syntaxTree.GetCompilationUnitRoot().Errors().Length); 1524Assert.Equal(parsedTree.GetCompilationUnitRoot().ToFullString(), incrementalTree.GetCompilationUnitRoot().ToFullString()); 1664Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count, incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count); 1667for (int i = 0; i < parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count; i++) 1669Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens()[i].Kind(), incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens()[i].Kind()); 1988Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode().ToFullString(), incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode().ToFullString()); 2094Assert.Equal(parsedTree.GetCompilationUnitRoot().ToFullString(), incrementalTree.GetCompilationUnitRoot().ToFullString()); 2443CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2475CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2508CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2559CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2589CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2618CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2722CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2755CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), reparsedTree.GetCompilationUnitRoot()); 2769Assert.Equal(oldText.ToString(), startTree.GetCompilationUnitRoot().ToFullString()); 2907var fullText = fullTree.GetCompilationUnitRoot().ToFullString(); 2908var incText = newTree.GetCompilationUnitRoot().ToFullString(); 2921fullText = fullTree.GetCompilationUnitRoot().ToFullString(); 2922incText = newTree.GetCompilationUnitRoot().ToFullString(); 2992int incCount = currTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count; 2993int fullCount = fullTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count; 2995WalkTreeAndVerify(currTree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3028WalkTreeAndVerify(currTree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3040tree.GetCompilationUnitRoot().Members.First().Green; 3183WalkTreeAndVerify(newTree.GetCompilationUnitRoot(), SyntaxFactory.ParseSyntaxTree(newText).GetCompilationUnitRoot()); 3203WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3224WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3245WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3266WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3287WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3309WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3333WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3357WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3381WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3405WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3429WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3455WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3480WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3506WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3532WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3550WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3568WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3586WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3600WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3614WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3629WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3666WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3717ParentChecker.CheckParents(parsedTree.GetCompilationUnitRoot(), parsedTree); 3718ParentChecker.CheckParents(incrementalTree.GetCompilationUnitRoot(), incrementalTree); 3726Assert.Equal(oldText.ToString(), startTree.GetCompilationUnitRoot().ToFullString());
IncrementalParsing\SyntaxDifferences.cs (2)
26GatherNodes(oldTree.GetCompilationUnitRoot(), hashSet); 29GetRebuiltNodes(newTree.GetCompilationUnitRoot(), hashSet, nodes);
IncrementalParsing\TypeChanges.cs (8)
32var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 47var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 62var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 77var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 92var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 108var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 124var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 140var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax;
IncrementalParsing\UnaryExpression.cs (2)
89var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 99var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
LexicalAndXml\PreprocessorTests.cs (7)
94return SyntaxFactory.ParseSyntaxTree(itext, options).GetCompilationUnitRoot(); 3214TestRoundTripping(tree.GetCompilationUnitRoot(), text, false); 3551TestRoundTripping(tree.GetCompilationUnitRoot(), text, false); 3554VerifyErrorCode(tree.GetCompilationUnitRoot(), (int)ErrorCode.ERR_InvalidMemberDecl); // CS1519 - parser gives Two 3555VerifyDirectivesSpecial(tree.GetCompilationUnitRoot(), new DirectiveInfo { Kind = SyntaxKind.LineDirectiveTrivia, Status = NodeStatus.IsActive, Number = 100, Text = "test.cs" }); 3880var node = tree.GetCompilationUnitRoot(); 4562var root = tree.GetCompilationUnitRoot();
LexicalAndXml\XmlDocCommentTests.cs (310)
78Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 79Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 80var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 98Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 99Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 100var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 115Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 116Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 117var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 130Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 131Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 132var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 146Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 147Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 148Assert.Equal(SyntaxKind.ClassDeclaration, tree.GetCompilationUnitRoot().Members[0].Kind()); 149var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 168Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 169Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 170var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 192Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 193Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 194Assert.Equal(SyntaxKind.ClassDeclaration, tree.GetCompilationUnitRoot().Members[0].Kind()); 195var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 215Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 216Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 217var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 238Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 239Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 240var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 261Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 262Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 263var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 288Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 289Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 290var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 316Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 317Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 318var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 340Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 341Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 342var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 365Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 366Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 367var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 391Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 392Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 393var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 418Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 419Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 420var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 445Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 446Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 447var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 473Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 474Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 475var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 502Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 503Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 504var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 532Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 533Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 534var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 561Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 562Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 563var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 591Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 592Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 593var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 622Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 623Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 624var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 645Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 646Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 647var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 667Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 668Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 669var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 689Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 690Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 691var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 711Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 712Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 713var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 733Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 734Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 735var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 753Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 754Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 755var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 787Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 788Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 789var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 820Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 821Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 822var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 851Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 852Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 853var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 879Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 880Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 881var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 904Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 905Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 906var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 930Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 931Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 932var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 955Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 956Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 957var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 982Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 983Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 984var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1013Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1014Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1015var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1041Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1042Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1043var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1066Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1067Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1068var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1091Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1092Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1093var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1118Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1119Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1120var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1151Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1152Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1153var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1182Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1183Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1184var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1208Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1209Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1210var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1235Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1236Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1237var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1263Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1264Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); 1265var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1288Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1289Assert.Equal(2, tree.GetCompilationUnitRoot().ChildNodesAndTokens().Count); 1290Assert.Equal(SyntaxKind.ClassDeclaration, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].Kind()); 1291var classdecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode(); 1298Assert.Equal(SyntaxKind.EndOfFileToken, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[1].Kind()); 1308Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1309Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1310var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1332Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1333Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1334var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1357Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1358Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1359var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1381Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1382Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1383var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1406Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1407Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1408var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1430Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1431Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1432var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1455Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1456Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1457var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1479Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1480Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1481var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1504Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1505Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1515Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1516Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1526Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1527Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1537Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1538Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1548Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1549Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1559Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1560Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1561var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1587Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1588Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1589var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1615Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1616Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1617var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1641Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1642Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1643var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1672Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1675Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 1678VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError>() { new TestError(1570, true) }); 1689Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1692Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 1695VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError>() { new TestError(1570, true) }); 1708Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1709Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1712var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1747Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1748Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1751var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1787Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1790Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 1793var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1828Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1829Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1832Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1834var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1863Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1864Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1867Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1869var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1898Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1899Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1902Assert.Equal(typeof(PropertyDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1904var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as PropertyDeclarationSyntax).Type; 1933Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1934Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1937Assert.Equal(typeof(IndexerDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1939var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as IndexerDeclarationSyntax).Type; 1968Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1969Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1972Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1975var method = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax; 2005Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2006Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2009Assert.Equal(typeof(ClassDeclarationSyntax), tree.GetCompilationUnitRoot().Members[0].GetType()); 2012var typeParameter = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).TypeParameterList.Parameters.Single(); 2043Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2044Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); // 4 errors because of the incomplete class decl 2047Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 2049var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 2079Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2080Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2082var bracket = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).CloseBraceToken; 2110Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2111Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); // error because of the incomplete class decl 2114var classDecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 2143Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2144Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); // 4 errors because of the incomplete class decl 2147var bracket = tree.GetCompilationUnitRoot().EndOfFileToken; 2173Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2174Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); // 4 errors because of the incomplete class decl 2177var bracket = tree.GetCompilationUnitRoot().EndOfFileToken; 2204Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2205Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2208var bracket = tree.GetCompilationUnitRoot().EndOfFileToken; 2239Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2242Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); 2243VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError>() { new TestError(1035, false) }); 2254Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2255Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2257var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2282Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2283Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2286var eofToken = tree.GetCompilationUnitRoot().EndOfFileToken; 2324Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2325Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2327var eofToken = tree.GetCompilationUnitRoot().EndOfFileToken; 2356Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2359Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 2362var eofToken = tree.GetCompilationUnitRoot().EndOfFileToken; 2380Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2381Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2384var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2410Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2411Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2414var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2439Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2441var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2462Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2465Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 2467var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2489Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2492Assert.Equal(2, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2494var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2514Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2517Assert.Equal(2, tree.GetCompilationUnitRoot().Warnings().Length); 2519var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2539Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2541var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2565Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2567var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2591Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2594Assert.Equal(2, tree.GetCompilationUnitRoot().Warnings().Length); 2606Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2609Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 2620Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2623Assert.Equal(2, tree.GetCompilationUnitRoot().Warnings().Length); 2635Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2637var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2653Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2655var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2676Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2677Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2694Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2695Assert.Equal(4, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2696VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError> 2720Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2721Assert.Equal(4, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2722VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError> 2743Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2745var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2767Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2769var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword;
Parsing\LineSpanDirectiveParsingTests.cs (1)
30var node = ParseTree(text, options).GetCompilationUnitRoot();
Parsing\ParserErrorMessageTests.cs (25)
5440tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5443tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5462tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5465tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5527tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5530tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5546tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5549tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5589tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5592tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5624tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5627tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5658tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5661tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5947tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5965tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5978tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5986tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6007tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6014tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6037tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6050tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6079tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6092tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6366tree.GetCompilationUnitRoot().GetDiagnostics().Verify(
Parsing\ParsingErrorRecoveryTests.cs (9)
7396Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7415Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7449Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7474Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7499Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7525Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7549Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7574Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 7588Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString());
Parsing\ParsingTests.cs (2)
87ParseTree(text, options).GetCompilationUnitRoot(); 158_node = tree.GetCompilationUnitRoot();
Parsing\RoundTrippingTests.cs (9)
29var toText = tree.GetCompilationUnitRoot().ToFullString(); 37Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 41Assert.Equal(errorCount, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 47Assert.Equal(memberCount, tree.GetCompilationUnitRoot().Members.Count); 50ParentChecker.CheckParents(tree.GetCompilationUnitRoot(), tree); 56var toText = tree.GetCompilationUnitRoot().ToFullString(); 59var nodes = tree.GetCompilationUnitRoot().DescendantTokens(tk => tk.FullWidth > 0).ToList(); 104var toText = tree.GetCompilationUnitRoot().ToFullString(); 1583var newTest = tree.GetCompilationUnitRoot().ToFullString();
Parsing\ScriptParsingTests.cs (11)
36var parsedText = parsedTree.GetCompilationUnitRoot(); 191Assert.True(tree.GetCompilationUnitRoot().ContainsDiagnostics); 233Assert.True(tree.GetCompilationUnitRoot().ContainsDiagnostics); 2644Assert.False(tree.GetCompilationUnitRoot().ContainsDiagnostics); 2676Assert.False(tree.GetCompilationUnitRoot().ContainsDiagnostics); 9611Assert.Equal(1, tree.GetCompilationUnitRoot().ChildNodes().Count()); 9612Assert.Equal(SyntaxKind.GlobalStatement, tree.GetCompilationUnitRoot().ChildNodes().ToList()[0].Kind()); 9634var root = tree.GetCompilationUnitRoot(); 9645root = tree.GetCompilationUnitRoot(); 9661root = tree.GetCompilationUnitRoot(); 9708var root = tree.GetCompilationUnitRoot();
Syntax\StructuredTriviaTests.cs (7)
108var compilationUnit = tree.GetCompilationUnitRoot(); 122var compilationUnit = tree.GetCompilationUnitRoot(); 133var compilationUnit = tree.GetCompilationUnitRoot(); 146var compilationUnit = tree.GetCompilationUnitRoot(); 167var trivia = tree.GetCompilationUnitRoot().DescendantTrivia().Single(t => t.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia); 183var trivia = tree.GetCompilationUnitRoot().DescendantTrivia().Single(t => t.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia); 192var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia();
Syntax\SyntaxAnnotationTests.cs (33)
53var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 62var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 63var toNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 72var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 80var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 89var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 90var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 100var toTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 110var fromTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 119var fromTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 120var toTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 135var matchingNodesOrTokens = tree.GetCompilationUnitRoot().GetAnnotatedNodesAndTokens(annotation); 145var matchingTrivia = tree.GetCompilationUnitRoot().GetAnnotatedTrivia(annotation); 161var node = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 165var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(node, annotatedNode); 193var token = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsToken).AsToken(); 197var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(token, annotatedToken); 225var trivia = GetAllTrivia(tree.GetCompilationUnitRoot()).First(); 229var newRoot = tree.GetCompilationUnitRoot().ReplaceTrivia(trivia, annotatedTrivia); 253SyntaxNode newRoot = tree.GetCompilationUnitRoot(); 265TestMultipleAnnotationsInTree(tree.GetCompilationUnitRoot(), newRoot, annotations); 284var firstNode = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 289var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(lastChildOfFirstNode, annotatedNode); 389var sourceTreeRoot = rewriter.Visit(tree1.GetCompilationUnitRoot()); 391var destTreeRoot = CopyAnnotationsTo(sourceTreeRoot, tree2.GetCompilationUnitRoot()); 476var currentRoot = syntaxTree.GetCompilationUnitRoot(); 507var candidatePool = GetAllNodesAndTokens(syntaxTree.GetCompilationUnitRoot()); 518var newRoot = Replace(syntaxTree.GetCompilationUnitRoot(), firstItem, firstAnnotated); 566foreach (var trivia in GetAllTrivia(syntaxTree.GetCompilationUnitRoot())) 570var newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceTrivia(trivia, newTrivia); 580var allNodesAndTokens = GetAllNodesAndTokens(syntaxTree.GetCompilationUnitRoot()); 590newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceToken(nodeOrToken.AsToken(), newToken); 595newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceNode(nodeOrToken.AsNode(), newNode);
Syntax\SyntaxDiffingTests.cs (4)
28Assert.Equal(newTree.GetCompilationUnitRoot().FullSpan, spans[0]); 47var decl = (TypeDeclarationSyntax)(newTree.GetCompilationUnitRoot()).Members[0]; 67var decl1 = (TypeDeclarationSyntax)(newTree.GetCompilationUnitRoot()).Members[0]; 69var decl2 = (TypeDeclarationSyntax)(newTree.GetCompilationUnitRoot()).Members[1];
Syntax\SyntaxNodeTests.cs (106)
535var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); 548var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); 561var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); 578var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); 590var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); 602var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); 615var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); 664var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); 674var token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length); 677token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length, findInsideTrivia: true); 790var trivia = tree.GetCompilationUnitRoot().FindTrivia(position); 802Assert.True(tree.GetCompilationUnitRoot().IsEquivalentTo(tree.GetCompilationUnitRoot())); 810Assert.False(tree.GetCompilationUnitRoot().IsEquivalentTo(null)); 819Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); 820Assert.True(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 828Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); 829Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 837Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); 838Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 846var m1 = ((TypeDeclarationSyntax)tree1.GetCompilationUnitRoot().Members[0]).Members[0]; 847var m2 = ((TypeDeclarationSyntax)tree2.GetCompilationUnitRoot().Members[0]).Members[0]; 859Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 867Assert.True(tree.GetCompilationUnitRoot().IsIncrementallyIdenticalTo(tree.GetCompilationUnitRoot())); 875Assert.True(tree.GetCompilationUnitRoot().EndOfFileToken.IsIncrementallyIdenticalTo(tree.GetCompilationUnitRoot().EndOfFileToken)); 883Assert.False(tree.GetCompilationUnitRoot().GetFirstToken().IsIncrementallyIdenticalTo(tree.GetCompilationUnitRoot().GetFirstToken().GetNextToken())); 892Assert.True(tree1.GetCompilationUnitRoot().GetFirstToken().IsIncrementallyIdenticalTo(tree2.GetCompilationUnitRoot().GetFirstToken())); 901Assert.False(tree1.GetCompilationUnitRoot().IsIncrementallyIdenticalTo(tree2.GetCompilationUnitRoot())); 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())); 932var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 935var triviaAgain = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 945var first = tree.GetCompilationUnitRoot().GetFirstToken(); 953var first = tree.GetCompilationUnitRoot().GetFirstToken(includeZeroWidth: true); 961var last = tree.GetCompilationUnitRoot().GetLastToken(); 969var last = tree.GetCompilationUnitRoot().GetLastToken(includeZeroWidth: true); 972last = tree.GetCompilationUnitRoot().Members[0].GetLastToken(includeZeroWidth: true); 982var root1 = tree1.GetCompilationUnitRoot(); 1005var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1008var token = tree.GetCompilationUnitRoot().GetFirstToken(includeSkipped: true); 1031Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1033var tokens = tree.GetCompilationUnitRoot().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList(); 1038var token = tree.GetCompilationUnitRoot().GetFirstToken(includeSkipped: true); 1059var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1063var token = tree.GetCompilationUnitRoot().GetFirstToken(includeSkipped: false); 1104var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1107var token = tree.GetCompilationUnitRoot().GetLastToken(); // skip EOF 1131Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1133var tokens = tree.GetCompilationUnitRoot().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList(); 1138var token = tree.GetCompilationUnitRoot().GetLastToken(includeSkipped: true); 1161Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1163var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1167var token = tree.GetCompilationUnitRoot().GetLastToken(includeSkipped: false); 1211var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1214var token = tree.GetCompilationUnitRoot().GetFirstToken(includeZeroWidth: true); 1253var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1256var token = tree.GetCompilationUnitRoot().EndOfFileToken.GetPreviousToken(includeZeroWidth: true); 1280SyntaxToken token = syntaxTree.GetCompilationUnitRoot().EndOfFileToken.GetPreviousToken(includeZeroWidth: true); 1300var children = tree.GetCompilationUnitRoot().Members[0].ChildNodesAndTokens().ToList(); 1318var children = tree.GetCompilationUnitRoot().Members[0].ChildNodesAndTokens().ToList(); 1337var child = tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0]; 1338var member = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 1354var trivia = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia()[0]; 1365var trivia = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia()[0]; 1401var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1413var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1430var d1 = tree.GetCompilationUnitRoot().GetFirstDirective(); 1458var d1 = tree.GetCompilationUnitRoot().GetLastDirective(); 1482var c = tree.GetCompilationUnitRoot().Members[0]; 1517var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1548var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1587var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1618var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1652var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1686var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1716var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1739var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1760var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1778var rootNode = tree.GetCompilationUnitRoot(); 1796var rootNode = tree.GetCompilationUnitRoot(); 1807var rootNode = SyntaxFactory.ParseSyntaxTree("using X; namespace Y { }").GetCompilationUnitRoot(); 2025Assert.Equal(SyntaxKind.MethodDeclaration, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].ChildNodesAndTokens()[3].Kind()); 2034var actualTokens = syntaxTree.GetCompilationUnitRoot().DescendantTokens(); 2074dynamic root = tree.GetCompilationUnitRoot(); 3292var root = tree.GetCompilationUnitRoot(); 3377foreach (var t in syntaxTree.GetCompilationUnitRoot().DescendantTokens()) 3403var token = syntaxTree.GetCompilationUnitRoot().FindToken(code.IndexOf("using Lib;", StringComparison.Ordinal)); 3422var trivia = tree.GetCompilationUnitRoot().FindTrivia(code.IndexOf("#r", StringComparison.Ordinal)); // ReferenceDirective. 3437var compilationUnit = tree.GetCompilationUnitRoot(); 3463var compilationUnit = tree.GetCompilationUnitRoot(); 3504var node = SyntaxFactory.ParseSyntaxTree(" ").GetCompilationUnitRoot(); 3833var trivia = tree.GetCompilationUnitRoot().FindTrivia(position);
Syntax\SyntaxNormalizerTests.cs (3)
3723TestNormalize(tree.GetCompilationUnitRoot(), """ 3751TestNormalize(tree.GetCompilationUnitRoot(), 3780TestNormalize(tree.GetCompilationUnitRoot(),
Syntax\SyntaxRewriterTests.cs (9)
337var tokenT = tree.GetCompilationUnitRoot().DescendantTokens().Where(t => t.ToString() == "T").Single(); 338Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceToken(tokenT, tokenT).SyntaxTree); 339var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(tokenT, SyntaxFactory.Identifier("U")); 349var typeName = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.GenericName)).Single(); 350Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceNode(typeName, typeName).SyntaxTree); 351var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(typeName, SyntaxFactory.ParseTypeName("Class2<U>")); 540Assert.NotNull(tree.GetCompilationUnitRoot().SyntaxTree); 542var rewrittenRoot = rewriter.Visit(tree.GetCompilationUnitRoot()); 601var ifStmt1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<IfStatementSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Extensions.cs (1)
54if (TryFindNodeOrToken(syntaxTree.GetCompilationUnitRoot(), kind, ref occurrence, ref foundNode))
SemanticModelTestBase.cs (1)
99var constructorInitializer = GetFirstConstructorInitializer(tree.GetCompilationUnitRoot());
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\OperationTests.cs (1)
277var methodBodySyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Last();
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SyntaxPathTests.cs (1)
92var root = tree.GetCompilationUnitRoot();
Microsoft.DotNet.GenFacades (3)
TypeParser.cs (3)
39CompilationUnitSyntax root = tree.GetCompilationUnitRoot(); 58CompilationUnitSyntax root = tree.GetCompilationUnitRoot(); 72CompilationUnitSyntax root = tree.GetCompilationUnitRoot();