提交 e7e9fa40 编写于 作者: O Omar Tawfik 提交者: Sam Harwell

style comments

上级 fef6618d
......@@ -111,13 +111,17 @@ protected override bool TryAnalyzeVariableDeclaration(TypeSyntax typeName, Seman
// Do not suggest var replacement for stackalloc span expressions.
// This will change the bound type from a span to a pointer.
if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType)
&& initializer
.DescendantNodesAndSelf(descendIntoChildren: node => !node.IsAnyLambdaOrAnonymousMethod())
.Any(node => node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)))
if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType))
{
issueSpan = default;
return false;
var containsStackAlloc = initializer
.DescendantNodesAndSelf(descendIntoChildren: node => !node.IsAnyLambdaOrAnonymousMethod())
.Any(node => node.IsKind(SyntaxKind.StackAllocArrayCreationExpression));
if (containsStackAlloc)
{
issueSpan = default;
return false;
}
}
if (AssignmentSupportsStylePreference(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册