Merge pull request #22660 from dotnet/dev/toddgrun/StopBoxingSyntaxKindDuringTokenization

Stop boxing to compare the SyntaxKind enum during tokenization
This commit is contained in:
Todd Grunke 2020-06-08 14:14:21 -07:00 committed by GitHub
commit f56cad003f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
public virtual bool IsKnownTokenType(SyntaxToken token, KnownTokenType type)
{
return token != null && Equals(token.Kind, GetKnownTokenType(type));
return token != null && (token.Kind == GetKnownTokenType(type));
}
public virtual Tuple<SyntaxToken, SyntaxToken> SplitToken(SyntaxToken token, int splitAt, SyntaxKind leftType)
@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
public virtual bool KnowsTokenType(KnownTokenType type)
{
return type == KnownTokenType.Unknown || !Equals(GetKnownTokenType(type), GetKnownTokenType(KnownTokenType.Unknown));
return type == KnownTokenType.Unknown || (GetKnownTokenType(type) != GetKnownTokenType(KnownTokenType.Unknown));
}
protected abstract SyntaxToken CreateToken(string content, SyntaxKind type, RazorDiagnostic[] errors);