Skip to content

Commit

Permalink
Update MapperGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam committed Jul 26, 2024
1 parent efb701c commit 950ed95
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/Riok.Mapperly/MapperGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.CodeAnalysis;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Riok.Mapperly.Abstractions;
using Riok.Mapperly.Configuration;
Expand Down Expand Up @@ -29,25 +30,21 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
context.ReportDiagnostics(compilationDiagnostics);

var nestedCompilations = context
.MetadataReferencesProvider.Select(
(metadataReference, _) =>
{
if (metadataReference is CompilationReference compilationReference)
{
return compilationReference;
}

return null;
}
)
.Where(compilationReference => compilationReference is not null)
.Select((compilationReference, _) => compilationReference!.Compilation)
.MetadataReferencesProvider.Select((metadataReference, _) => (metadataReference as CompilationReference)?.Compilation)
.Collect();

Check failure on line 34 in src/Riok.Mapperly/MapperGenerator.cs

View workflow job for this annotation

GitHub Actions / package

'IncrementalValueProvider<Compilation>' does not contain a definition for 'Collect' and no accessible extension method 'Collect' accepting a first argument of type 'IncrementalValueProvider<Compilation>' could be found (are you missing a using directive or an assembly reference?)

// build the compilation context
var compilationContext = context
.CompilationProvider.Combine(nestedCompilations)
.Select(static (c, _) => new CompilationContext(c.Left, new WellKnownTypes(c.Left), c.Right, new FileNameBuilder()))
.Select(
static (c, _) =>
new CompilationContext(
c.Left,
new WellKnownTypes(c.Left),
c.Right.OfType<Compilation>().ToImmutableArray(),
new FileNameBuilder()
)
)
.WithTrackingName(MapperGeneratorStepNames.BuildCompilationContext);

// build the assembly default configurations
Expand Down

0 comments on commit 950ed95

Please sign in to comment.