Skip to content

Commit

Permalink
Update VerifySourceGenerators.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jul 28, 2024
1 parent b8b8dd0 commit d2601d5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Verify.SourceGenerators/VerifySourceGenerators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,23 @@ static ConversionResult Convert(GeneratorDriver target, IReadOnlyDictionary<stri

internal const string IgnoreContextName = $"{nameof(VerifySourceGenerators)}.{nameof(IgnoreGeneratedResult)}";

public static SettingsTask IgnoreGeneratedResult(this SettingsTask settingsTask, Func<GeneratedSourceResult, bool> shouldIgnore)
public static SettingsTask IgnoreGeneratedResult(this SettingsTask settings, Func<GeneratedSourceResult, bool> shouldIgnore)
{
settingsTask.CurrentSettings.IgnoreGeneratedResult(shouldIgnore);
return settingsTask;
settings.CurrentSettings.IgnoreGeneratedResult(shouldIgnore);
return settings;
}

public static void IgnoreGeneratedResult(this VerifySettings verifySettings, Func<GeneratedSourceResult, bool> shouldIgnore)
public static void IgnoreGeneratedResult(this VerifySettings settings, Func<GeneratedSourceResult, bool> shouldIgnore)
{
if (!verifySettings.Context.TryGetValue(IgnoreContextName, out var value))
if (!settings.Context.TryGetValue(IgnoreContextName, out var value))
{
value = new List<Func<GeneratedSourceResult, bool>>();
verifySettings.Context.Add(IgnoreContextName, value);
settings.Context.Add(IgnoreContextName, value);
}

if (value is not List<Func<GeneratedSourceResult, bool>> ignoreList)
{
throw new($"Unexpected value in {nameof(verifySettings.Context)}, type is not {nameof(List<Func<GeneratedSourceResult, bool>>)}");
throw new($"Unexpected value in {nameof(settings.Context)}, type is not {nameof(List<Func<GeneratedSourceResult, bool>>)}");
}

ignoreList.Add(shouldIgnore);
Expand Down

0 comments on commit d2601d5

Please sign in to comment.