1- using System ;
2- using System . Linq ;
1+ using System . Linq ;
32using Microsoft . CodeAnalysis ;
43using Microsoft . CodeAnalysis . CSharp . Syntax ;
54using static Cleipnir . Flows . SourceGenerator . Utils ;
@@ -14,10 +13,10 @@ public class FlowsSourceGenerator : IIncrementalGenerator
1413 private const string ResultFlowType = "Cleipnir.Flows.Flow`2" ;
1514 private const string IgnoreAttribute = "Cleipnir.Flows.SourceGeneration.Ignore" ;
1615
17- private INamedTypeSymbol ? _paramlessFlowTypeSymbol ;
18- private INamedTypeSymbol ? _unitFlowTypeSymbol ;
19- private INamedTypeSymbol ? _resultFlowTypeSymbol ;
20- private INamedTypeSymbol ? _ignoreAttribute ;
16+ private volatile INamedTypeSymbol ? _paramlessFlowTypeSymbol ;
17+ private volatile INamedTypeSymbol ? _unitFlowTypeSymbol ;
18+ private volatile INamedTypeSymbol ? _resultFlowTypeSymbol ;
19+ private volatile INamedTypeSymbol ? _ignoreAttribute ;
2120
2221 public void Initialize ( IncrementalGeneratorInitializationContext context )
2322 {
@@ -38,13 +37,13 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
3837 public GeneratedFlowInformation ? Transform ( GeneratorAttributeSyntaxContext context )
3938 {
4039
41- // if (_paramlessFlowTypeSymbol == null)
40+ if ( _paramlessFlowTypeSymbol == null )
4241 {
4342 var complication = context . SemanticModel . Compilation ;
44- _paramlessFlowTypeSymbol = complication . GetTypeByMetadataName ( ParamlessFlowType ) ;
4543 _unitFlowTypeSymbol = complication . GetTypeByMetadataName ( UnitFlowType ) ;
4644 _resultFlowTypeSymbol = complication . GetTypeByMetadataName ( ResultFlowType ) ;
4745 _ignoreAttribute = complication . GetTypeByMetadataName ( IgnoreAttribute ) ;
46+ _paramlessFlowTypeSymbol = complication . GetTypeByMetadataName ( ParamlessFlowType ) ;
4847 }
4948
5049 if ( _paramlessFlowTypeSymbol == null || _unitFlowTypeSymbol == null || _resultFlowTypeSymbol == null )
0 commit comments