3100 references to GetRoot
IdeCoreBenchmarks (4)
Microsoft.Analyzers.Extra (1)
Microsoft.Analyzers.Extra.Tests (4)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.Http.Extensions.Tests (1)
Microsoft.AspNetCore.Http.Microbenchmarks (1)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
Microsoft.CodeAnalysis (18)
Microsoft.CodeAnalysis.CodeStyle (24)
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.CSharp (42)
Microsoft.CodeAnalysis.CSharp.CodeStyle (16)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (9)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (182)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (28)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (624)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Features (21)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (22)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (85)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1027)
Semantics\GlobalUsingDirectiveTests.cs (46)
3842var ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3844var aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3868ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3870aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3890aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3899ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3901aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3918aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3932ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3934aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3952ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3954aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3968aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3977ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3979aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3990aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4004ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4006aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4024ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4026aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4040aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4049ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4051aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4062aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4076ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4078aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4090ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4092aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4100aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4111ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4113aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4133ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4135aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4149ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4151aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4243var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4251node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4279node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4287node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4295node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4303node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4315node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4979Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString());
4980Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString());
4984Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString());
4985Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString());
Semantics\TopLevelStatementsTests.cs (99)
193var unit1 = (CompilationUnitSyntax)tree1.GetRoot();
249var symbolInfo = model1.GetSymbolInfo(tree1.GetRoot());
253var typeInfo = model1.GetTypeInfo(tree1.GetRoot());
257foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>())
318var unit1 = (CompilationUnitSyntax)tree1.GetRoot();
356var unit2 = (CompilationUnitSyntax)tree2.GetRoot();
400var symbolInfo = model1.GetSymbolInfo(tree1.GetRoot());
404var typeInfo = model1.GetTypeInfo(tree1.GetRoot());
408foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>())
481var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
487Assert.NotNull(model1.GetOperation(tree1.GetRoot()));
492var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single();
500var localRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single();
507Assert.NotNull(model2.GetOperation(tree2.GetRoot()));
533var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
540var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray();
573var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
579Assert.NotNull(model1.GetOperation(tree1.GetRoot()));
584var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single();
591var localRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single();
698var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
699var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "s").Single();
871var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single());
873Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol);
877var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single());
879Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol);
985var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First());
987Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").First()).Symbol);
989var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).Single());
991Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Skip(1).Single()).Symbol);
1040var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First());
1042Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol);
1407var nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1411Assert.Null(model2.GetOperation(tree2.GetRoot()));
1425nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1429Assert.Null(model2.GetOperation(tree2.GetRoot()));
1520var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "c").Single();
1592foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>())
1598foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>())
1685var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
1706var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
1858var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
1881Assert.Null(model2.GetDeclaredSymbol((CompilationUnitSyntax)tree2.GetRoot()));
1882var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2084var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
2100var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2248var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
2266var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2426var labelDecl = tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single();
2446var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2919var nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single();
2924nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2").Single();
2941nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single();
2946nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1").Single();
3941var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray();
4090var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray();
4215var declarator = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
4216var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single();
4229VerifyFlowGraph(comp, tree.GetRoot(),
4510var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single());
4512Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol);
4516var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
4518Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol);
4574var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
4576Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").First()).Symbol);
4578var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First());
4580Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Skip(1).Single()).Symbol);
4623var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
4625Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol);
4893var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single();
4894var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single();
4950var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single());
4952Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol);
4956var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single());
4959Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol);
4978var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single();
4979var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single();
6030var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
6034var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray();
6046localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
6086var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList();
6160.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single())
6232var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
6276var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
6277var localRef = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
6316var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
6317var localRef = syntaxTree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
6366var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
6368var localRef = syntaxTree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
8578var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
8651var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single();
8673var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single();
8695var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single();
8791(CSharpSyntaxNode)oldTree.GetRoot(), new[] { new TextChangeRange(new TextSpan(282, 0), 1) });
8799var nodes1 = tree.GetRoot().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray();
8800var nodes2 = fullParseTree.GetRoot().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray();
9677var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
9681Assert.Equal(OperationKind.Literal, model.GetOperation(tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind);
9702var root = tree.GetRoot();
SourceGeneration\GeneratorDriverTests.cs (7)
1145var rootFromGetRoot = tree.GetRoot();
4306var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator1"); }); }).AsSourceGenerator();
4307var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator2"); }); }).AsSourceGenerator();
4351var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", "//" + c.SyntaxTrees.First().GetRoot().ToFullString() + " generator1"); }); }).AsSourceGenerator();
4352var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", "//" + c.SyntaxTrees.First().GetRoot().ToFullString() + " generator2"); }); }).AsSourceGenerator();
4375var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator1"); }); }).AsSourceGenerator();
4376var generator2 = new PipelineCallbackGenerator2((ctx) => { initWasCalled = true; ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator2"); }); }).AsSourceGenerator();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (362)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (98)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (10)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Workspaces (21)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
Microsoft.CodeAnalysis.EditorFeatures (2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (13)
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Microsoft.CodeAnalysis.Features (18)
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
Microsoft.CodeAnalysis.Features.UnitTests (4)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (3)
Microsoft.CodeAnalysis.Test.Utilities (24)
Diagnostics\CommonDiagnosticAnalyzers.cs (14)
71var location = context.Tree.GetRoot().GetLocation();
106var root = tree.GetRoot();
184var root = tree.GetRoot();
261var root = tree.GetRoot();
314var root = tree.GetRoot();
943_invalidLocation = treeInAnotherCompilation.GetRoot().GetLocation();
1081context.ReportDiagnostic(Diagnostic.Create(Descriptor, tree.GetRoot().GetLocation()));
1107Diagnostic.Create(Descriptor, context.SemanticModel.SyntaxTree.GetRoot().GetLocation())));
1665ReportDiagnosticsCore(addDiagnostic, tree.GetRoot().GetLastToken().GetLocation(), tree.FilePath);
2600var fields = context.Tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.FieldDeclarationSyntax>();
2697context.ReportDiagnostic(Diagnostic.Create(s_descriptor, context.Tree.GetRoot().GetLocation()));
2849var root = tree.GetRoot();
2934context.RegisterSyntaxTreeAction(syntaxContext => HandleCallback(syntaxContext.Tree.GetRoot().GetLocation(), context.Compilation, syntaxContext.ReportDiagnostic, syntaxContext.CancellationToken));
2946context.RegisterSemanticModelAction(context => HandleCallback(context.SemanticModel.SyntaxTree.GetRoot().GetLocation(), context.SemanticModel.Compilation, context.ReportDiagnostic, context.CancellationToken));
Microsoft.CodeAnalysis.UnitTests (3)
Microsoft.CodeAnalysis.VisualBasic (21)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (3)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (4)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
Microsoft.CodeAnalysis.VisualBasic.Features (14)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (15)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (36)
Semantics\Conversions.vb (11)
102Dim [nothing] = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing)
103Dim intZero = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Create(0I), m13p(c))
104Dim longZero = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Create(0L), m13p(d))
271Dim _nothing = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing)
311literal = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), zero, integralType)
338literal = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.WideningNothingLiteral, False, True, zero, convertibleType, Nothing)
369literal = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.WideningNothingLiteral, False, True, zero, type1, Nothing)
627New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing),
751Dim zero = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Default(mv.Type.GetConstantValueTypeDiscriminator()), mv.Type, Nothing)
1121Dim _nothing = New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing)
1188New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing),
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (42)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (32)
109Dim declaratorQ = tree.GetRoot().FindToken(posQ).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
116Dim declaratorX = tree.GetRoot().FindToken(posX).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
123Dim declaratorZ = tree.GetRoot().FindToken(posZ).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
245Dim declaratorW = tree.GetRoot().FindToken(posW).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
250Dim declaratorZF = tree.GetRoot().FindToken(posZF).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
252tree.GetRoot().FindToken(select1).GetLocation,
255tree.GetRoot().FindToken(x2 - 2).GetLocation(),
256tree.GetRoot().FindToken(y4 - 2).GetLocation())
260Dim declaratorZL = tree.GetRoot().FindToken(posZL).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
262tree.GetRoot().FindToken(select2).GetLocation,
265tree.GetRoot().FindToken(x5 - 2).GetLocation(),
266tree.GetRoot().FindToken(y5 - 2).GetLocation())
316Dim declaratorT = tree.GetRoot().FindToken(posT).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
321Dim declaratorA = tree.GetRoot().FindToken(posA).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
323tree.GetRoot().FindToken(sub2).Parent.Parent.GetLocation,
326tree.GetRoot().FindToken(x1 - 2).GetLocation(),
327tree.GetRoot().FindToken(y1 - 2).GetLocation())
331Dim declaratorB = tree.GetRoot().FindToken(posB).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
333tree.GetRoot().FindToken(sub4).Parent.Parent.GetLocation,
336tree.GetRoot().FindToken(x2 - 2).GetLocation(),
337tree.GetRoot().FindToken(y2 - 2).GetLocation())
383Dim declaratorT = tree.GetRoot().FindToken(posT).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
388Dim declaratorA = tree.GetRoot().FindToken(posA).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
390tree.GetRoot().FindToken(sub1).Parent.Parent.GetLocation,
393tree.GetRoot().FindToken(x1 - 2).GetLocation(),
394tree.GetRoot().FindToken(y1 - 2).GetLocation())
398Dim declaratorB = tree.GetRoot().FindToken(posB).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
401tree.GetRoot().FindToken(sub2).Parent.Parent.GetLocation,
404tree.GetRoot().FindToken(x2 - 2).GetLocation(),
405tree.GetRoot().FindToken(y2 - 2).GetLocation())
1982stack.Push(tree.GetRoot())
2058Dim x = tree.GetRoot().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (125)
IncrementalParser\IncrementalParser.vb (23)
85root = tree.GetRoot()
96root = tree.GetRoot()
108Assert.Equal(False, tree.GetRoot().ContainsDiagnostics)
710Dim exp1 = newTree.GetRoot().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1)
711Dim inc1 = incTree.GetRoot().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1)
748Assert.Equal(False, oldTree.GetRoot().ContainsDiagnostics)
749Assert.Equal(False, newTree.GetRoot().ContainsDiagnostics)
750Assert.Equal(False, incTree.GetRoot().ContainsDiagnostics)
774Assert.Equal(False, expectedTree.GetRoot().ContainsDiagnostics)
775Assert.Equal(False, incrementalTree.GetRoot().ContainsDiagnostics)
799Assert.Equal(True, expectedTree.GetRoot().ContainsDiagnostics)
800Assert.Equal(True, incrementalTree.GetRoot().ContainsDiagnostics)
1129Dim children1 = newTree.GetRoot().ChildNodesAndTokens()
1130Dim children2 = fulltree.GetRoot().ChildNodesAndTokens()
1146Assert.Equal(fullTree.GetRoot().ToFullString(), newTree.GetRoot().ToFullString())
1173Assert.Equal(fulltree.GetRoot().ToFullString(), newTree.GetRoot().ToFullString())
1189Assert.Equal(fullTree.GetRoot().ToFullString(), newTree.GetRoot().ToFullString())
1711Dim tempRoot2 = tempTree2.GetRoot()
2577Dim rootA = treeA.GetRoot()
2578Dim rootB = treeB.GetRoot()
Syntax\SyntaxAnnotationTests.vb (33)
46Dim fromNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot()
54Dim fromNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot()
55Dim toNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot()
64Dim toToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First()
71Dim fromToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First()
79Dim fromToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First()
80Dim toToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First()
90Dim toTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault()
99Dim fromTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault()
107Dim fromTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault()
108Dim toTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault()
123Dim matchingNodesOrTokens = tree.GetRoot().GetAnnotatedNodesAndTokens(annotation)
132Dim matchingTrivia = tree.GetRoot().GetAnnotatedTrivia(annotation)
147Dim node = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode()
151Dim newRoot = tree.GetRoot().ReplaceNode(node, annotatedNode)
178Dim token = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsToken).AsToken()
182Dim newRoot = tree.GetRoot().ReplaceToken(token, annotatedToken)
209Dim trivia = GetAllTrivia(tree.GetRoot()).First()
213Dim newRoot = tree.GetRoot().ReplaceTrivia(trivia, annotatedTrivia)
236Dim newRoot = tree.GetRoot()
249TestMultipleAnnotationsInTree(tree.GetRoot(), newRoot, annotations)
266Dim firstNode = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode()
271Dim newRoot = tree.GetRoot().ReplaceNode(lastChildOfFirstNode, annotatedNode)
361Dim sourceTreeRoot = DirectCast(rewriter.Visit(tree1.GetRoot()), VisualBasicSyntaxNode)
363Dim destTreeRoot = CopyAnnotationsTo(sourceTreeRoot, tree2.GetRoot())
438Dim currentRoot = tree.GetRoot()
467Dim candidatePool = GetAllNodesAndTokens(tree.GetRoot())
477Dim newRoot = Replace(tree.GetRoot(), firstItem, firstAnnotated)
519For Each trivia In GetAllTrivia(tree.GetRoot())
522Dim newRoot = tree.GetRoot().ReplaceTrivia(trivia, newTrivia)
531For Each nodeOrToken In GetAllNodesAndTokens(tree.GetRoot())
537newRoot = tree.GetRoot().ReplaceToken(nodeOrToken.AsToken(), newToken)
540newRoot = tree.GetRoot().ReplaceNode(nodeOrToken.AsNode(), newNode)
TestSyntaxNodes.vb (21)
1734Dim node As SyntaxNode = tree.GetRoot()
1736Assert.Equal(0, tree.GetRoot().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count)
1737Assert.Equal(1, tree.GetRoot().FindToken(0).LeadingTrivia.Count)
1764Dim node As SyntaxNode = tree.GetRoot()
1985Dim openParenToken = CType(tree.GetRoot().FindToken(location + "List".Length), SyntaxToken)
2214Dim tokens As List(Of SyntaxToken) = tree.GetRoot().DescendantTokens().ToList()
2216Dim token As SyntaxToken = tree.GetRoot().GetFirstToken()
2231token = tree.GetRoot().GetFirstToken()
2238Dim lastToken = tree.GetRoot().DescendantTokens().Last
2255Dim root = tree.GetRoot()
2352Dim trivia = tree.GetRoot().FindTrivia(position)
2867Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
2913Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
2958For Each node In tree.GetRoot.ChildNodes
3293Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
3367Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
3393Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
3417Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
3438Dim trivia = tree.GetRoot().FindTrivia(4000)
3461Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
3480Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (21)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (16)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (7)
Microsoft.CodeAnalysis.Workspaces (31)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
Microsoft.CodeAnalysis.Workspaces.UnitTests (41)
SolutionTests\SolutionTests.cs (14)
307var root = tree.GetRoot();
2483var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: null, SourceHashAlgorithm.Sha1)).GetRoot();
3188var root = tree.GetRoot();
3196var root2 = tree2.GetRoot();
3402Assert.Equal(text, docTree.GetRoot().ToString());
3423Assert.Equal(text, docTree.GetRoot().ToString());
3432var tree = CSharp.SyntaxFactory.ParseSyntaxTree("public class C {}").GetRoot(CancellationToken.None);
3687var root = tree.GetRoot();
3704var root2 = tree2.GetRoot();
3783Assert.Same(tree2, tree2.GetRoot().SyntaxTree);
3811Assert.Same(tree3, tree3.GetRoot().SyntaxTree);
3818var tree4 = tree.WithRootAndOptions(tree.GetRoot(), newOptions);
3822Assert.Same(tree4, tree4.GetRoot().SyntaxTree);
3829Assert.Same(tree, tree.WithRootAndOptions(tree.GetRoot(), tree.Options));
Microsoft.DotNet.GenFacades (1)
Microsoft.Gen.ContextualOptions.Unit.Tests (4)
Microsoft.Interop.LibraryImportGenerator (1)
Microsoft.ML.CodeGenerator (1)
Microsoft.ML.InternalCodeAnalyzer (2)
Microsoft.VisualStudio.LanguageServices (2)
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Mvc.Api.Analyzers.Test (4)