提交 52365c43 编写于 作者: J Jason Malinowski

Merge public and private overload

The private overload was just used by the public one. Makes it easier
to navigate if there's just less code.
上级 71b47d09
...@@ -73,26 +73,6 @@ public static INamespaceSymbol GetEnclosingNamespace(this SemanticModel semantic ...@@ -73,26 +73,6 @@ public static INamespaceSymbol GetEnclosingNamespace(this SemanticModel semantic
return typeInfo.Type ?? symbolInfo.GetAnySymbol().ConvertToType(semanticModel.Compilation); return typeInfo.Type ?? symbolInfo.GetAnySymbol().ConvertToType(semanticModel.Compilation);
} }
public static TokenSemanticInfo GetSemanticInfo(
this SemanticModel semanticModel,
SyntaxToken token,
Workspace workspace,
CancellationToken cancellationToken)
{
var languageServices = workspace.Services.GetLanguageServices(token.Language);
var syntaxFacts = languageServices.GetService<ISyntaxFactsService>();
if (!syntaxFacts.IsBindableToken(token))
{
return TokenSemanticInfo.Empty;
}
var semanticFacts = languageServices.GetService<ISemanticFactsService>();
return GetSemanticInfo(
semanticModel, semanticFacts, syntaxFacts,
token, cancellationToken);
}
private static ISymbol MapSymbol(ISymbol symbol, ITypeSymbol type) private static ISymbol MapSymbol(ISymbol symbol, ITypeSymbol type)
{ {
if (symbol.IsConstructor() && symbol.ContainingType.IsAnonymousType) if (symbol.IsConstructor() && symbol.ContainingType.IsAnonymousType)
...@@ -141,13 +121,21 @@ private static ISymbol MapSymbol(ISymbol symbol, ITypeSymbol type) ...@@ -141,13 +121,21 @@ private static ISymbol MapSymbol(ISymbol symbol, ITypeSymbol type)
return symbol; return symbol;
} }
private static TokenSemanticInfo GetSemanticInfo( public static TokenSemanticInfo GetSemanticInfo(
SemanticModel semanticModel, this SemanticModel semanticModel,
ISemanticFactsService semanticFacts,
ISyntaxFactsService syntaxFacts,
SyntaxToken token, SyntaxToken token,
Workspace workspace,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var languageServices = workspace.Services.GetLanguageServices(token.Language);
var syntaxFacts = languageServices.GetService<ISyntaxFactsService>();
if (!syntaxFacts.IsBindableToken(token))
{
return TokenSemanticInfo.Empty;
}
var semanticFacts = languageServices.GetService<ISemanticFactsService>();
IAliasSymbol aliasSymbol; IAliasSymbol aliasSymbol;
ITypeSymbol type; ITypeSymbol type;
ITypeSymbol convertedType; ITypeSymbol convertedType;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册