Skip to content

Commit

Permalink
Avoid (wrong) pattern matching in this case
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheatoid committed Jun 13, 2021
1 parent e87c65e commit bedd03a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CSharp.lua/LuaSyntaxNodeTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3444,9 +3444,12 @@ public override LuaSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax
bool isConst = false;
if (node.Parent is LocalDeclarationStatementSyntax {IsConst: true}) {
isConst = true;
if (variable.Initializer.Value is LiteralExpressionSyntax {Token: string str}) {
if (str.Length > kStringConstInlineCount) {
isConst = false;
if (variable.Initializer.Value is LiteralExpressionSyntax value) {
var token = value.Token;
if (token.Value is string str) {
if (str.Length > kStringConstInlineCount) {
isConst = false;
}
}
}
}
Expand Down

0 comments on commit bedd03a

Please sign in to comment.