提交 bf949837 编写于 作者: B Balaji Krishnan

Pass CancellationToken around

上级 445e7065
......@@ -177,7 +177,7 @@ private void AddPartialModifiersToTypeChain(DocumentEditor documentEditor)
foreach (var node in typeChain)
{
var symbol = (ITypeSymbol)State.SemanticDocument.SemanticModel.GetDeclaredSymbol(node, CancellationToken);
if (!semanticFacts.IsPartial(symbol))
if (!semanticFacts.IsPartial(symbol, CancellationToken))
{
documentEditor.SetModifiers(node, DeclarationModifiers.Partial);
}
......
......@@ -263,10 +263,10 @@ public bool IsNameOfContext(SemanticModel semanticModel, int position, Cancellat
return semanticModel.SyntaxTree.IsNameOfContext(position, semanticModel, cancellationToken);
}
public bool IsPartial(ITypeSymbol typeSymbol)
public bool IsPartial(ITypeSymbol typeSymbol, CancellationToken cancellationToken)
{
var syntaxRefs = typeSymbol.DeclaringSyntaxReferences;
return syntaxRefs.Any(n => ((BaseTypeDeclarationSyntax)n.GetSyntax()).Modifiers.Any(SyntaxKind.PartialKeyword));
return syntaxRefs.Any(n => ((BaseTypeDeclarationSyntax)n.GetSyntax(cancellationToken)).Modifiers.Any(SyntaxKind.PartialKeyword));
}
}
}
......@@ -93,6 +93,6 @@ internal interface ISemanticFactsService : ILanguageService
bool IsAssignableTo(ITypeSymbol fromSymbol, ITypeSymbol toSymbol, Compilation compilation);
bool IsPartial(ITypeSymbol typeSymbol);
bool IsPartial(ITypeSymbol typeSymbol, CancellationToken cancellationToken);
}
}
\ No newline at end of file
......@@ -248,11 +248,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return semanticModel.SyntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken)
End Function
Public Function IsPartial(typeSymbol As ITypeSymbol) As Boolean Implements ISemanticFactsService.IsPartial
Public Function IsPartial(typeSymbol As ITypeSymbol, cancellationToken As CancellationToken) As Boolean Implements ISemanticFactsService.IsPartial
Dim syntaxRefs = typeSymbol.DeclaringSyntaxReferences
Return syntaxRefs.Any(
Function(n As SyntaxReference)
Return DirectCast(n.GetSyntax(), TypeStatementSyntax).Modifiers.Any(SyntaxKind.PartialKeyword)
Return DirectCast(n.GetSyntax(cancellationToken), TypeStatementSyntax).Modifiers.Any(SyntaxKind.PartialKeyword)
End Function)
End Function
End Class
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册