11using Microsoft . CodeAnalysis ;
2- using Microsoft . CodeAnalysis . CSharp ;
32using Microsoft . CodeAnalysis . CSharp . Syntax ;
43using Microsoft . CodeAnalysis . Text ;
54using System . Collections . Generic ;
@@ -19,7 +18,7 @@ public void Execute(GeneratorExecutionContext context)
1918
2019 var buffer = new StringBuilder ( ) ;
2120
22- var group = enumerate ( ) . GroupBy ( x => x . type , x => x . method ) ;
21+ var group = enumerate ( ) . GroupBy ( x => x . Type , x => x . Method ) ;
2322
2423 foreach ( var g in group )
2524 {
@@ -29,19 +28,14 @@ public void Execute(GeneratorExecutionContext context)
2928 context . AddSource ( filename , SourceText . From ( generatedSource , Encoding . UTF8 ) ) ;
3029 }
3130
32- IEnumerable < ( TypeInfo type , MethodInfo method ) > enumerate ( )
31+ IEnumerable < Utf8LiteralMethod > enumerate ( )
3332 {
3433 foreach ( var m in receiver . CandidateMethods )
3534 {
3635 var model = compilation . GetSemanticModel ( m . SyntaxTree ) ;
3736
38- if ( m . ParameterList . Parameters . Count != 0 ) continue ;
39- if ( model . GetDeclaredSymbol ( m ) is not { } methodSymbol ) continue ;
40- if ( ! methodSymbol . IsPartialDefinition || ! methodSymbol . IsStatic ) continue ;
41- if ( ! ReturnsString ( methodSymbol ) ) continue ;
42- if ( GetUtf8Attribute ( methodSymbol ) is not { } value ) continue ;
43-
44- yield return ( new ( methodSymbol . ContainingType ) , new ( methodSymbol , value ) ) ;
37+ if ( GetSemanticTargetForGeneration ( model , m ) is { } t )
38+ yield return t ;
4539 }
4640 }
4741 }
0 commit comments