@@ -15,12 +15,6 @@ internal sealed record SwitchBodyData(
1515
1616internal static class GeneratesMethodExecutionRuntime
1717{
18- private const string AbstractionsAssemblyName = "MattSourceGenHelpers.Abstractions" ;
19- private const string GenerateTypeName = "MattSourceGenHelpers.Abstractions.Generate" ;
20- private const string RecordingGeneratorsFactoryTypeName = "MattSourceGenHelpers.Abstractions.RecordingGeneratorsFactory" ;
21- private const string CurrentGeneratorPropertyName = "CurrentGenerator" ;
22- private const string LastRecordPropertyName = "LastRecord" ;
23-
2418 internal static ( string ? value , string ? error ) ExecuteSimpleGeneratorMethod (
2519 IMethodSymbol generatorMethod ,
2620 IMethodSymbol partialMethod ,
@@ -71,27 +65,27 @@ internal static (SwitchBodyData? record, string? error) ExecuteFluentGeneratorMe
7165 PortableExecutableReference ? abstractionsReference = compilation . References
7266 . OfType < PortableExecutableReference > ( )
7367 . FirstOrDefault ( reference => reference . FilePath is not null && string . Equals (
74- Path . GetFileNameWithoutExtension ( reference . FilePath ) ,
75- AbstractionsAssemblyName ,
76- StringComparison . OrdinalIgnoreCase ) ) ;
68+ Path . GetFileNameWithoutExtension ( reference . FilePath ) ,
69+ Consts . AbstractionsAssemblyName ,
70+ StringComparison . OrdinalIgnoreCase ) ) ;
7771
7872 if ( abstractionsReference ? . FilePath == null )
7973 {
80- return ( null , $ "Could not find { AbstractionsAssemblyName } reference in compilation") ;
74+ return ( null , $ "Could not find { Consts . AbstractionsAssemblyName } reference in compilation") ;
8175 }
8276
8377 string abstractionsAssemblyPath = ResolveImplementationAssemblyPath ( abstractionsReference . FilePath ) ;
8478 Assembly abstractionsAssembly = loadContext . LoadFromAssemblyPath ( abstractionsAssemblyPath ) ;
8579
86- Type ? generatorStaticType = abstractionsAssembly . GetType ( GenerateTypeName ) ;
87- Type ? recordingFactoryType = abstractionsAssembly . GetType ( RecordingGeneratorsFactoryTypeName ) ;
80+ Type ? generatorStaticType = abstractionsAssembly . GetType ( Consts . GenerateTypeFullName ) ;
81+ Type ? recordingFactoryType = abstractionsAssembly . GetType ( Consts . RecordingGeneratorsFactoryTypeFullName ) ;
8882 if ( generatorStaticType == null || recordingFactoryType == null )
8983 {
90- return ( null , $ "Could not find { GenerateTypeName } or { RecordingGeneratorsFactoryTypeName } types in Abstractions assembly") ;
84+ return ( null , $ "Could not find { Consts . GenerateTypeFullName } or { Consts . RecordingGeneratorsFactoryTypeFullName } types in Abstractions assembly") ;
9185 }
9286
9387 object ? recordingFactory = Activator . CreateInstance ( recordingFactoryType ) ;
94- PropertyInfo ? currentGeneratorProperty = generatorStaticType . GetProperty ( CurrentGeneratorPropertyName , BindingFlags . Public | BindingFlags . Static ) ;
88+ PropertyInfo ? currentGeneratorProperty = generatorStaticType . GetProperty ( Consts . CurrentGeneratorPropertyName , BindingFlags . Public | BindingFlags . Static ) ;
9589 currentGeneratorProperty ? . SetValue ( null , recordingFactory ) ;
9690
9791 string typeName = generatorMethod . ContainingType . ToDisplayString ( ) ;
@@ -109,7 +103,7 @@ internal static (SwitchBodyData? record, string? error) ExecuteFluentGeneratorMe
109103
110104 generatorMethodInfo . Invoke ( null , null ) ;
111105
112- PropertyInfo ? lastRecordProperty = recordingFactoryType . GetProperty ( LastRecordPropertyName ) ;
106+ PropertyInfo ? lastRecordProperty = recordingFactoryType . GetProperty ( Consts . LastRecordPropertyName ) ;
113107 object ? lastRecord = lastRecordProperty ? . GetValue ( recordingFactory ) ;
114108 if ( lastRecord == null )
115109 {
0 commit comments