mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-02 10:15:58 +08:00
Simplify access to the SemanticModel in analyzers
This commit is contained in:
@ -38,9 +38,7 @@ public class NoConcurrentLiveRenderablesAnalyzer : SpectreAnalyzer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
var model = context.Operation.SemanticModel!;
|
||||||
var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree);
|
|
||||||
#pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
|
||||||
var parentInvocations = invocationOperation
|
var parentInvocations = invocationOperation
|
||||||
.Syntax.Ancestors()
|
.Syntax.Ancestors()
|
||||||
.OfType<InvocationExpressionSyntax>()
|
.OfType<InvocationExpressionSyntax>()
|
||||||
|
@ -40,9 +40,7 @@ public class NoPromptsDuringLiveRenderablesAnalyzer : SpectreAnalyzer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
var model = context.Operation.SemanticModel!;
|
||||||
var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree);
|
|
||||||
#pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
|
||||||
var parentInvocations = invocationOperation
|
var parentInvocations = invocationOperation
|
||||||
.Syntax.Ancestors()
|
.Syntax.Ancestors()
|
||||||
.OfType<InvocationExpressionSyntax>()
|
.OfType<InvocationExpressionSyntax>()
|
||||||
|
Reference in New Issue
Block a user