Skip to content

Commit

Permalink
Bug fixes and API use changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TyOverby committed May 2, 2017
1 parent 83c2f0d commit ee1a204
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ private MethodSymbol FindEntryPoint(CancellationToken cancellationToken, out Imm
if (IsCandidate && !IsTaskLike)
{
intOrVoidEntryPoints.Add(candidate);
perCandidateBag.Free();
}
else if (IsTaskLike)
{
Expand All @@ -1479,6 +1480,7 @@ private MethodSymbol FindEntryPoint(CancellationToken cancellationToken, out Imm
{
noMainFoundDiagnostics.Add(ErrorCode.WRN_InvalidMainSig, candidate.Locations.First(), candidate);
noMainFoundDiagnostics.AddRange(perCandidateBag);
perCandidateBag.Free();
}
}

Expand All @@ -1500,7 +1502,7 @@ private MethodSymbol FindEntryPoint(CancellationToken cancellationToken, out Imm
viableEntryPoints.Add(candidate);
}

if (viableEntryPoints.IsEmpty())
if (viableEntryPoints.Count == 0)
{
foreach (var (IsValid, Candidate, SpecificDiagnostics) in taskEntryPoints)
{
Expand All @@ -1524,9 +1526,15 @@ private MethodSymbol FindEntryPoint(CancellationToken cancellationToken, out Imm
diagnostics.AddRange(SpecificDiagnostics);
viableEntryPoints.Add(Candidate);
}

}
}

foreach (var (_, _, SpecificDiagnostics) in taskEntryPoints)
{
SpecificDiagnostics.Free();
}

if (viableEntryPoints.Count == 0)
{
diagnostics.AddRange(noMainFoundDiagnostics);
Expand Down Expand Up @@ -1570,6 +1578,8 @@ private MethodSymbol FindEntryPoint(CancellationToken cancellationToken, out Imm
entryPoint = viableEntryPoints[0];
}

intOrVoidEntryPoints.Free();
taskEntryPoints.Free();
viableEntryPoints.Free();
noMainFoundDiagnostics.Free();
return entryPoint;
Expand Down

0 comments on commit ee1a204

Please sign in to comment.