mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-25 04:32:51 +08:00
Simplify access to the SemanticModel in analyzers
This commit is contained in:
parent
0bab835293
commit
142942b8a2
src/Spectre.Console.Analyzer/Analyzers
@ -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>()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user