提交 2732b85f 编写于 作者: C Cyrus Najmabadi

Use default literal

上级 fca0fde0
......@@ -12,8 +12,8 @@ namespace Microsoft.CodeAnalysis.Editor.Commands
[ExcludeFromCodeCoverage]
internal class CutCommandArgs : CommandArgs
{
public CutCommandArgs(ITextView textView, ITextBuffer subjectBuffer) :
base(textView, subjectBuffer)
public CutCommandArgs(ITextView textView, ITextBuffer subjectBuffer)
: base(textView, subjectBuffer)
{
}
}
......
......@@ -29,7 +29,7 @@ private ImmutableArray<TextSpan> GetSpans(BraceMatchingResult? result)
private class TestBraceMatchingService : IBraceMatchingService
{
public async Task<BraceMatchingResult?> GetMatchingBracesAsync(
Document document, int position, CancellationToken cancellationToken = default(CancellationToken))
Document document, int position, CancellationToken cancellationToken = default)
{
var text = (await document.GetTextAsync(cancellationToken)).ToString();
var braces = GetMatchingBraces(text, position);
......
......@@ -337,7 +337,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
string projectName = null,
bool isNewFile = false,
string existingFilename = null,
ImmutableArray<string> newFileFolderContainers = default(ImmutableArray<string>),
ImmutableArray<string> newFileFolderContainers = default,
string fullFilePath = null,
string newFileName = null,
string assertClassName = null,
......
......@@ -125,7 +125,7 @@ public Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document docume
public Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project)
{
return GetDiagnosticsAsync(project, document: null, span: default(TextSpan), getDocumentDiagnostics: false, getProjectDiagnostics: true);
return GetDiagnosticsAsync(project, document: null, span: default, getDocumentDiagnostics: false, getProjectDiagnostics: true);
}
private async Task SynchronizeGlobalAssetToRemoteHostIfNeededAsync(Workspace workspace)
......
......@@ -206,7 +206,7 @@ public static void EnsureSlot<T>(List<T> list, int i)
{
while (i >= list.Count)
{
list.Add(default(T));
list.Add(default);
}
}
}
......
......@@ -73,7 +73,7 @@ private static void EnsureSlot<T>(List<T> list, int i)
{
while (i >= list.Count)
{
list.Add(default(T));
list.Add(default);
}
}
}
......
......@@ -190,7 +190,7 @@ internal abstract class EditAndContinueTestHelpers
triviaEdits,
actualLineEdits,
diagnostics,
default(CancellationToken));
default);
diagnostics.Verify(newSource, expectedDiagnostics);
......
......@@ -21,7 +21,7 @@ private static IEnumerable<RudeEditDiagnosticDescription> ToDescription(this IEn
{
return diagnostics.Select(d => new RudeEditDiagnosticDescription(
d.Kind,
d.Span == default(TextSpan) ? null : newSource.Substring(d.Span.Start, d.Span.Length),
d.Span == default ? null : newSource.Substring(d.Span.Start, d.Span.Length),
d.Arguments,
firstLine: includeFirstLines ? GetLineAt(newSource, d.Span.Start) : null));
}
......
......@@ -137,7 +137,7 @@ protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspa
string expectedSourceTextAfterRefactoring,
string expectedDocumentName,
string destinationDocumentText,
ImmutableArray<string> destinationDocumentContainers = default(ImmutableArray<string>),
ImmutableArray<string> destinationDocumentContainers = default,
bool expectedCodeAction = true,
int index = 0,
Action<Workspace> onAfterWorkspaceCreated = null)
......
......@@ -104,7 +104,7 @@ public void RaiseDiagnosticsUpdated(DiagnosticsUpdatedArgs args)
public bool SupportGetDiagnostics => false;
public ImmutableArray<DiagnosticData> GetDiagnostics(Workspace workspace, ProjectId projectId, DocumentId documentId, object id, bool includeSuppressedDiagnostics = false, CancellationToken cancellationToken = default(CancellationToken))
public ImmutableArray<DiagnosticData> GetDiagnostics(Workspace workspace, ProjectId projectId, DocumentId documentId, object id, bool includeSuppressedDiagnostics = false, CancellationToken cancellationToken = default)
{
return includeSuppressedDiagnostics ? _diagnostics : _diagnostics.WhereAsArray(d => !d.IsSuppressed);
}
......
......@@ -26,7 +26,7 @@ public override Task<ImmutableArray<Diagnostic>> AnalyzeSemanticsAsync(Document
public override Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken)
{
return Task.FromResult(ImmutableArray.Create(
Diagnostic.Create(Descriptor, Location.Create(document.FilePath, default(TextSpan), default(LinePositionSpan)))));
Diagnostic.Create(Descriptor, Location.Create(document.FilePath, default, default))));
}
}
}
......@@ -15,12 +15,12 @@ internal class TestForegroundNotificationService : IForegroundNotificationServic
private readonly List<Task> _tasks = new List<Task>();
private readonly SimpleTaskQueue _queue = new SimpleTaskQueue(TaskScheduler.Default);
public void RegisterNotification(Func<bool> action, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
public void RegisterNotification(Func<bool> action, IAsyncToken asyncToken, CancellationToken cancellationToken = default)
{
RegisterNotification(action, 0, asyncToken, cancellationToken);
}
public void RegisterNotification(Func<bool> action, int delayInMS, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
public void RegisterNotification(Func<bool> action, int delayInMS, IAsyncToken asyncToken, CancellationToken cancellationToken = default)
{
Task task;
lock (_gate)
......@@ -44,12 +44,12 @@ private void Execute_NoLock(Func<bool> action, IAsyncToken asyncToken, Cancellat
}
}
public void RegisterNotification(Action action, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
public void RegisterNotification(Action action, IAsyncToken asyncToken, CancellationToken cancellationToken = default)
{
RegisterNotification(action, 0, asyncToken, cancellationToken);
}
public void RegisterNotification(Action action, int delayInMS, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
public void RegisterNotification(Action action, int delayInMS, IAsyncToken asyncToken, CancellationToken cancellationToken = default)
{
Task task;
lock (_gate)
......
......@@ -27,7 +27,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
public sealed class Factory : IHostDependentFormattingRuleFactoryService
{
public int BaseIndentation = 0;
public TextSpan TextSpan = default(TextSpan);
public TextSpan TextSpan = default;
public bool UseBaseIndentation = false;
public bool ShouldUseBaseIndentation(Document document)
......
......@@ -41,7 +41,7 @@ public partial class TestWorkspace
private class TestDocumentationProvider : DocumentationProvider
{
protected override string GetDocumentationForSymbol(string documentationMemberID, CultureInfo preferredCulture, CancellationToken cancellationToken = default(CancellationToken))
protected override string GetDocumentationForSymbol(string documentationMemberID, CultureInfo preferredCulture, CancellationToken cancellationToken = default)
{
return string.Format("<member name='{0}'><summary>{0}</summary></member>", documentationMemberID);
}
......@@ -143,7 +143,7 @@ public static TestWorkspace Create(string xmlDefinition, bool completed = true,
var aliases = projectReference.Attributes(AliasAttributeName).Select(a => a.Value).ToImmutableArray();
workspace.OnProjectReferenceAdded(fromProject.Id, new ProjectReference(toProject.Id, aliases.Any() ? aliases : default(ImmutableArray<string>)));
workspace.OnProjectReferenceAdded(fromProject.Id, new ProjectReference(toProject.Id, aliases.Any() ? aliases : default));
}
}
......@@ -786,7 +786,7 @@ private static MetadataReference CreateMetadataReferenceFromSource(TestWorkspace
var compilation = CreateCompilation(workspace, referencedSource);
var aliasElement = referencedSource.Attribute("Aliases")?.Value;
var aliases = aliasElement != null ? aliasElement.Split(',').Select(s => s.Trim()).ToImmutableArray() : default(ImmutableArray<string>);
var aliases = aliasElement != null ? aliasElement.Split(',').Select(s => s.Trim()).ToImmutableArray() : default;
bool includeXmlDocComments = false;
var includeXmlDocCommentsAttribute = referencedSource.Attribute(IncludeXmlDocCommentsAttributeName);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册