src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (13)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken)
36public static bool IsScript(this SyntaxTree syntaxTree)
44this SyntaxTree syntaxTree,
54this SyntaxTree syntaxTree,
63this SyntaxTree syntaxTree,
96public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken)
121public static bool IsBeforeFirstToken(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
130this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
169this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken, bool findInsideTrivia = false)
202this SyntaxTree syntaxTree,
217this SyntaxTree syntaxTree,
228public static bool IsGeneratedCode(this SyntaxTree syntaxTree, AnalyzerOptions? analyzerOptions, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
250public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (4)
44SyntaxTree tree, SyntaxToken token, int position, CancellationToken cancellationToken)
70public int? FromAlignTokensOperations(SyntaxTree tree, SyntaxToken token)
90SyntaxTree tree, SyntaxToken token, int position, CancellationToken cancellationToken)
96SyntaxTree tree, SyntaxToken token, int position, int extraSpaces, CancellationToken cancellationToken)
Binder\Binder_Symbols.cs (3)
2744internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, BindingDiagnosticBag diagnostics, Location location)
2753private static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, Location location)
2759private static bool CheckFeatureAvailability<TData>(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, TData data, Func<TData, Location> getLocation, bool forceWarning = false)
Compilation\CSharpCompilation.cs (84)
137private HashSet<SyntaxTree>? _lazyCompilationUnitCompletedTrees;
143private ImmutableHashSet<SyntaxTree>? _usageOfUsingsRecordedInTrees = ImmutableHashSet<SyntaxTree>.Empty;
145internal ImmutableHashSet<SyntaxTree>? UsageOfUsingsRecordedInTrees => Volatile.Read(ref _usageOfUsingsRecordedInTrees);
154private ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> _mappedPathToSyntaxTree;
158private ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> _pathToSyntaxTree;
161private ImmutableSegmentedDictionary<ReadOnlyMemory<byte>, OneOrMany<SyntaxTree>> _contentHashToSyntaxTree;
358IEnumerable<SyntaxTree>? syntaxTrees = null,
378SyntaxTree? syntaxTree = null,
391(syntaxTree != null) ? new[] { syntaxTree } : SpecializedCollections.EmptyEnumerable<SyntaxTree>(),
402IEnumerable<SyntaxTree>? syntaxTrees,
434ImmutableArray<SyntaxTree>.Empty,
534private static LanguageVersion CommonLanguageVersion(ImmutableArray<SyntaxTree> syntaxTrees)
537foreach (var tree in syntaxTrees)
820public new ImmutableArray<SyntaxTree> SyntaxTrees
828public new bool ContainsSyntaxTree(SyntaxTree? syntaxTree)
836public new CSharpCompilation AddSyntaxTrees(params SyntaxTree[] trees)
838return AddSyntaxTrees((IEnumerable<SyntaxTree>)trees);
844public new CSharpCompilation AddSyntaxTrees(IEnumerable<SyntaxTree> trees)
860var externalSyntaxTrees = PooledHashSet<SyntaxTree>.GetInstance();
908public new CSharpCompilation RemoveSyntaxTrees(params SyntaxTree[] trees)
910return RemoveSyntaxTrees((IEnumerable<SyntaxTree>)trees);
917public new CSharpCompilation RemoveSyntaxTrees(IEnumerable<SyntaxTree> trees)
929var removeSet = PooledHashSet<SyntaxTree>.GetInstance();
934var externalSyntaxTrees = PooledHashSet<SyntaxTree>.GetInstance();
976syntaxAndDeclarations: syntaxAndDeclarations.WithExternalSyntaxTrees(ImmutableArray<SyntaxTree>.Empty));
982public new CSharpCompilation ReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree? newTree)
1036internal override int GetSyntaxTreeOrdinal(SyntaxTree tree)
1051internal OneOrMany<SyntaxTree> GetSyntaxTreesByMappedPath(string mappedPath)
1066return mappedPathToSyntaxTree.TryGetValue(mappedPath, out var value) ? value : OneOrMany<SyntaxTree>.Empty;
1068ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> computeMappedPathToSyntaxTree()
1070var builder = ImmutableSegmentedDictionary.CreateBuilder<string, OneOrMany<SyntaxTree>>();
1072foreach (var tree in SyntaxTrees)
1081internal OneOrMany<SyntaxTree> GetSyntaxTreesByContentHash(ReadOnlyMemory<byte> contentHash)
1092return contentHashToSyntaxTree.TryGetValue(contentHash, out var value) ? value : OneOrMany<SyntaxTree>.Empty;
1094ImmutableSegmentedDictionary<ReadOnlyMemory<byte>, OneOrMany<SyntaxTree>> computeHashToSyntaxTree()
1096var builder = ImmutableSegmentedDictionary.CreateBuilder<ReadOnlyMemory<byte>, OneOrMany<SyntaxTree>>(ContentHashComparer.Instance);
1097foreach (var tree in SyntaxTrees)
1107internal OneOrMany<SyntaxTree> GetSyntaxTreesByPath(string path)
1119return pathToSyntaxTree.TryGetValue(path, out var value) ? value : OneOrMany<SyntaxTree>.Empty;
1121ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> computePathToSyntaxTree()
1123var builder = ImmutableSegmentedDictionary.CreateBuilder<string, OneOrMany<SyntaxTree>>();
1124foreach (var tree in SyntaxTrees)
1557internal bool IsSubmissionSyntaxTree(SyntaxTree tree)
2505public new SemanticModel GetSemanticModel(SyntaxTree syntaxTree, bool ignoreAccessibility)
2514public new SemanticModel GetSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
2537internal override SemanticModel CreateSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
2551internal BinderFactory GetBinderFactory(SyntaxTree syntaxTree, bool ignoreAccessibility = false)
2561private BinderFactory GetBinderFactory(SyntaxTree syntaxTree, bool ignoreAccessibility, ref WeakReference<BinderFactory>[]? cachedBinderFactories)
2583private BinderFactory AddNewFactory(SyntaxTree syntaxTree, bool ignoreAccessibility, [NotNull] ref WeakReference<BinderFactory>? slot)
2615private void CompleteTree(SyntaxTree tree)
2617if (_lazyCompilationUnitCompletedTrees == null) Interlocked.CompareExchange(ref _lazyCompilationUnitCompletedTrees, new HashSet<SyntaxTree>(), null);
2644private void ReportUnusedImports(SyntaxTree? filterTree, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
2660SyntaxTree infoTree = info.Tree;
2737internal override void CompleteTrees(SyntaxTree? filterTree)
2750foreach (var tree in this.SyntaxTrees)
2788public readonly SyntaxTree Tree;
2792public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span)
2953var syntaxTree = syntaxTrees[i];
2961foreach (var syntaxTree in syntaxTrees)
2972foreach (var syntaxTree in syntaxTrees)
3025private static void AppendLoadDirectiveDiagnostics(DiagnosticBag builder, SyntaxAndDeclarationManager syntaxAndDeclarations, SyntaxTree syntaxTree, Func<IEnumerable<Diagnostic>, IEnumerable<Diagnostic>>? locationFilterOpt = null)
3071private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span)
3087private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken)
3140foreach (var otherTree in SyntaxTrees)
3168void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken)
3183void registeredUsageOfUsingsInTree(SyntaxTree tree)
3219private ReadOnlyBindingDiagnostic<AssemblySymbol> GetSourceDeclarationDiagnostics(SyntaxTree? syntaxTree = null, TextSpan? filterSpanWithinTree = null, Func<IEnumerable<Diagnostic>, SyntaxTree, TextSpan?, IEnumerable<Diagnostic>>? locationFilterOpt = null, Predicate<Symbol>? symbolFilter = null, CancellationToken cancellationToken = default)
3268private ReadOnlyBindingDiagnostic<AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken)
3291private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree)
3304SyntaxTree syntaxTree,
3571public bool CheckDuplicateFilePathsAndFree(ImmutableArray<SyntaxTree> syntaxTrees, NamespaceSymbol globalNamespace)
3574foreach (var tree in syntaxTrees)
3805SyntaxTree tree,
3904foreach (var syntaxTree in this.SyntaxTrees)
3946protected override SemanticModel CommonGetSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
3951protected internal override ImmutableArray<SyntaxTree> CommonSyntaxTrees
3959protected override Compilation CommonAddSyntaxTrees(IEnumerable<SyntaxTree> trees)
3964protected override Compilation CommonRemoveSyntaxTrees(IEnumerable<SyntaxTree> trees)
3974protected override Compilation CommonReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree? newTree)
3989protected override bool CommonContainsSyntaxTree(SyntaxTree? syntaxTree)
Compilation\SyntaxAndDeclarationManager.cs (72)
28ImmutableArray<SyntaxTree> externalSyntaxTrees,
50ImmutableArray<SyntaxTree> externalSyntaxTrees,
56var treesBuilder = ArrayBuilder<SyntaxTree>.GetInstance();
57var ordinalMapBuilder = PooledDictionary<SyntaxTree, int>.GetInstance();
58var loadDirectiveMapBuilder = PooledDictionary<SyntaxTree, ImmutableArray<LoadDirective>>.GetInstance();
59var loadedSyntaxTreeMapBuilder = PooledDictionary<string, SyntaxTree>.GetInstance();
60var declMapBuilder = PooledDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>>.GetInstance();
61var lastComputedMemberNamesMap = PooledDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>>.GetInstance();
64foreach (var tree in externalSyntaxTrees)
91public SyntaxAndDeclarationManager AddSyntaxTrees(IEnumerable<SyntaxTree> trees)
112var treesBuilder = ArrayBuilder<SyntaxTree>.GetInstance();
115foreach (var tree in trees)
154ArrayBuilder<SyntaxTree> treesBuilder,
155SyntaxTree tree,
160IDictionary<SyntaxTree, int> ordinalMapBuilder,
161IDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMapBuilder,
162IDictionary<string, SyntaxTree> loadedSyntaxTreeMapBuilder,
163IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMapBuilder,
164IDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNamesMap,
189ArrayBuilder<SyntaxTree> treesBuilder,
190SyntaxTree tree,
195IDictionary<SyntaxTree, int> ordinalMapBuilder,
196IDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMapBuilder,
197IDictionary<string, SyntaxTree> loadedSyntaxTreeMapBuilder,
198IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMapBuilder,
199IDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNamesMap,
241var loadedTree = SyntaxFactory.ParseSyntaxTree(
292SyntaxTree tree,
295IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMapBuilder,
304public SyntaxAndDeclarationManager RemoveSyntaxTrees(HashSet<SyntaxTree> trees)
316var removeSet = PooledHashSet<SyntaxTree>.GetInstance();
317foreach (var tree in trees)
333var treesBuilder = ArrayBuilder<SyntaxTree>.GetInstance();
334var ordinalMapBuilder = PooledDictionary<SyntaxTree, int>.GetInstance();
338foreach (var tree in syntaxTrees)
383SyntaxTree oldTree,
385ImmutableArray<SyntaxTree> syntaxTrees,
386ImmutableDictionary<SyntaxTree, int> syntaxTreeOrdinalMap,
387ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
388ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap,
389HashSet<SyntaxTree> removeSet,
414var tree = syntaxTrees[i];
421SyntaxTree loadedTree;
434ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
435ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap,
436HashSet<SyntaxTree> removeSet)
442SyntaxTree loadedTree;
457SyntaxTree tree,
458IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMap,
466public SyntaxAndDeclarationManager ReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree newTree)
481var removeSet = PooledHashSet<SyntaxTree>.GetInstance();
514ImmutableArray<SyntaxTree> newTrees;
523var treesBuilder = ArrayBuilder<SyntaxTree>.GetInstance();
524var ordinalMapBuilder = PooledDictionary<SyntaxTree, int>.GetInstance();
527var tree = syntaxTrees[i];
548var tree = syntaxTrees[i];
606SyntaxTree oldTree,
607ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>>.Builder declMapBuilder,
608ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>>.Builder lastComputedMemberNamesMap)
663internal SyntaxAndDeclarationManager WithExternalSyntaxTrees(ImmutableArray<SyntaxTree> trees)
668internal static bool IsLoadedSyntaxTree(SyntaxTree tree, ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap)
670SyntaxTree loadedTree;
675ArrayBuilder<SyntaxTree> treesBuilder,
676SyntaxTree tree,
677IDictionary<SyntaxTree, int> ordinalMapBuilder,
678ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
679ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap)
697SyntaxTree loadedTree;
728private static bool TryGetLoadedSyntaxTree(ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap, LoadDirective directive, out SyntaxTree loadedTree)
Compilation\SyntaxAndDeclarationManager.LazyState.cs (13)
20internal readonly ImmutableArray<SyntaxTree> SyntaxTrees; // In ordinal order.
21internal readonly ImmutableDictionary<SyntaxTree, int> OrdinalMap; // Inverse of syntaxTrees array (i.e. maps tree to index)
22internal readonly ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> LoadDirectiveMap;
23internal readonly ImmutableDictionary<string, SyntaxTree> LoadedSyntaxTreeMap;
24internal readonly ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> RootNamespaces;
43internal readonly ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> LastComputedMemberNames;
47ImmutableArray<SyntaxTree> syntaxTrees,
48ImmutableDictionary<SyntaxTree, int> syntaxTreeOrdinalMap,
49ImmutableDictionary<SyntaxTree, ImmutableArray<LoadDirective>> loadDirectiveMap,
50ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap,
51ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> rootNamespaces,
52ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNames,
56Debug.Assert(syntaxTrees.SetEquals(rootNamespaces.Keys.AsImmutable(), EqualityComparer<SyntaxTree>.Default));
Symbols\Source\SourceMemberContainerSymbol.cs (8)
862private SyntaxTree? AssociatedSyntaxTree => IsFileLocal ? declaration.Declarations[0].Location.SourceTree : null;
868if (AssociatedSyntaxTree is not SyntaxTree syntaxTree)
1011public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken)
1093internal int CalculateSyntaxOffsetInSynthesizedConstructor(int position, SyntaxTree tree, bool isStatic)
1136internal bool TryCalculateSyntaxOffsetOfPositionInInitializer(int position, SyntaxTree tree, bool isStatic, int ctorInitializerLength, out int syntaxOffset)
1167static bool findInitializer(ImmutableArray<ImmutableArray<FieldOrPropertyInitializer>> initializers, int position, SyntaxTree tree,
1321var conflictDict = new Dictionary<(string name, int arity, SyntaxTree? syntaxTree), SourceNamedTypeSymbol>();
1879var tree = declaration.Declarations[0].SyntaxReference.SyntaxTree;
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
47var tree = context.Tree;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (29)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
21this SyntaxTree syntaxTree,
42this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
48this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
54this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
80this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
92public static bool IsRightOfDotOrArrowOrColonColon(this SyntaxTree syntaxTree, int position, SyntaxToken targetToken, CancellationToken cancellationToken)
99public static bool IsRightOfDotOrArrow(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
102public static bool IsRightOfDot(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken)
119public static bool IsRightOfNumericLiteral(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken)
133public static bool IsEntirelyWithinNonUserCodeComment(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
145public static bool IsEntirelyWithinComment(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
155public static bool IsCrefContext(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
168public static bool IsEntirelyWithinCrefSyntax(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
180this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
224this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
242this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
259this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
273this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
297this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
382this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
389public static bool IsEntirelyWithinStringLiteral(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
393this SyntaxTree syntaxTree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken)
442this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
470this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
532public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
540public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, SyntaxToken preProcessorTokenOnLeftOfPosition)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
47var tree = context.Tree;
EditAndContinue\ActiveStatementsMap.cs (4)
45private ImmutableDictionary<SyntaxTree, ImmutableArray<UnmappedActiveStatement>> _lazyOldDocumentActiveStatements;
56_lazyOldDocumentActiveStatements = ImmutableDictionary<SyntaxTree, ImmutableArray<UnmappedActiveStatement>>.Empty;
180internal ImmutableArray<UnmappedActiveStatement> GetOldActiveStatements(IEditAndContinueAnalyzer analyzer, SyntaxTree oldSyntaxTree, SourceText oldText, SyntaxNode oldRoot, CancellationToken cancellationToken)
190private ImmutableArray<UnmappedActiveStatement> CalculateOldActiveStatementsAndExceptionRegions(IEditAndContinueAnalyzer analyzer, SyntaxTree oldTree, SourceText oldText, SyntaxNode oldRoot, CancellationToken cancellationToken)
NavigationBar\AbstractNavigationBarItemService.cs (3)
44Solution solution, ISymbol symbol, SyntaxTree tree, Func<SyntaxReference, TextSpan> computeFullSpan)
50Solution solution, ISymbol symbol, SyntaxTree tree,
91Solution solution, ISymbol symbol, SyntaxTree tree, ISymbolDeclarationService symbolDeclarationService)
Compilation\VisualBasicCompilation.vb (87)
54Private Shared ReadOnly s_myTemplateCache As ConcurrentLruCache(Of VisualBasicParseOptions, SyntaxTree) =
55New ConcurrentLruCache(Of VisualBasicParseOptions, SyntaxTree)(capacity:=5)
88Private ReadOnly _syntaxTrees As ImmutableArray(Of SyntaxTree)
90Private ReadOnly _syntaxTreeOrdinalMap As ImmutableDictionary(Of SyntaxTree, Integer)
96Private _lazyAllSyntaxTrees As ImmutableArray(Of SyntaxTree)
102Private ReadOnly _rootNamespaces As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry)
105''' Imports appearing in <see cref="SyntaxTree"/>s in this compilation.
112Private _lazyImportClauseDependencies As ConcurrentDictionary(Of (SyntaxTree As SyntaxTree, ImportsClausePosition As Integer), ImmutableArray(Of AssemblySymbol))
131Public ReadOnly Tree As Lazy(Of SyntaxTree)
134Public Sub New(treeOpt As Func(Of SyntaxTree), rootNamespaceOpt As Func(Of RootSingleNamespaceDeclaration))
135Me.Tree = New Lazy(Of SyntaxTree)(treeOpt)
167Private _lazyMyTemplate As SyntaxTree = VisualBasicSyntaxTree.Dummy
179Private _lazyCompilationUnitCompletedTrees As HashSet(Of SyntaxTree)
240Friend Property MyTemplate As SyntaxTree
250Dim tree As SyntaxTree = Nothing
287Set(value As SyntaxTree)
326Optional syntaxTrees As IEnumerable(Of SyntaxTree) = Nothing,
332If(syntaxTrees IsNot Nothing, syntaxTrees.Cast(Of SyntaxTree), Nothing),
345Optional syntaxTree As SyntaxTree = Nothing,
358If((syntaxTree IsNot Nothing), {syntaxTree}, SpecializedCollections.EmptyEnumerable(Of SyntaxTree)()),
369syntaxTrees As IEnumerable(Of SyntaxTree),
386Dim declMap = ImmutableDictionary.Create(Of SyntaxTree, DeclarationTableEntry)()
393ImmutableArray(Of SyntaxTree).Empty,
394ImmutableDictionary.Create(Of SyntaxTree, Integer)(),
420syntaxTrees As ImmutableArray(Of SyntaxTree),
421syntaxTreeOrdinalMap As ImmutableDictionary(Of SyntaxTree, Integer),
422rootNamespaces As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
440Debug.Assert(syntaxTrees.SetEquals(rootNamespaces.Keys.AsImmutable(), EqualityComparer(Of SyntaxTree).Default))
486Private Function CommonLanguageVersion(syntaxTrees As ImmutableArray(Of SyntaxTree)) As LanguageVersion
526syntaxTrees As ImmutableArray(Of SyntaxTree),
527syntaxTreeOrdinalMap As ImmutableDictionary(Of SyntaxTree, Integer),
528rootNamespaces As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
636declMap = ImmutableDictionary.Create(Of SyntaxTree, DeclarationTableEntry)()
878Public Shadows ReadOnly Property SyntaxTrees As ImmutableArray(Of SyntaxTree)
888Friend Shadows ReadOnly Property AllSyntaxTrees As ImmutableArray(Of SyntaxTree)
891Dim builder = ArrayBuilder(Of SyntaxTree).GetInstance()
909Public Shadows Function ContainsSyntaxTree(syntaxTree As SyntaxTree) As Boolean
913Public Shadows Function AddSyntaxTrees(ParamArray trees As SyntaxTree()) As VisualBasicCompilation
914Return AddSyntaxTrees(DirectCast(trees, IEnumerable(Of SyntaxTree)))
917Public Shadows Function AddSyntaxTrees(trees As IEnumerable(Of SyntaxTree)) As VisualBasicCompilation
931Dim builder = ArrayBuilder(Of SyntaxTree).GetInstance()
943For Each tree As SyntaxTree In trees
977tree As SyntaxTree,
980ByRef declMap As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
991Private Shared Function ForTree(tree As SyntaxTree, options As VisualBasicCompilationOptions, isSubmission As Boolean) As RootSingleNamespaceDeclaration
995Public Shadows Function RemoveSyntaxTrees(ParamArray trees As SyntaxTree()) As VisualBasicCompilation
996Return RemoveSyntaxTrees(DirectCast(trees, IEnumerable(Of SyntaxTree)))
999Public Shadows Function RemoveSyntaxTrees(trees As IEnumerable(Of SyntaxTree)) As VisualBasicCompilation
1009Dim removeSet As New HashSet(Of SyntaxTree)()
1013For Each tree As SyntaxTree In trees
1032Dim ordinalMap = ImmutableDictionary.Create(Of SyntaxTree, Integer)()
1033Dim builder = ArrayBuilder(Of SyntaxTree).GetInstance()
1048tree As SyntaxTree,
1049ByRef declMap As ImmutableDictionary(Of SyntaxTree, DeclarationTableEntry),
1064Return UpdateSyntaxTrees(ImmutableArray(Of SyntaxTree).Empty,
1065ImmutableDictionary.Create(Of SyntaxTree, Integer)(),
1066ImmutableDictionary.Create(Of SyntaxTree, DeclarationTableEntry)(),
1071Public Shadows Function ReplaceSyntaxTree(oldTree As SyntaxTree, newTree As SyntaxTree) As VisualBasicCompilation
1269Friend Overrides Function GetSyntaxTreeOrdinal(tree As SyntaxTree) As Integer
1704Private Overloads Sub ReportUnusedImports(filterTree As SyntaxTree, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken)
1711Dim infoTree As SyntaxTree = info.Tree
1760Private Sub AddImportsDependencies(diagnostics As BindingDiagnosticBag, infoTree As SyntaxTree, clauseSpan As TextSpan)
1769Friend Overrides Sub CompleteTrees(filterTree As SyntaxTree)
1777For Each tree As SyntaxTree In SyntaxTrees
1784Private Sub CompleteTree(tree As SyntaxTree)
1794Interlocked.CompareExchange(_lazyCompilationUnitCompletedTrees, New HashSet(Of SyntaxTree)(), Nothing)
1820Friend Sub RecordImportsClauseDependencies(syntaxTree As SyntaxTree, importsClausePosition As Integer, dependencies As ImmutableArray(Of AssemblySymbol))
1831Public ReadOnly Tree As SyntaxTree
2041Public Shadows Function GetSemanticModel(syntaxTree As SyntaxTree, Optional ignoreAccessibility As Boolean = False) As SemanticModel
2052Friend Overrides Function CreateSemanticModel(syntaxTree As SyntaxTree, options As SemanticModelOptions) As SemanticModel
2212Private Sub AddClsComplianceDiagnostics(diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing)
2233Private Shared Iterator Function FilterDiagnosticsByLocation(diagnostics As IEnumerable(Of Diagnostic), tree As SyntaxTree, filterSpanWithinTree As TextSpan?) As IEnumerable(Of Diagnostic)
2242tree As SyntaxTree,
2300Private Sub GetDiagnosticsForMethodBodiesInTree(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, hasDeclarationErrors As Boolean, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken)
2618tree As SyntaxTree,
2751Protected Overrides Function CommonGetSemanticModel(syntaxTree As SyntaxTree, options As SemanticModelOptions) As SemanticModel
2755Protected Overrides ReadOnly Property CommonSyntaxTrees As ImmutableArray(Of SyntaxTree)
2761Protected Overrides Function CommonAddSyntaxTrees(trees As IEnumerable(Of SyntaxTree)) As Compilation
2762Dim array = TryCast(trees, SyntaxTree())
2771Return Me.AddSyntaxTrees(trees.Cast(Of SyntaxTree)())
2774Protected Overrides Function CommonRemoveSyntaxTrees(trees As IEnumerable(Of SyntaxTree)) As Compilation
2775Dim array = TryCast(trees, SyntaxTree())
2784Return Me.RemoveSyntaxTrees(trees.Cast(Of SyntaxTree)())
2791Protected Overrides Function CommonReplaceSyntaxTree(oldTree As SyntaxTree, newTree As SyntaxTree) As Compilation
2799Protected Overrides Function CommonContainsSyntaxTree(syntaxTree As SyntaxTree) As Boolean
Syntax\VisualBasicSyntaxNode.vb (10)
32Friend Sub New(green As GreenNode, position As Integer, syntaxTree As SyntaxTree)
51Friend Shadows ReadOnly Property SyntaxTree As SyntaxTree
55Dim tree As SyntaxTree = Nothing
81Dim alternativeTree As SyntaxTree = Interlocked.CompareExchange(stack.Pop()._syntaxTree, tree, Nothing)
188Friend Function GetSyntaxErrors(tree As SyntaxTree) As ReadOnlyCollection(Of Diagnostic)
192Friend Shared Function DoGetSyntaxErrors(tree As SyntaxTree, nodeOrToken As SyntaxNodeOrToken) As ReadOnlyCollection(Of Diagnostic)
244Private Shared Sub ProcessTrivia(tree As SyntaxTree,
271Private Shared Function CreateSyntaxError(tree As SyntaxTree, nodeOrToken As SyntaxNodeOrToken, errorInfo As DiagnosticInfo) As Diagnostic
278Private Shared Function CreateSyntaxError(tree As SyntaxTree, nodeOrToken As SyntaxTrivia, errorInfo As DiagnosticInfo) As Diagnostic
387Protected Overrides ReadOnly Property SyntaxTreeCore As SyntaxTree
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (13)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken)
36public static bool IsScript(this SyntaxTree syntaxTree)
44this SyntaxTree syntaxTree,
54this SyntaxTree syntaxTree,
63this SyntaxTree syntaxTree,
96public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken)
121public static bool IsBeforeFirstToken(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
130this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
169this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken, bool findInsideTrivia = false)
202this SyntaxTree syntaxTree,
217this SyntaxTree syntaxTree,
228public static bool IsGeneratedCode(this SyntaxTree syntaxTree, AnalyzerOptions? analyzerOptions, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
250public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (4)
44SyntaxTree tree, SyntaxToken token, int position, CancellationToken cancellationToken)
70public int? FromAlignTokensOperations(SyntaxTree tree, SyntaxToken token)
90SyntaxTree tree, SyntaxToken token, int position, CancellationToken cancellationToken)
96SyntaxTree tree, SyntaxToken token, int position, int extraSpaces, CancellationToken cancellationToken)
Workspace\Solution\DocumentState.cs (15)
28private static readonly ConditionalWeakTable<SyntaxTree, DocumentId> s_syntaxTreeToIdMap = new();
172var tree = treeFactory.ParseSyntaxTree(filePath, options, text, cancellationToken);
252private static TreeAndVersion MakeNewTreeAndVersion(SyntaxTree oldTree, SourceText oldText, VersionStamp oldVersion, SyntaxTree newTree, SourceText newText, VersionStamp newVersion)
261private static bool TopLevelChanged(SyntaxTree oldTree, SourceText oldText, SyntaxTree newTree, SourceText newText)
355SyntaxTree? newTree = null;
526var tree = factory.CreateSyntaxTree(attributes.SyntaxTreeFilePath, options, text: null, encoding, checksumAlgorithm, newRoot);
582public bool TryGetSyntaxTree([NotNullWhen(returnValue: true)] out SyntaxTree? syntaxTree)
596public async ValueTask<SyntaxTree> GetSyntaxTreeAsync(CancellationToken cancellationToken)
608internal SyntaxTree GetSyntaxTree(CancellationToken cancellationToken)
650private static void BindSyntaxTreeToId(SyntaxTree tree, DocumentId id)
662public static DocumentId? GetDocumentIdForTree(SyntaxTree tree)
669SyntaxTree newTree,
671SyntaxTree? oldTree = null,