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,
95public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken)
120public static bool IsBeforeFirstToken(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
129this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
168this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken, bool findInsideTrivia = false)
201this SyntaxTree syntaxTree,
216this SyntaxTree syntaxTree,
227public static bool IsGeneratedCode(this SyntaxTree syntaxTree, AnalyzerOptions? analyzerOptions, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
249public 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)
2724internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, BindingDiagnosticBag diagnostics, Location location)
2733private static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, Location location)
2739private 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;
353IEnumerable<SyntaxTree>? syntaxTrees = null,
373SyntaxTree? syntaxTree = null,
386(syntaxTree != null) ? new[] { syntaxTree } : SpecializedCollections.EmptyEnumerable<SyntaxTree>(),
397IEnumerable<SyntaxTree>? syntaxTrees,
429ImmutableArray<SyntaxTree>.Empty,
529private static LanguageVersion CommonLanguageVersion(ImmutableArray<SyntaxTree> syntaxTrees)
532foreach (var tree in syntaxTrees)
815public new ImmutableArray<SyntaxTree> SyntaxTrees
823public new bool ContainsSyntaxTree(SyntaxTree? syntaxTree)
831public new CSharpCompilation AddSyntaxTrees(params SyntaxTree[] trees)
833return AddSyntaxTrees((IEnumerable<SyntaxTree>)trees);
839public new CSharpCompilation AddSyntaxTrees(IEnumerable<SyntaxTree> trees)
855var externalSyntaxTrees = PooledHashSet<SyntaxTree>.GetInstance();
903public new CSharpCompilation RemoveSyntaxTrees(params SyntaxTree[] trees)
905return RemoveSyntaxTrees((IEnumerable<SyntaxTree>)trees);
912public new CSharpCompilation RemoveSyntaxTrees(IEnumerable<SyntaxTree> trees)
924var removeSet = PooledHashSet<SyntaxTree>.GetInstance();
929var externalSyntaxTrees = PooledHashSet<SyntaxTree>.GetInstance();
971syntaxAndDeclarations: syntaxAndDeclarations.WithExternalSyntaxTrees(ImmutableArray<SyntaxTree>.Empty));
977public new CSharpCompilation ReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree? newTree)
1031internal override int GetSyntaxTreeOrdinal(SyntaxTree tree)
1046internal OneOrMany<SyntaxTree> GetSyntaxTreesByMappedPath(string mappedPath)
1061return mappedPathToSyntaxTree.TryGetValue(mappedPath, out var value) ? value : OneOrMany<SyntaxTree>.Empty;
1063ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> computeMappedPathToSyntaxTree()
1065var builder = ImmutableSegmentedDictionary.CreateBuilder<string, OneOrMany<SyntaxTree>>();
1067foreach (var tree in SyntaxTrees)
1076internal OneOrMany<SyntaxTree> GetSyntaxTreesByContentHash(ReadOnlyMemory<byte> contentHash)
1087return contentHashToSyntaxTree.TryGetValue(contentHash, out var value) ? value : OneOrMany<SyntaxTree>.Empty;
1089ImmutableSegmentedDictionary<ReadOnlyMemory<byte>, OneOrMany<SyntaxTree>> computeHashToSyntaxTree()
1091var builder = ImmutableSegmentedDictionary.CreateBuilder<ReadOnlyMemory<byte>, OneOrMany<SyntaxTree>>(ContentHashComparer.Instance);
1092foreach (var tree in SyntaxTrees)
1102internal OneOrMany<SyntaxTree> GetSyntaxTreesByPath(string path)
1114return pathToSyntaxTree.TryGetValue(path, out var value) ? value : OneOrMany<SyntaxTree>.Empty;
1116ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> computePathToSyntaxTree()
1118var builder = ImmutableSegmentedDictionary.CreateBuilder<string, OneOrMany<SyntaxTree>>();
1119foreach (var tree in SyntaxTrees)
1552internal bool IsSubmissionSyntaxTree(SyntaxTree tree)
2480public new SemanticModel GetSemanticModel(SyntaxTree syntaxTree, bool ignoreAccessibility)
2489public new SemanticModel GetSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
2512internal override SemanticModel CreateSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
2526internal BinderFactory GetBinderFactory(SyntaxTree syntaxTree, bool ignoreAccessibility = false)
2536private BinderFactory GetBinderFactory(SyntaxTree syntaxTree, bool ignoreAccessibility, ref WeakReference<BinderFactory>[]? cachedBinderFactories)
2558private BinderFactory AddNewFactory(SyntaxTree syntaxTree, bool ignoreAccessibility, [NotNull] ref WeakReference<BinderFactory>? slot)
2590private void CompleteTree(SyntaxTree tree)
2592if (_lazyCompilationUnitCompletedTrees == null) Interlocked.CompareExchange(ref _lazyCompilationUnitCompletedTrees, new HashSet<SyntaxTree>(), null);
2619private void ReportUnusedImports(SyntaxTree? filterTree, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
2635SyntaxTree infoTree = info.Tree;
2712internal override void CompleteTrees(SyntaxTree? filterTree)
2725foreach (var tree in this.SyntaxTrees)
2763public readonly SyntaxTree Tree;
2767public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span)
2928var syntaxTree = syntaxTrees[i];
2936foreach (var syntaxTree in syntaxTrees)
2947foreach (var syntaxTree in syntaxTrees)
3000private static void AppendLoadDirectiveDiagnostics(DiagnosticBag builder, SyntaxAndDeclarationManager syntaxAndDeclarations, SyntaxTree syntaxTree, Func<IEnumerable<Diagnostic>, IEnumerable<Diagnostic>>? locationFilterOpt = null)
3046private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span)
3062private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken)
3115foreach (var otherTree in SyntaxTrees)
3143void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken)
3158void registeredUsageOfUsingsInTree(SyntaxTree tree)
3194private 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)
3243private ReadOnlyBindingDiagnostic<AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken)
3266private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree)
3279SyntaxTree syntaxTree,
3546public bool CheckDuplicateFilePathsAndFree(ImmutableArray<SyntaxTree> syntaxTrees, NamespaceSymbol globalNamespace)
3549foreach (var tree in syntaxTrees)
3780SyntaxTree tree,
3879foreach (var syntaxTree in this.SyntaxTrees)
3921protected override SemanticModel CommonGetSemanticModel(SyntaxTree syntaxTree, SemanticModelOptions options)
3926protected internal override ImmutableArray<SyntaxTree> CommonSyntaxTrees
3934protected override Compilation CommonAddSyntaxTrees(IEnumerable<SyntaxTree> trees)
3939protected override Compilation CommonRemoveSyntaxTrees(IEnumerable<SyntaxTree> trees)
3949protected override Compilation CommonReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree? newTree)
3964protected 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 (28)
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)
91public static bool IsRightOfDotOrArrowOrColonColon(this SyntaxTree syntaxTree, int position, SyntaxToken targetToken, CancellationToken cancellationToken)
98public static bool IsRightOfDotOrArrow(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
102this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken)
115public static bool IsRightOfNumericLiteral(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
121public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken)
129public static bool IsEntirelyWithinNonUserCodeComment(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
141public static bool IsEntirelyWithinComment(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
151public static bool IsCrefContext(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
164public static bool IsEntirelyWithinCrefSyntax(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
176this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
220this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
238this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
255this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
269this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
293this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
378this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
385public static bool IsEntirelyWithinStringLiteral(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
389this SyntaxTree syntaxTree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken)
438this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
466this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
528public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
536public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, SyntaxToken preProcessorTokenOnLeftOfPosition)
src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
47var tree = context.Tree;
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (10)
20protected abstract TMemberNode? GetContainingMember(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken);
26protected abstract SyntaxToken GetTokenToRight(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken);
27protected abstract SyntaxToken GetTokenToLeft(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken);
42SyntaxTree syntaxTree,
169public bool IsValidTargetMember(SyntaxTree syntaxTree, SourceText text, int position, CancellationToken cancellationToken)
172private TMemberNode? GetTargetMember(SyntaxTree syntaxTree, SourceText text, int position, CancellationToken cancellationToken)
229public DocumentationCommentSnippet? GetDocumentationCommentSnippetOnEnterTyped(SyntaxTree syntaxTree, SourceText text, int position, in DocumentationCommentOptions options, CancellationToken cancellationToken)
247private DocumentationCommentSnippet? GenerateDocumentationCommentAfterEnter(SyntaxTree syntaxTree, SourceText text, int position, in DocumentationCommentOptions options, CancellationToken cancellationToken)
289public DocumentationCommentSnippet? GetDocumentationCommentSnippetOnCommandInvoke(SyntaxTree syntaxTree, SourceText text, int position, in DocumentationCommentOptions options, CancellationToken cancellationToken)
326private DocumentationCommentSnippet? GenerateExteriorTriviaAfterEnter(SyntaxTree syntaxTree, SourceText text, int position, in DocumentationCommentOptions options, CancellationToken cancellationToken)
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,
95public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken)
120public static bool IsBeforeFirstToken(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
129this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
168this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken, bool findInsideTrivia = false)
201this SyntaxTree syntaxTree,
216this SyntaxTree syntaxTree,
227public static bool IsGeneratedCode(this SyntaxTree syntaxTree, AnalyzerOptions? analyzerOptions, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
249public 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 (16)
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;
501if (TryGetSyntaxTree(out var priorTree))
541var tree = factory.CreateSyntaxTree(attributes.SyntaxTreeFilePath, options, text: null, encoding, checksumAlgorithm, newRoot);
597public bool TryGetSyntaxTree([NotNullWhen(returnValue: true)] out SyntaxTree? syntaxTree)
611public async ValueTask<SyntaxTree> GetSyntaxTreeAsync(CancellationToken cancellationToken)
623internal SyntaxTree GetSyntaxTree(CancellationToken cancellationToken)
665private static void BindSyntaxTreeToId(SyntaxTree tree, DocumentId id)
677public static DocumentId? GetDocumentIdForTree(SyntaxTree tree)
684SyntaxTree newTree,
686SyntaxTree? oldTree = null,