Clean up registration in `BizHawk.Analyzer`
will rebuild in later commit
This commit is contained in:
parent
57921a9206
commit
03bf156a91
|
@ -19,9 +19,8 @@ public sealed class AmbiguousMoneyToFloatConversionAnalyzer : DiagnosticAnalyzer
|
|||
{
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
||||
context.EnableConcurrentExecution();
|
||||
context.RegisterCompilationStartAction(initContext =>
|
||||
{
|
||||
initContext.RegisterOperationAction(oac =>
|
||||
context.RegisterOperationAction(
|
||||
oac =>
|
||||
{
|
||||
var conversionOp = (IConversionOperation) oac.Operation;
|
||||
var typeOutput = conversionOp.Type?.SpecialType ?? SpecialType.None;
|
||||
|
@ -67,6 +66,5 @@ public sealed class AmbiguousMoneyToFloatConversionAnalyzer : DiagnosticAnalyzer
|
|||
]));
|
||||
},
|
||||
OperationKind.Conversion);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,10 @@ public sealed class ExprBodiedMemberFlowAnalyzer : DiagnosticAnalyzer
|
|||
{
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
||||
context.EnableConcurrentExecution();
|
||||
context.RegisterCompilationStartAction(initContext =>
|
||||
{
|
||||
var ARROW_ONE_LINE = (' ', ' ');
|
||||
// var ARROW_POST_SIG = (' ', '\n');
|
||||
var ARROW_PRE_BODY = ('\n', ' ');
|
||||
initContext.RegisterSyntaxNodeAction(
|
||||
context.RegisterSyntaxNodeAction(
|
||||
snac =>
|
||||
{
|
||||
var aecs = (ArrowExpressionClauseSyntax) snac.Node;
|
||||
|
@ -116,6 +114,5 @@ public sealed class ExprBodiedMemberFlowAnalyzer : DiagnosticAnalyzer
|
|||
if ((hasLineBreakAfterArrow ? '\n' : ' ') != expectedWhitespace.After) Fail();
|
||||
},
|
||||
SyntaxKind.ArrowExpressionClause);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,16 +113,13 @@ public class HawkSourceAnalyzer : DiagnosticAnalyzer
|
|||
=> aes.OperatorToken.RawKind is (int) SyntaxKind.EqualsToken && aes.Left is IdentifierNameSyntax { Identifier.Text: "_" };
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
||||
context.EnableConcurrentExecution();
|
||||
INamedTypeSymbol? invalidOperationExceptionSym = null;
|
||||
INamedTypeSymbol? switchExpressionExceptionSym = null;
|
||||
context.RegisterSyntaxNodeAction(
|
||||
context.RegisterCompilationStartAction(initContext =>
|
||||
{
|
||||
var invalidOperationExceptionSym = initContext.Compilation.GetTypeByMetadataName("System.InvalidOperationException")!;
|
||||
var switchExpressionExceptionSym = initContext.Compilation.GetTypeByMetadataName("System.Runtime.CompilerServices.SwitchExpressionException");
|
||||
initContext.RegisterSyntaxNodeAction(
|
||||
snac =>
|
||||
{
|
||||
if (invalidOperationExceptionSym is null)
|
||||
{
|
||||
invalidOperationExceptionSym = snac.Compilation.GetTypeByMetadataName("System.InvalidOperationException")!;
|
||||
switchExpressionExceptionSym = snac.Compilation.GetTypeByMetadataName("System.Runtime.CompilerServices.SwitchExpressionException");
|
||||
}
|
||||
switch (snac.Node)
|
||||
{
|
||||
case AnonymousMethodExpressionSyntax:
|
||||
|
@ -182,5 +179,6 @@ public class HawkSourceAnalyzer : DiagnosticAnalyzer
|
|||
SyntaxKind.RecordDeclaration,
|
||||
SyntaxKind.SimpleAssignmentExpression,
|
||||
SyntaxKind.SwitchExpressionArm);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,8 @@ public sealed class TernaryInferredTypeMismatchAnalyzer : DiagnosticAnalyzer
|
|||
{
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
||||
context.EnableConcurrentExecution();
|
||||
context.RegisterCompilationStartAction(initContext =>
|
||||
{
|
||||
initContext.RegisterOperationAction(oac =>
|
||||
context.RegisterOperationAction(
|
||||
oac =>
|
||||
{
|
||||
var ifelseOrTernaryOp = (IConditionalOperation) oac.Operation;
|
||||
if (ifelseOrTernaryOp.WhenFalse is null) return;
|
||||
|
@ -77,6 +76,5 @@ public sealed class TernaryInferredTypeMismatchAnalyzer : DiagnosticAnalyzer
|
|||
messageArgs: message));
|
||||
},
|
||||
OperationKind.Conditional);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,14 +27,15 @@ public sealed class UseNameofOperatorAnalyzer : DiagnosticAnalyzer
|
|||
{
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
||||
context.EnableConcurrentExecution();
|
||||
ISymbol? memberInfoDotNameSym = null;
|
||||
ISymbol? typeDotToStringSym = null;
|
||||
context.RegisterSyntaxNodeAction(
|
||||
context.RegisterCompilationStartAction(initContext =>
|
||||
{
|
||||
var memberInfoDotNameSym = initContext.Compilation.GetTypeByMetadataName("System.Reflection.MemberInfo")!
|
||||
.GetMembers("Name")[0];
|
||||
var typeDotToStringSym = initContext.Compilation.GetTypeByMetadataName("System.Type")!
|
||||
.GetMembers(WellKnownMemberNames.ObjectToString)[0];
|
||||
initContext.RegisterSyntaxNodeAction(
|
||||
snac =>
|
||||
{
|
||||
memberInfoDotNameSym ??= snac.Compilation.GetTypeByMetadataName("System.Reflection.MemberInfo")!.GetMembers("Name")[0];
|
||||
typeDotToStringSym ??= snac.Compilation.GetTypeByMetadataName("System.Type")!
|
||||
.GetMembers(WellKnownMemberNames.ObjectToString)[0];
|
||||
var toes = (TypeOfExpressionSyntax) snac.Node;
|
||||
switch (toes.Parent)
|
||||
{
|
||||
|
@ -61,5 +62,6 @@ public sealed class UseNameofOperatorAnalyzer : DiagnosticAnalyzer
|
|||
}
|
||||
},
|
||||
SyntaxKind.TypeOfExpression);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue