Skip to content

Commit

Permalink
Fix bug in HawkSourceAnalyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Jul 12, 2024
1 parent 1fdacd7 commit c09f195
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ExternalProjects/BizHawk.Analyzer/HawkSourceAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ static bool IsDiscard(AssignmentExpressionSyntax aes)
snac.ReportDiagnostic(Diagnostic.Create(DiagNoDiscardingLocals, snac.Node.GetLocation()));
break;
case CollectionExpressionSyntax ces:
var cesError = CheckSpacingInList(ces.Elements, ces.OpenBracketToken, ces.ToFullString);
var cesError = CheckSpacingInList(ces.Elements, ces.OpenBracketToken, ces.ToString);
if (cesError is not null) snac.ReportDiagnostic(Diagnostic.Create(DiagListExprSpacing, ces.GetLocation(), cesError));
break;
case InterpolatedStringExpressionSyntax ises:
if (ises.StringStartToken.Text[0] is '@') snac.ReportDiagnostic(Diagnostic.Create(DiagInterpStringIsDollarAt, ises.GetLocation()));
break;
case ListPatternSyntax lps:
var lpsError = CheckSpacingInList(lps.Patterns, lps.OpenBracketToken, lps.ToFullString);
var lpsError = CheckSpacingInList(lps.Patterns, lps.OpenBracketToken, lps.ToString);
if (lpsError is not null) snac.ReportDiagnostic(Diagnostic.Create(DiagListExprSpacing, lps.GetLocation(), lpsError));
break;
case QueryExpressionSyntax:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,17 @@ public static class Cases {
public Task CheckMisuseOfListSyntaxes()
=> Verify.VerifyAnalyzerAsync("""
public static class Cases {
private static readonly int[] V = [ ];
private static readonly bool W = V is [ ];
private static readonly int[] X = W ? [ ] : V;
private static readonly int[] Y = [ 0x80, 0x20, 0x40 ];
private static readonly bool Z = Y is [ _, > 20, .. ];
private static readonly int[] A = {|BHI1110:[0x80, 0x20, 0x40 ]|};
private static readonly bool B = A is {|BHI1110:[ _, > 20, ..]|};
private static readonly bool C = A is {|BHI1110:[_, > 20, ..]|};
private static readonly int[] D = {|BHI1110:[]|};
private static readonly bool E = D is {|BHI1110:[]|};
private static readonly int[] F = E ? {|BHI1110:[]|} : D;
}
""");

Expand Down
Binary file modified References/BizHawk.Analyzer.dll
Binary file not shown.

0 comments on commit c09f195

Please sign in to comment.