Skip to content

Commit

Permalink
Resolve follow-up comments in PR "Create default arguments during bin…
Browse files Browse the repository at this point in the history
…ding" (#49588)
  • Loading branch information
RikkiGibson authored Nov 24, 2020
1 parent 88aca6f commit 1f97e38
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ internal BoundExpression BindDefaultArgument(SyntaxNode syntax, ParameterSymbol
BoundExpression defaultValue;
if (callerSourceLocation is object && parameter.IsCallerLineNumber)
{
int line = GetCallerLocation(syntax).SourceTree.GetDisplayLineNumber(callerSourceLocation.SourceSpan);
int line = callerSourceLocation.SourceTree.GetDisplayLineNumber(callerSourceLocation.SourceSpan);
defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
}
else if (callerSourceLocation is object && parameter.IsCallerFilePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,7 @@ private ConstantValue DefaultSyntaxValue
Debug.Assert(completedOnThisThread);
}

#if DEBUG
// If we accidentally access DefaultSyntaxValue in a reentrant manner, and we use a cancellation token
// that never expires, then the failure mode will be to spin wait forever.
// For debug purposes let's instead use a token which expires after a modest amount of time
// to wait for the default syntax value to be available.
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
var token = cts.Token;
#else
var token = CancellationToken.None;
#endif
state.SpinWaitComplete(CompletionPart.EndDefaultSyntaxValue, token);
state.SpinWaitComplete(CompletionPart.EndDefaultSyntaxValue, default(CancellationToken));
return _lazyDefaultSyntaxValue;
}
}
Expand Down

0 comments on commit 1f97e38

Please sign in to comment.