未验证 提交 637cb4c8 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #47895 from CyrusNajmabadi/nrtFAR

Add NRT annotations to FAR engine
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
......@@ -22,7 +24,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
internal partial class FindReferencesSearchEngine
{
private readonly Solution _solution;
private readonly IImmutableSet<Document> _documents;
private readonly IImmutableSet<Document>? _documents;
private readonly ImmutableArray<IReferenceFinder> _finders;
private readonly IStreamingProgressTracker _progressTracker;
private readonly IStreamingFindReferencesProgress _progress;
......@@ -31,7 +33,7 @@ internal partial class FindReferencesSearchEngine
public FindReferencesSearchEngine(
Solution solution,
IImmutableSet<Document> documents,
IImmutableSet<Document>? documents,
ImmutableArray<IReferenceFinder> finders,
IStreamingFindReferencesProgress progress,
FindReferencesSearchOptions options,
......
......@@ -126,7 +126,8 @@ private async Task<ProjectMap> CreateProjectMapAsync(ConcurrentSet<ISymbol> symb
searchSymbol = sourceSymbol;
}
if (searchSymbol != null && result.Add(searchSymbol))
Contract.ThrowIfNull(searchSymbol);
if (result.Add(searchSymbol))
{
await _progress.OnDefinitionFoundAsync(searchSymbol).ConfigureAwait(false);
......@@ -135,12 +136,12 @@ private async Task<ProjectMap> CreateProjectMapAsync(ConcurrentSet<ISymbol> symb
_cancellationToken.ThrowIfCancellationRequested();
var finderTasks = new List<Task>();
using var _ = ArrayBuilder<Task>.GetInstance(out var finderTasks);
foreach (var f in _finders)
{
finderTasks.Add(Task.Run(async () =>
{
var symbolTasks = new List<Task>();
using var _ = ArrayBuilder<Task>.GetInstance(out var symbolTasks);
var symbols = await f.DetermineCascadedSymbolsAsync(
searchSymbol, _solution, projects, _options, _cancellationToken).ConfigureAwait(false);
......@@ -169,12 +170,13 @@ private async Task<ProjectMap> CreateProjectMapAsync(ConcurrentSet<ISymbol> symb
private void AddSymbolTasks(
ConcurrentSet<ISymbol> result,
ImmutableArray<ISymbol> symbols,
List<Task> symbolTasks)
ArrayBuilder<Task> symbolTasks)
{
if (!symbols.IsDefault)
{
foreach (var child in symbols)
{
Contract.ThrowIfNull(child);
_cancellationToken.ThrowIfCancellationRequested();
symbolTasks.Add(Task.Run(() => DetermineAllSymbolsCoreAsync(child, result), _cancellationToken));
}
......@@ -227,6 +229,7 @@ private static ISymbol MapToAppropriateSymbol(ISymbol symbol)
searchSymbol = symbol.ContainingType;
}
Contract.ThrowIfNull(searchSymbol);
return searchSymbol;
}
}
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
......@@ -62,7 +64,7 @@ protected sealed override bool CanFind(TSymbol symbol)
if (symbol.ContainingType != null && symbol.ContainingType.IsScriptClass)
{
var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
var syntaxTree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
var syntaxFactsService = document.GetLanguageService<ISyntaxFactsService>();
var root = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
var tokens = root.DescendantTokens();
......@@ -74,7 +76,7 @@ protected sealed override bool CanFind(TSymbol symbol)
return ImmutableArray<FinderLocation>.Empty;
}
private static ISymbol GetContainer(ISymbol symbol)
private static ISymbol? GetContainer(ISymbol symbol)
{
for (var current = symbol; current != null; current = current.ContainingSymbol)
{
......@@ -126,11 +128,11 @@ private static ISymbol GetContainer(ISymbol symbol)
Document document,
SemanticModel semanticModel,
IEnumerable<SyntaxToken> tokens,
Func<SyntaxToken, SyntaxNode> findParentNode,
Func<SyntaxToken, SyntaxNode>? findParentNode,
CancellationToken cancellationToken)
{
var name = symbol.Name;
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var symbolsMatch = GetStandardSymbolsMatchFunction(symbol, findParentNode, document.Project.Solution, cancellationToken);
return FindReferencesInTokensAsync(
......@@ -159,15 +161,15 @@ private static ISymbol GetContainer(ISymbol symbol)
ISymbol container,
Document document,
SemanticModel semanticModel,
Func<SyntaxToken, SyntaxNode> findParentNode,
Func<SyntaxToken, SyntaxNode>? findParentNode,
CancellationToken cancellationToken)
{
var service = document.GetLanguageService<ISymbolDeclarationService>();
var service = document.GetRequiredLanguageService<ISymbolDeclarationService>();
var declarations = service.GetDeclarations(container);
var tokens = declarations.SelectMany(r => r.GetSyntax(cancellationToken).DescendantTokens());
var name = symbol.Name;
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var symbolsMatch = GetStandardSymbolsMatchFunction(symbol, findParentNode, document.Project.Solution, cancellationToken);
var tokensMatch = GetTokensMatchFunction(syntaxFacts, name);
......
......@@ -2,10 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.FindSymbols.Finders
......@@ -69,16 +72,22 @@ protected AbstractMethodOrPropertyOrEventSymbolReferenceFinder()
// the only accessor method referenced in a foreach-statement is the .Current's
// get-accessor
return ImmutableArray.Create(symbols.CurrentProperty.GetMethod);
return symbols.CurrentProperty.GetMethod == null
? ImmutableArray<IMethodSymbol>.Empty
: ImmutableArray.Create(symbols.CurrentProperty.GetMethod);
}
if (semanticFacts.IsWrittenTo(model, node, cancellationToken))
{
// if it was only written to, then only the setter was referenced.
// if it was written *and* read, then both accessors were referenced.
return semanticFacts.IsOnlyWrittenTo(model, node, cancellationToken)
? ImmutableArray.Create(property.SetMethod)
: ImmutableArray.Create(property.GetMethod, property.SetMethod);
using var _ = ArrayBuilder<IMethodSymbol>.GetInstance(out var result);
result.AddIfNotNull(property.SetMethod);
if (!semanticFacts.IsOnlyWrittenTo(model, node, cancellationToken))
result.AddIfNotNull(property.GetMethod);
return result.ToImmutable();
}
else
{
......@@ -93,7 +102,7 @@ protected AbstractMethodOrPropertyOrEventSymbolReferenceFinder()
var inNameOf = semanticFacts.IsInsideNameOfExpression(model, node, cancellationToken);
var inStructuredTrivia = node.IsPartOfStructuredTrivia();
return inNameOf || inStructuredTrivia
return inNameOf || inStructuredTrivia || property.GetMethod == null
? ImmutableArray<IMethodSymbol>.Empty
: ImmutableArray.Create(property.GetMethod);
}
......
......@@ -105,7 +105,7 @@ static bool SupportsGlobalSuppression(ISymbol symbol)
if (IsCandidate(token, expectedDocCommentId, semanticModel, syntaxFacts, suppressMessageAttribute, cancellationToken, out var offsetOfReferenceInToken))
{
var referenceLocation = CreateReferenceLocation(offsetOfReferenceInToken, token, root, document, syntaxFacts);
locations.Add(new FinderLocation(token.Parent, referenceLocation));
locations.Add(new FinderLocation(token.GetRequiredParent(), referenceLocation));
}
}
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
......@@ -56,7 +58,7 @@ protected override bool CanFind(IMethodSymbol symbol)
FindReferencesSearchOptions options,
CancellationToken cancellationToken)
{
var syntaxFactsService = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFactsService = document.GetRequiredLanguageService<ISyntaxFactsService>();
var typeName = methodSymbol.ContainingType.Name;
var tokens = await document.GetConstructorInitializerTokensAsync(semanticModel, cancellationToken).ConfigureAwait(false);
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
namespace Microsoft.CodeAnalysis.FindSymbols.Finders
{
internal readonly struct FinderLocation
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Microsoft.CodeAnalysis.LanguageServices;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -25,7 +27,7 @@ internal class LinkedFileReferenceFinder : IReferenceFinder
return SpecializedTasks.EmptyImmutableArray<Document>();
}
public Task<ImmutableArray<Project>> DetermineProjectsToSearchAsync(ISymbol symbol, Solution solution, IImmutableSet<Project> projects = null, CancellationToken cancellationToken = default)
public Task<ImmutableArray<Project>> DetermineProjectsToSearchAsync(ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
=> SpecializedTasks.EmptyImmutableArray<Project>();
public Task<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Microsoft.CodeAnalysis.LanguageServices;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -59,6 +61,7 @@ protected override bool CanFind(ITypeParameterSymbol symbol)
//
// Also, we only look for files that have the name of the owning type. This helps filter
// down the set considerably.
Contract.ThrowIfNull(symbol.DeclaringMethod);
return FindDocumentsAsync(project, documents, findInGlobalSuppressions: false, cancellationToken, symbol.Name,
GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name),
symbol.DeclaringMethod.ContainingType.Name);
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
......@@ -53,9 +55,11 @@ protected override bool CanFind(INamedTypeSymbol symbol)
FindReferencesSearchOptions options,
CancellationToken cancellationToken)
{
var syntaxFacts = project.LanguageServices.GetRequiredService<ISyntaxFactsService>();
var documentsWithName = await FindDocumentsAsync(project, documents, findInGlobalSuppressions: true, cancellationToken, symbol.Name).ConfigureAwait(false);
var documentsWithType = await FindDocumentsAsync(project, documents, symbol.SpecialType.ToPredefinedType(), cancellationToken).ConfigureAwait(false);
var documentsWithAttribute = TryGetNameWithoutAttributeSuffix(symbol.Name, project.LanguageServices.GetService<ISyntaxFactsService>(), out var simpleName)
var documentsWithAttribute = TryGetNameWithoutAttributeSuffix(symbol.Name, syntaxFacts, out var simpleName)
? await FindDocumentsAsync(project, documents, findInGlobalSuppressions: false, cancellationToken, simpleName).ConfigureAwait(false)
: ImmutableArray<Document>.Empty;
......@@ -127,7 +131,7 @@ protected override bool CanFind(INamedTypeSymbol symbol)
return SpecializedTasks.EmptyImmutableArray<FinderLocation>();
}
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
return FindReferencesInDocumentAsync(document, semanticModel, t =>
IsPotentialReference(predefinedType, syntaxFacts, t),
(t, m) => new ValueTask<(bool matched, CandidateReason reason)>((matched: true, reason: CandidateReason.None)),
......@@ -143,7 +147,7 @@ protected override bool CanFind(INamedTypeSymbol symbol)
CancellationToken cancellationToken)
{
var symbolsMatch = GetStandardSymbolsMatchFunction(namedType, null, document.Project.Solution, cancellationToken);
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
return TryGetNameWithoutAttributeSuffix(namedType.Name, syntaxFacts, out var simpleName)
? FindReferencesInDocumentUsingIdentifierAsync(simpleName, document, semanticModel,
symbolsMatch, docCommentId: null, findInGlobalSuppressions: false, cancellationToken)
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -42,7 +44,7 @@ private static string GetNamespaceIdentifierName(INamespaceSymbol symbol)
CancellationToken cancellationToken)
{
var identifierName = GetNamespaceIdentifierName(symbol);
var syntaxFactsService = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var tokens = await GetIdentifierOrGlobalNamespaceTokensWithTextAsync(
document, semanticModel, identifierName, cancellationToken).ConfigureAwait(false);
......@@ -50,14 +52,14 @@ private static string GetNamespaceIdentifierName(INamespaceSymbol symbol)
document,
semanticModel,
tokens,
t => syntaxFactsService.TextMatch(t.ValueText, identifierName),
t => syntaxFacts.TextMatch(t.ValueText, identifierName),
cancellationToken).ConfigureAwait(false);
var aliasReferences = await FindAliasReferencesAsync(nonAliasReferences, symbol, document, semanticModel, cancellationToken).ConfigureAwait(false);
var suppressionReferences = ShouldFindReferencesInGlobalSuppressions(symbol, out var docCommentId)
? await FindReferencesInDocumentInsideGlobalSuppressionsAsync(document, semanticModel,
syntaxFactsService, docCommentId, cancellationToken).ConfigureAwait(false)
syntaxFacts, docCommentId, cancellationToken).ConfigureAwait(false)
: ImmutableArray<FinderLocation>.Empty;
return nonAliasReferences.Concat(aliasReferences).Concat(suppressionReferences);
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -33,7 +35,7 @@ protected override bool CanFind(IMethodSymbol symbol)
FindReferencesSearchOptions options,
CancellationToken cancellationToken)
{
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var op = symbol.GetPredefinedOperator();
return FindReferencesInDocumentAsync(symbol, document, semanticModel, t =>
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Immutable;
using System.Linq;
......@@ -131,18 +133,18 @@ protected override bool CanFind(IParameterSymbol symbol)
var document = solution.GetDocument(parameterNode.SyntaxTree);
if (document != null)
{
var semanticFacts = document.GetLanguageService<ISemanticFactsService>();
var semanticFacts = document.GetRequiredLanguageService<ISemanticFactsService>();
if (semanticFacts.ExposesAnonymousFunctionParameterNames)
{
var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var lambdaNode = parameter.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault();
var convertedType = semanticModel.GetTypeInfo(lambdaNode, cancellationToken).ConvertedType;
if (convertedType != null)
{
var syntaxFactsService = document.GetLanguageService<ISyntaxFactsService>();
var container = GetContainer(semanticModel, parameterNode, syntaxFactsService);
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var container = GetContainer(semanticModel, parameterNode, syntaxFacts);
if (container != null)
{
CascadeBetweenAnonymousFunctionParameters(
......@@ -165,12 +167,12 @@ protected override bool CanFind(IParameterSymbol symbol)
ArrayBuilder<ISymbol> results,
CancellationToken cancellationToken)
{
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
foreach (var token in container.DescendantTokens())
{
if (IdentifiersMatch(syntaxFacts, parameter.Name, token))
{
var symbol = semanticModel.GetDeclaredSymbol(token.Parent, cancellationToken);
var symbol = semanticModel.GetDeclaredSymbol(token.GetRequiredParent(), cancellationToken);
if (symbol is IParameterSymbol &&
symbol.ContainingSymbol.IsAnonymousFunction() &&
SignatureComparer.Instance.HaveSameSignatureAndConstraintsAndReturnTypeAndAccessors(parameter.ContainingSymbol, symbol.ContainingSymbol, syntaxFacts.IsCaseSensitive) &&
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -80,8 +82,8 @@ protected override bool CanFind(IMethodSymbol symbol)
options.WithAssociatePropertyReferencesWithSpecificAccessor(false),
cancellationToken).ConfigureAwait(false);
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var semanticFacts = document.GetLanguageService<ISemanticFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var semanticFacts = document.GetRequiredLanguageService<ISemanticFactsService>();
var accessorReferences = propertyReferences.WhereAsArray(
loc =>
......
......@@ -95,8 +95,8 @@ private static bool IsForEachProperty(IPropertySymbol symbol)
// We want to associate property references to a specific accessor (if an accessor
// is being referenced). Check if this reference would match an accessor. If so, do
// not add it. It will be added by PropertyAccessorSymbolReferenceFinder.
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var semanticFacts = document.GetLanguageService<ISemanticFactsService>();
var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
var semanticFacts = document.GetRequiredLanguageService<ISemanticFactsService>();
nameReferences = nameReferences.WhereAsArray(loc =>
{
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Microsoft.CodeAnalysis.LanguageServices;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.FindSymbols.Finders
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......
......@@ -58,7 +58,7 @@ public static partial class SymbolFinder
}
internal static Task FindReferencesInCurrentProcessAsync(
ISymbol symbolAndProjectId,
ISymbol symbol,
Solution solution,
IStreamingFindReferencesProgress progress,
IImmutableSet<Document> documents,
......@@ -69,7 +69,7 @@ public static partial class SymbolFinder
progress ??= NoOpStreamingFindReferencesProgress.Instance;
var engine = new FindReferencesSearchEngine(
solution, documents, finders, progress, options, cancellationToken);
return engine.FindReferencesAsync(symbolAndProjectId);
return engine.FindReferencesAsync(symbol);
}
}
}
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -21,10 +23,9 @@ public static partial class SymbolFinder
{
var streamingProgress = new StreamingProgressCollector();
IImmutableSet<Document> documents = null;
var engine = new FindReferencesSearchEngine(
solution,
documents,
documents: null,
ReferenceFinders.DefaultRenameReferenceFinders,
streamingProgress,
FindReferencesSearchOptions.Default,
......
......@@ -159,5 +159,8 @@ public static SyntaxToken With(this SyntaxToken token, SyntaxTriviaList leading,
public static SyntaxTrivia[] GetTrivia(this IEnumerable<SyntaxToken> tokens)
=> tokens.SelectMany(token => SyntaxNodeOrTokenExtensions.GetTrivia(token)).ToArray();
public static SyntaxNode GetRequiredParent(this SyntaxToken token)
=> token.Parent ?? throw new InvalidOperationException("Token's parent was null");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册