204 references to SyntaxTree
Microsoft.CodeAnalysis.CSharp (50)
Binder\Binder_Lookup.cs (1)
336bool isSubmissionTree = Compilation.IsSubmissionSyntaxTree(declarationSyntax.SyntaxTree);
Binder\Binder_Statements.cs (1)
3918BinderFactory binderFactory = compilation.GetBinderFactory(containerNode.SyntaxTree);
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
970bool isSubmissionTree = compilation.IsSubmissionSyntaxTree(compilationUnit.SyntaxTree);
Binder\WithExternAndUsingAliasesBinder.cs (1)
180if (declaration.HasGlobalUsings && compilationUnit.SyntaxTree != declaration.SyntaxReference.SyntaxTree)
Compilation\CSharpCompilation.cs (2)
2663return GetBinderFactory(syntax.SyntaxTree).GetBinder(syntax); 2833TryAdd(new ImportInfo(syntax.SyntaxTree, syntax.Kind(), syntax.Span), default);
Compilation\CSharpSemanticModel.cs (2)
1389if (this.Compilation.ContainsSyntaxTree(syntax.SyntaxTree)) 5445var syntaxTree = (CSharpSyntaxTree)Root.SyntaxTree;
Compilation\MemberSemanticModel.cs (2)
1153return _root.SyntaxTree; 2476if (node.SyntaxTree == _semanticModel.SyntaxTree)
Compilation\SpeculativeSyntaxTreeSemanticModel.cs (1)
50: base(parentSemanticModel.Compilation, parentSemanticModel.SyntaxTree, root.SyntaxTree, parentSemanticModel.Options)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (3)
104Debug.Assert(sourceIncludeElementNodes.All(syntax => syntax.SyntaxTree.Options.DocumentationMode < DocumentationMode.Diagnose), 271bool diagnose = originatingSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics(); 539Binder binder = MakeNameBinder(isParameter, isTypeParameterRef, _memberSymbol, _compilation, originatingSyntax.SyntaxTree);
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
35if (syntaxNode.SyntaxTree.Options.DocumentationMode < DocumentationMode.Parse)
Parser\Blender.cs (1)
151var column = oldTree.SyntaxTree.GetLineSpan(new TextSpan(start, 0)).Span.Start.Character;
Symbols\LexicalSortKey.cs (1)
83: this(node.SyntaxTree, node.SpanStart, compilation)
Symbols\NamespaceOrTypeSymbol.cs (1)
228if (loc.IsInSource && loc.SourceTree == syntax.SyntaxTree && syntax.Span.Contains(loc.SourceSpan))
Symbols\Source\ModifierUtils.cs (1)
124if (MessageID.IDS_FeatureRefFields.GetFeatureAvailabilityDiagnosticInfo((CSharpParseOptions)syntax.SyntaxTree.Options) is { } diagnosticInfo)
Symbols\Source\SourceConstructorSymbolBase.cs (3)
37var binderFactory = this.DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree); 184if (tree == ctorSyntax.SyntaxTree) 203if (tree == ctorInitializer?.SyntaxTree)
Symbols\Source\SourceMemberContainerSymbol.cs (1)
4540Debug.Assert(node.SyntaxTree == initializers.Last().Syntax.SyntaxTree);
Symbols\Source\SourceMemberMethodSymbol.cs (2)
773Binder result = (binderFactoryOpt ?? this.DeclaringCompilation.GetBinderFactory(contextNode.SyntaxTree)).GetBinder(contextNode); 1092Debug.Assert(this.SyntaxNode.SyntaxTree == localTree);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (4)
74if (declarationSyntaxRef.SyntaxTree != declarationSyntax.SyntaxTree) 765declarationBinder ??= compilation.GetBinderFactory(declarationSyntax.SyntaxTree).GetBinder(usingDirective.NamespaceOrType).WithAdditionalFlags(flags); 779diagnostics.Add(!globalUsingNamespacesOrTypes.IsEmpty && getOrCreateUniqueGlobalUsingsNotInTree(ref uniqueGlobalUsings, globalUsingNamespacesOrTypes, declarationSyntax.SyntaxTree).Contains(imported) ? 805diagnostics.Add(!globalUsingNamespacesOrTypes.IsEmpty && getOrCreateUniqueGlobalUsingsNotInTree(ref uniqueGlobalUsings, globalUsingNamespacesOrTypes, declarationSyntax.SyntaxTree).Contains(imported) ?
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
408var binderFactory = compilation.GetBinderFactory(syntax.SyntaxTree);
Symbols\Symbol_Attributes.cs (1)
696var parseOptions = (CSharpParseOptions)targetOpt.SyntaxTree.Options;
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
99if (entryPoint.SyntaxTree == compilationUnit.SyntaxTree && entryPoint.SyntaxNode == compilationUnit) 222Binder result = new BuckStopsHereBinder(compilation, FileIdentifier.Create(syntaxNode.SyntaxTree, compilation.Options.SourceReferenceResolver));
Syntax\CSharpSyntaxNode.cs (16)
41/// Returns a non-null <see cref="SyntaxTree"/> that owns this node. 42/// If this node was created with an explicit non-null <see cref="SyntaxTree"/>, returns that tree. 43/// Otherwise, if this node has a non-null parent, then returns the parent's <see cref="SyntaxTree"/>. 44/// Otherwise, returns a newly created <see cref="SyntaxTree"/> rooted at this node, preserving this node's reference identity. 205return this.SyntaxTree.GetReference(this); 215return this.SyntaxTree.GetDiagnostics(this); 458return this.SyntaxTree; 470return SyntaxReplacer.Replace(this, nodes, computeReplacementNode, tokens, computeReplacementToken, trivia, computeReplacementTrivia).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 475return SyntaxReplacer.ReplaceNodeInList(this, originalNode, replacementNodes).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 480return SyntaxReplacer.InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 485return SyntaxReplacer.ReplaceTokenInList(this, originalToken, newTokens).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 490return SyntaxReplacer.InsertTokenInList(this, originalToken, newTokens, insertBefore).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 495return SyntaxReplacer.ReplaceTriviaInList(this, originalTrivia, newTrivia).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 500return SyntaxReplacer.InsertTriviaInList(this, originalTrivia, newTrivia, insertBefore).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 505return SyntaxNodeRemover.RemoveNodes(this, nodes.Cast<CSharpSyntaxNode>(), options).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree); 510return SyntaxNormalizer.Normalize(this, indentation, eol, elasticTrivia).AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree);
Syntax\CSharpSyntaxTree.cs (1)
391/// <para>NOTE: This method is only intended to be used from <see cref="CSharpSyntaxNode.SyntaxTree"/> property and <c>SyntaxFactory.Parse*</c> methods.</para>
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
SymbolKey\SymbolKeyTestBase.cs (1)
283var model = _compilation.GetSemanticModel(declarator.SyntaxTree);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
PDB\PDBTests.cs (2)
135").SyntaxTree; 138").SyntaxTree;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (50)
FirstClassSpanTests.cs (1)
8876var model = comp.GetSemanticModel(invocation.SyntaxTree);
Semantics\OutVarTests.cs (18)
3467tree = initializer.SyntaxTree; 3508tree = initializer.SyntaxTree; 4007tree = statement.SyntaxTree; 5113tree = statement.SyntaxTree; 8807tree = statement.SyntaxTree; 9646tree = statement.SyntaxTree; 10214tree = statement.SyntaxTree; 10863tree = statement.SyntaxTree; 13343tree = statement.SyntaxTree; 13742tree = statement.SyntaxTree; 15263tree = statement.SyntaxTree; 16541tree = statement.SyntaxTree; 17100tree = statement.SyntaxTree; 17536tree = statement.SyntaxTree; 21302tree = statement.SyntaxTree; 32511var tree = node1.SyntaxTree; 34339syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 34553syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Semantics\PatternMatchingTests_Scope.cs (13)
412tree = statement.SyntaxTree; 717tree = statement.SyntaxTree; 986tree = statement.SyntaxTree; 1290tree = statement.SyntaxTree; 5346tree = statement.SyntaxTree; 6476tree = statement.SyntaxTree; 6887tree = statement.SyntaxTree; 7216tree = statement.SyntaxTree; 7539tree = statement.SyntaxTree; 9645tree = statement.SyntaxTree; 10208tree = statement.SyntaxTree; 10724tree = statement.SyntaxTree; 12149tree = statement.SyntaxTree;
Semantics\PrimaryConstructorTests.cs (11)
2187var xxDecl = OutVarTests.GetOutVarDeclaration(speculativePrimaryInitializer.SyntaxTree, "xx"); 2188var xxRef = OutVarTests.GetReferences(speculativePrimaryInitializer.SyntaxTree, "xx").ToArray(); 3803Assert.Same(literal.SyntaxTree, context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree); 3829Assert.Same(equalsValue.SyntaxTree, context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree); 3847Assert.Same(initializer.SyntaxTree, context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree); 3878Assert.Same(baseType.SyntaxTree, context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree); 3905Assert.Same(@class.SyntaxTree, context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree); 5292Assert.Same(literal.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 5310Assert.Same(equalsValue.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 5328Assert.Same(initializer.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 5357Assert.Same(record.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree);
Semantics\RecordTests.cs (7)
22403var xxDecl = OutVarTests.GetOutVarDeclaration(speculativePrimaryInitializer.SyntaxTree, "xx"); 22404var xxRef = OutVarTests.GetReferences(speculativePrimaryInitializer.SyntaxTree, "xx").ToArray(); 26347Assert.Same(literal.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 26373Assert.Same(equalsValue.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 26391Assert.Same(initializer.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 26422Assert.Same(baseType.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 26445Assert.Same(record.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (4)
IOperation\IOperationTests_IVariableDeclaration.cs (4)
1218syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2304syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2365syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2833syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (22)
Semantics\ReadOnlyStructsTests.cs (1)
1267var semanticModel = comp.GetSemanticModel(testMethodSyntax.SyntaxTree);
Semantics\RecordStructTests.cs (4)
6062Assert.Same(literal.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 6080Assert.Same(equalsValue.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 6098Assert.Same(initializer.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree); 6127Assert.Same(record.SyntaxTree, context.ContainingSymbol!.DeclaringSyntaxReferences.Single().SyntaxTree);
Semantics\ScriptSemanticsTests.cs (3)
1180var syntaxTree = compilationUnit.SyntaxTree; 1268var syntaxTree1 = compilationUnit.SyntaxTree; 1307var syntaxTree = compilationUnit.SyntaxTree;
Semantics\SyntaxTreeRootTests.cs (5)
84var tree = node.SyntaxTree; 85Assert.Equal(tree, node.SyntaxTree); 93var childTree = node.Operand.SyntaxTree; 94var parentTree = node.SyntaxTree; 103Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SyntaxTree);
Semantics\TopLevelStatementsTests.cs (1)
6510Assert.Same(globalStatement.SyntaxTree, context.ContainingSymbol.DeclaringSyntaxReferences.Single().SyntaxTree);
SourceGeneration\GeneratorDriverTests.cs (1)
2720Assert.True(compilation.SyntaxTrees.Contains(node.SyntaxTree));
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (7)
192step => Assert.True(step.Outputs.Single().Value is CompilationUnitSyntax c && c.SyntaxTree == compilation.SyntaxTrees.Single())); 222step => Assert.True(step.Outputs.Single().Value is CompilationUnitSyntax c && c.SyntaxTree == compilation.SyntaxTrees.Single())); 249step => Assert.True(step.Outputs.Single().Value is CompilationUnitSyntax c && c.SyntaxTree == compilation.SyntaxTrees.First())); 276step => Assert.True(step.Outputs.Single().Value is CompilationUnitSyntax c && c.SyntaxTree == compilation.SyntaxTrees.Last())); 304step => Assert.True(step.Outputs.Single().Value is CompilationUnitSyntax c && c.SyntaxTree == compilation.SyntaxTrees.First()), 305step => Assert.True(step.Outputs.Single().Value is CompilationUnitSyntax c && c.SyntaxTree == compilation.SyntaxTrees.Last())); 1594steps.Select(s => ((ClassDeclarationSyntax)s.Outputs.Single().Value).SyntaxTree),
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (13)
Compilation\CompilationAPITests.cs (1)
786SyntaxTree withExpressionRootTree = SyntaxFactory.ParseExpression(s3).SyntaxTree;
DocumentationComments\CrefTests.cs (12)
2014var model = compilation.GetSemanticModel(crefSyntax.SyntaxTree); 2053var model = compilation.GetSemanticModel(crefSyntax.SyntaxTree); 2107var model = compilation.GetSemanticModel(crefSyntax.SyntaxTree); 5850var model = compilation.GetSemanticModel(cref.SyntaxTree); 5899var model = compilation.GetSemanticModel(cref.SyntaxTree); 5923var model = compilation.GetSemanticModel(cref.SyntaxTree); 5947var model = compilation.GetSemanticModel(cref.SyntaxTree); 5972var model = compilation.GetSemanticModel(cref.SyntaxTree); 5996var model = compilation.GetSemanticModel(cref.SyntaxTree); 6024var model = compilation.GetSemanticModel(cref.SyntaxTree); 6046var model = compilation.GetSemanticModel(typeParameterSyntax.SyntaxTree); 6070var model = compilation.GetSemanticModel(methodNameSyntax.SyntaxTree);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (60)
Parsing\LocalFunctionParsingTests.cs (6)
1182file.SyntaxTree.GetDiagnostics().Verify(); 1247file.SyntaxTree.GetDiagnostics().Verify( 1291file.SyntaxTree.GetDiagnostics().Verify(); 1293Assert.Equal(0, file.SyntaxTree.Options.Features.Count); 1345Assert.Equal(0, file.SyntaxTree.Options.Features.Count); 1706file.SyntaxTree.GetDiagnostics().Verify();
Syntax\SyntaxFactoryTests.cs (11)
53var text = SyntaxFactory.CompilationUnit().SyntaxTree.GetText(); 688Assert.Same(parseOptions, argList.SyntaxTree.Options); 691Assert.Same(parseOptions, attrArgList.SyntaxTree.Options); 694Assert.Same(parseOptions, bracketedArgList.SyntaxTree.Options); 697Assert.Same(parseOptions, bracketedParamList.SyntaxTree.Options); 700Assert.Same(parseOptions, compUnit.SyntaxTree.Options); 703Assert.Same(parseOptions, expr.SyntaxTree.Options); 706Assert.Same(parseOptions, memberDecl.SyntaxTree.Options); 709Assert.Same(parseOptions, paramList.SyntaxTree.Options); 712Assert.Same(parseOptions, statement.SyntaxTree.Options); 715Assert.Same(parseOptions, typeName.SyntaxTree.Options);
Syntax\SyntaxNodeTests.cs (12)
3656var ChangesForDifferentTrees = FirstUsingClause.SyntaxTree.GetChanges(SecondUsingClause.SyntaxTree); 3667var ChangesFromTransform = ThirdUsingClause.SyntaxTree.GetChanges(newUsingClause.SyntaxTree); 3671SyntaxTree x = ThirdUsingClause.SyntaxTree; 3672SyntaxTree y = newUsingClause.SyntaxTree; 3706var ChangesForDifferentTrees = FirstUsingClause.SyntaxTree.GetChanges(SecondUsingClause.SyntaxTree); 3711Assert.Throws<ArgumentNullException>(() => FirstUsingClause.SyntaxTree.GetChanges(BlankTree)); 3739var ChangesForDifferentTrees = FirstUsingClause.SyntaxTree.GetChangedSpans(SecondUsingClause.SyntaxTree); 3744Assert.Throws<ArgumentNullException>(() => FirstUsingClause.SyntaxTree.GetChangedSpans(BlankTree));
Syntax\SyntaxRewriterTests.cs (30)
315Assert.NotNull(node.SyntaxTree); 316Assert.False(node.SyntaxTree.HasCompilationUnitRoot, "how did we get a CompilationUnit root?"); 317Assert.Same(node, node.SyntaxTree.GetRoot()); 324Assert.NotNull(node1.SyntaxTree); 325Assert.True(node1.SyntaxTree.HasCompilationUnitRoot, "how did we get a non-CompilationUnit root?"); 326Assert.Same(node1, node1.SyntaxTree.GetRoot()); 328Assert.NotNull(node2.SyntaxTree); 329Assert.False(node2.SyntaxTree.HasCompilationUnitRoot, "how did we get a CompilationUnit root?"); 330Assert.Same(node2, node2.SyntaxTree.GetRoot()); 338Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceToken(tokenT, tokenT).SyntaxTree); 340Assert.NotNull(newRoot.SyntaxTree); 341Assert.True(newRoot.SyntaxTree.HasCompilationUnitRoot, "how did we get a non-CompilationUnit root?"); 342Assert.Same(newRoot, newRoot.SyntaxTree.GetRoot()); 350Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceNode(typeName, typeName).SyntaxTree); 352Assert.NotNull(newRoot.SyntaxTree); 353Assert.True(newRoot.SyntaxTree.HasCompilationUnitRoot, "how did we get a non-CompilationUnit root?"); 354Assert.Same(newRoot, newRoot.SyntaxTree.GetRoot()); 406var newTree = newNode.SyntaxTree; 413var newTree2 = newNode2.SyntaxTree; 540Assert.NotNull(tree.GetCompilationUnitRoot().SyntaxTree); 558Assert.NotNull(expr1.SyntaxTree); 559Assert.False(expr1.SyntaxTree.HasCompilationUnitRoot, "how did we get a CompilationUnit root?"); 560Assert.Same(ifStmt1, expr1.SyntaxTree.GetRoot()); 576Assert.NotNull(expr2.SyntaxTree); 577Assert.False(expr2.SyntaxTree.HasCompilationUnitRoot, "how did we get a CompilationUnit root?"); 578Assert.Same(ifStmt2, expr2.SyntaxTree.GetRoot()); 606Assert.Equal(tree1, expr1.SyntaxTree); 622Assert.NotNull(expr2.SyntaxTree); 623Assert.False(expr2.SyntaxTree.HasCompilationUnitRoot, "how did we get a CompilationUnit root?"); 624Assert.Same(ifStmt2, expr2.SyntaxTree.GetRoot());
Syntax\SyntaxTreeTests.cs (1)
88SyntaxTreeFactoryKind.SynthesizedSyntaxTree => SyntaxNode.CloneNodeAsRoot(root, syntaxTree: null).SyntaxTree,
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
2407var binderFactory = compilation.GetBinderFactory(crefSyntax.SyntaxTree);
Microsoft.CodeAnalysis.Features.UnitTests (1)
EditAndContinue\RudeEditDiagnosticTests.cs (1)
22var tree = SyntaxFactory.ParseCompilationUnit("class C { }").SyntaxTree;