Skip to content

Commit

Permalink
Combine nearby loops to prevent crash building dotnet/runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed Aug 19, 2020
1 parent 9cf5d95 commit fd91c43
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1216,19 +1216,14 @@ public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
if (anyToRemove)
{
var explicitInterfaceImplementationsBuilder = ArrayBuilder<MethodSymbol>.GetInstance();
MethodSymbol uniqueClassOverride = null;
foreach (var method in explicitlyOverriddenMethods)
{
if (method.ContainingType.IsInterface)
{
explicitInterfaceImplementationsBuilder.Add(method);
}
}

explicitInterfaceImplementations = explicitInterfaceImplementationsBuilder.ToImmutableAndFree();

MethodSymbol uniqueClassOverride = null;
foreach (MethodSymbol method in explicitlyOverriddenMethods)
{
if (method.ContainingType.IsClassType())
{
if (uniqueClassOverride is { })
Expand All @@ -1242,6 +1237,8 @@ public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
}
}

explicitInterfaceImplementations = explicitInterfaceImplementationsBuilder.ToImmutableAndFree();

if (uniqueClassOverride is { })
{
Interlocked.CompareExchange(ref AccessUncommonFields()._lazyExplicitClassOverride, uniqueClassOverride, null);
Expand Down

0 comments on commit fd91c43

Please sign in to comment.