Skip to content

Commit

Permalink
style comments
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarTawfik committed Oct 24, 2017
1 parent 9f691c0 commit 4fa5c0d
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4fa5c0d

Please sign in to comment.