-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove CSharpKeywordKind #10648
Remove CSharpKeywordKind #10648
Conversation
This type effectively duplicates a lot of Roslyn's SyntaxKind. So we just use that instead.
@dotnet/razor-compiler for review. This is an easily-extractable part of the lexer change, so I went ahead and pulled it out. |
{ "namespace", CSharpKeyword.Namespace }, | ||
{ "when", CSharpKeyword.When }, | ||
{ "where", CSharpKeyword.Where } | ||
private static readonly Dictionary<string, CSharpSyntaxKind> _keywords = new Dictionary<string, CSharpSyntaxKind>(StringComparer.Ordinal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making this a FrozenDictionary in the future.
@@ -2008,14 +2011,13 @@ private bool TryParseKeyword(in SyntaxListBuilder<RazorSyntaxNode> builder) | |||
|
|||
private bool AtBooleanLiteral() | |||
{ | |||
var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); | |||
return result.HasValue && (result.Value == CSharpKeyword.True || result.Value == CSharpKeyword.False); | |||
return LegacyCSharpTokenizer.GetTokenKeyword(CurrentToken) is CSharpSyntaxKind.TrueKeyword or CSharpSyntaxKind.FalseKeyword; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is LegacyCSharpTokenizer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's sign I missed one thing when fixing up the cherry-pick
{ "checked", CSharpSyntaxKind.CheckedKeyword }, | ||
{ "namespace", CSharpSyntaxKind.NamespaceKeyword }, | ||
{ "when", CSharpSyntaxKind.WhenKeyword }, | ||
{ "where", CSharpSyntaxKind.WhereKeyword } | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a test or assert that checks those match (stringifying the enum value gives back a string equal to the key)
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
This type effectively duplicates a lot of Roslyn's SyntaxKind. So we just use that instead.