提交 7a105a46 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #14980 from CyrusNajmabadi/dogfooding

Fix function naming.
...@@ -23,18 +23,8 @@ internal abstract class CommandArgs ...@@ -23,18 +23,8 @@ internal abstract class CommandArgs
public CommandArgs(ITextView textView, ITextBuffer subjectBuffer) public CommandArgs(ITextView textView, ITextBuffer subjectBuffer)
{ {
if (textView == null) this.TextView = textView ?? throw new ArgumentNullException(nameof(textView));
{ this.SubjectBuffer = subjectBuffer ?? throw new ArgumentNullException(nameof(subjectBuffer));
throw new ArgumentNullException(nameof(textView));
}
if (subjectBuffer == null)
{
throw new ArgumentNullException(nameof(subjectBuffer));
}
this.TextView = textView;
this.SubjectBuffer = subjectBuffer;
} }
} }
} }
\ No newline at end of file
...@@ -18,12 +18,7 @@ internal class ExportContentTypeLanguageServiceAttribute : ExportLanguageService ...@@ -18,12 +18,7 @@ internal class ExportContentTypeLanguageServiceAttribute : ExportLanguageService
public ExportContentTypeLanguageServiceAttribute(string defaultContentType, string language, string layer = ServiceLayer.Default) public ExportContentTypeLanguageServiceAttribute(string defaultContentType, string language, string layer = ServiceLayer.Default)
: base(typeof(IContentTypeLanguageService), language, layer) : base(typeof(IContentTypeLanguageService), language, layer)
{ {
if (defaultContentType == null) this.DefaultContentType = defaultContentType ?? throw new ArgumentNullException(nameof(defaultContentType));
{
throw new ArgumentNullException(nameof(defaultContentType));
}
this.DefaultContentType = defaultContentType;
} }
} }
} }
...@@ -14,12 +14,7 @@ internal class ExportBraceMatcherAttribute : ExportAttribute ...@@ -14,12 +14,7 @@ internal class ExportBraceMatcherAttribute : ExportAttribute
public ExportBraceMatcherAttribute(string language) public ExportBraceMatcherAttribute(string language)
: base(typeof(IBraceMatcher)) : base(typeof(IBraceMatcher))
{ {
if (language == null) this.Language = language ?? throw new ArgumentNullException(nameof(language));
{
throw new ArgumentNullException(nameof(language));
}
this.Language = language;
} }
} }
} }
...@@ -16,18 +16,8 @@ internal class ExportCompletionProviderMef1Attribute : ExportAttribute ...@@ -16,18 +16,8 @@ internal class ExportCompletionProviderMef1Attribute : ExportAttribute
public ExportCompletionProviderMef1Attribute(string name, string language) public ExportCompletionProviderMef1Attribute(string name, string language)
: base(typeof(CompletionProvider)) : base(typeof(CompletionProvider))
{ {
if (name == null) this.Name = name ?? throw new ArgumentNullException(nameof(name));
{ this.Language = language ?? throw new ArgumentNullException(nameof(language));
throw new ArgumentNullException(nameof(name));
}
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.Name = name;
this.Language = language;
} }
} }
} }
...@@ -16,12 +16,7 @@ internal class ExportHighlighterAttribute : ExportAttribute ...@@ -16,12 +16,7 @@ internal class ExportHighlighterAttribute : ExportAttribute
public ExportHighlighterAttribute(string language) public ExportHighlighterAttribute(string language)
: base(typeof(IHighlighter)) : base(typeof(IHighlighter))
{ {
if (language == null) this.Language = language ?? throw new ArgumentNullException(nameof(language));
{
throw new ArgumentNullException(nameof(language));
}
this.Language = language;
} }
} }
} }
\ No newline at end of file
...@@ -15,18 +15,8 @@ internal class ExportQuickInfoProviderAttribute : ExportAttribute ...@@ -15,18 +15,8 @@ internal class ExportQuickInfoProviderAttribute : ExportAttribute
public ExportQuickInfoProviderAttribute(string name, string language) public ExportQuickInfoProviderAttribute(string name, string language)
: base(typeof(IQuickInfoProvider)) : base(typeof(IQuickInfoProvider))
{ {
if (name == null) this.Name = name ?? throw new ArgumentNullException(nameof(name));
{ this.Language = language ?? throw new ArgumentNullException(nameof(language));
throw new ArgumentNullException(nameof(name));
}
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.Name = name;
this.Language = language;
} }
} }
} }
...@@ -32,10 +32,10 @@ public static void Format(this ITextBuffer buffer, TextSpan span, IEnumerable<IF ...@@ -32,10 +32,10 @@ public static void Format(this ITextBuffer buffer, TextSpan span, IEnumerable<IF
public static CaretPreservingEditTransaction CreateEditTransaction( public static CaretPreservingEditTransaction CreateEditTransaction(
this ITextView view, string description, ITextUndoHistoryRegistry registry, IEditorOperationsFactoryService service) this ITextView view, string description, ITextUndoHistoryRegistry registry, IEditorOperationsFactoryService service)
{ {
var transaction = new CaretPreservingEditTransaction(description, view, registry, service); return new CaretPreservingEditTransaction(description, view, registry, service)
transaction.MergePolicy = AutomaticCodeChangeMergePolicy.Instance; {
MergePolicy = AutomaticCodeChangeMergePolicy.Instance
return transaction; };
} }
public static SyntaxToken FindToken(this ITextSnapshot snapshot, int position, CancellationToken cancellationToken) public static SyntaxToken FindToken(this ITextSnapshot snapshot, int position, CancellationToken cancellationToken)
......
...@@ -114,12 +114,7 @@ private void OnPresentationSourceChanged(object sender, SourceChangedEventArgs a ...@@ -114,12 +114,7 @@ private void OnPresentationSourceChanged(object sender, SourceChangedEventArgs a
private void ConnectToPresentationSource(PresentationSource presentationSource) private void ConnectToPresentationSource(PresentationSource presentationSource)
{ {
if (presentationSource == null) _presentationSource = presentationSource ?? throw new ArgumentNullException(nameof(presentationSource));
{
throw new ArgumentNullException(nameof(presentationSource));
}
_presentationSource = presentationSource;
if (Application.Current != null && Application.Current.MainWindow != null) if (Application.Current != null && Application.Current.MainWindow != null)
{ {
......
...@@ -34,12 +34,13 @@ public override GraphicsResult GetGraphics(IWpfTextView view, Geometry bounds) ...@@ -34,12 +34,13 @@ public override GraphicsResult GetGraphics(IWpfTextView view, Geometry bounds)
{ {
Initialize(view); Initialize(view);
var border = new Border(); var border = new Border()
border.BorderBrush = _graphicsTagBrush; {
border.BorderThickness = new Thickness(0, 0, 0, bottom: 1); BorderBrush = _graphicsTagBrush,
border.Height = 1; BorderThickness = new Thickness(0, 0, 0, bottom: 1),
border.Width = view.ViewportWidth; Height = 1,
Width = view.ViewportWidth
};
EventHandler viewportWidthChangedHandler = (s, e) => EventHandler viewportWidthChangedHandler = (s, e) =>
{ {
border.Width = view.ViewportWidth; border.Width = view.ViewportWidth;
......
...@@ -23,17 +23,12 @@ internal class NavigateToItemProviderFactory : INavigateToItemProviderFactory ...@@ -23,17 +23,12 @@ internal class NavigateToItemProviderFactory : INavigateToItemProviderFactory
[ImportMany] IEnumerable<Lazy<INavigateToHostVersionService, VisualStudioVersionMetadata>> hostServices, [ImportMany] IEnumerable<Lazy<INavigateToHostVersionService, VisualStudioVersionMetadata>> hostServices,
[ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners) [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
{ {
if (glyphService == null)
{
throw new ArgumentNullException(nameof(glyphService));
}
if (asyncListeners == null) if (asyncListeners == null)
{ {
throw new ArgumentNullException(nameof(asyncListeners)); throw new ArgumentNullException(nameof(asyncListeners));
} }
_glyphService = glyphService; _glyphService = glyphService ?? throw new ArgumentNullException(nameof(glyphService));
_hostServices = hostServices; _hostServices = hostServices;
_asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.NavigateTo); _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.NavigateTo);
} }
......
...@@ -312,15 +312,19 @@ private void PushSelectedItemsToPresenter(NavigationBarSelectedTypeAndMember sel ...@@ -312,15 +312,19 @@ private void PushSelectedItemsToPresenter(NavigationBarSelectedTypeAndMember sel
if (oldRight != null) if (oldRight != null)
{ {
newRight = new NavigationBarPresentedItem(oldRight.Text, oldRight.Glyph, oldRight.Spans, oldRight.ChildItems, oldRight.Bolded, oldRight.Grayed || selectedItems.ShowMemberItemGrayed); newRight = new NavigationBarPresentedItem(oldRight.Text, oldRight.Glyph, oldRight.Spans, oldRight.ChildItems, oldRight.Bolded, oldRight.Grayed || selectedItems.ShowMemberItemGrayed)
newRight.TrackingSpans = oldRight.TrackingSpans; {
TrackingSpans = oldRight.TrackingSpans
};
listOfRight.Add(newRight); listOfRight.Add(newRight);
} }
if (oldLeft != null) if (oldLeft != null)
{ {
newLeft = new NavigationBarPresentedItem(oldLeft.Text, oldLeft.Glyph, oldLeft.Spans, listOfRight, oldLeft.Bolded, oldLeft.Grayed || selectedItems.ShowTypeItemGrayed); newLeft = new NavigationBarPresentedItem(oldLeft.Text, oldLeft.Glyph, oldLeft.Spans, listOfRight, oldLeft.Bolded, oldLeft.Grayed || selectedItems.ShowTypeItemGrayed)
newLeft.TrackingSpans = oldLeft.TrackingSpans; {
TrackingSpans = oldLeft.TrackingSpans
};
listOfLeft.Add(newLeft); listOfLeft.Add(newLeft);
} }
......
...@@ -29,18 +29,8 @@ internal partial class NavigateToHighlightReferenceCommandHandler : ...@@ -29,18 +29,8 @@ internal partial class NavigateToHighlightReferenceCommandHandler :
IOutliningManagerService outliningManagerService, IOutliningManagerService outliningManagerService,
IViewTagAggregatorFactoryService tagAggregatorFactory) IViewTagAggregatorFactoryService tagAggregatorFactory)
{ {
if (outliningManagerService == null) _outliningManagerService = outliningManagerService ?? throw new ArgumentNullException(nameof(outliningManagerService));
{ _tagAggregatorFactory = tagAggregatorFactory ?? throw new ArgumentNullException(nameof(tagAggregatorFactory));
throw new ArgumentNullException(nameof(outliningManagerService));
}
if (tagAggregatorFactory == null)
{
throw new ArgumentNullException(nameof(tagAggregatorFactory));
}
_outliningManagerService = outliningManagerService;
_tagAggregatorFactory = tagAggregatorFactory;
} }
public CommandState GetCommandState(NavigateToHighlightedReferenceCommandArgs args, Func<CommandState> nextHandler) public CommandState GetCommandState(NavigateToHighlightedReferenceCommandArgs args, Func<CommandState> nextHandler)
......
...@@ -18,12 +18,7 @@ internal partial class SmartIndent : ISmartIndent ...@@ -18,12 +18,7 @@ internal partial class SmartIndent : ISmartIndent
public SmartIndent(ITextView textView) public SmartIndent(ITextView textView)
{ {
if (textView == null) _textView = textView ?? throw new ArgumentNullException(nameof(textView));
{
throw new ArgumentNullException(nameof(textView));
}
_textView = textView;
} }
public int? GetDesiredIndentation(ITextSnapshotLine line) public int? GetDesiredIndentation(ITextSnapshotLine line)
......
...@@ -15,11 +15,8 @@ internal class SynchronizationContextTaskScheduler : TaskScheduler ...@@ -15,11 +15,8 @@ internal class SynchronizationContextTaskScheduler : TaskScheduler
internal SynchronizationContextTaskScheduler(SynchronizationContext synchronizationContext) internal SynchronizationContextTaskScheduler(SynchronizationContext synchronizationContext)
{ {
if (synchronizationContext == null)
throw new ArgumentNullException(nameof(synchronizationContext));
_postCallback = new SendOrPostCallback(PostCallback); _postCallback = new SendOrPostCallback(PostCallback);
_synchronizationContext = synchronizationContext; _synchronizationContext = synchronizationContext ?? throw new ArgumentNullException(nameof(synchronizationContext));
} }
public override Int32 MaximumConcurrencyLevel public override Int32 MaximumConcurrencyLevel
......
...@@ -83,12 +83,7 @@ public void AddTag(ITagSpan<TTag> tag) ...@@ -83,12 +83,7 @@ public void AddTag(ITagSpan<TTag> tag)
/// </summary> /// </summary>
public void SetSpansTagged(IEnumerable<DocumentSnapshotSpan> spansTagged) public void SetSpansTagged(IEnumerable<DocumentSnapshotSpan> spansTagged)
{ {
if (spansTagged == null) this._spansTagged = spansTagged ?? throw new ArgumentNullException(nameof(spansTagged));
{
throw new ArgumentNullException(nameof(spansTagged));
}
this._spansTagged = spansTagged;
} }
public IEnumerable<ITagSpan<TTag>> GetExistingTags(SnapshotSpan span) public IEnumerable<ITagSpan<TTag>> GetExistingTags(SnapshotSpan span)
......
...@@ -27,23 +27,13 @@ internal class ExportSuppressionFixProviderAttribute : ExportAttribute ...@@ -27,23 +27,13 @@ internal class ExportSuppressionFixProviderAttribute : ExportAttribute
params string[] languages) params string[] languages)
: base(typeof(ISuppressionFixProvider)) : base(typeof(ISuppressionFixProvider))
{ {
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (languages == null)
{
throw new ArgumentNullException(nameof(languages));
}
if (languages.Length == 0) if (languages.Length == 0)
{ {
throw new ArgumentException("languages"); throw new ArgumentException("languages");
} }
this.Name = name; this.Name = name ?? throw new ArgumentNullException(nameof(name));
this.Languages = languages; this.Languages = languages ?? throw new ArgumentNullException(nameof(languages));
} }
} }
} }
...@@ -21,12 +21,7 @@ public class DocumentNavigationOperation : CodeActionOperation ...@@ -21,12 +21,7 @@ public class DocumentNavigationOperation : CodeActionOperation
public DocumentNavigationOperation(DocumentId documentId, int position = 0) public DocumentNavigationOperation(DocumentId documentId, int position = 0)
{ {
if (documentId == null) _documentId = documentId ?? throw new ArgumentNullException(nameof(documentId));
{
throw new ArgumentNullException(nameof(documentId));
}
_documentId = documentId;
_position = position; _position = position;
} }
......
...@@ -32,18 +32,8 @@ public struct TaggedText ...@@ -32,18 +32,8 @@ public struct TaggedText
/// <param name="text">The actual text to be displayed.</param> /// <param name="text">The actual text to be displayed.</param>
public TaggedText(string tag, string text) public TaggedText(string tag, string text)
{ {
if (tag == null) Tag = tag ?? throw new ArgumentNullException(nameof(tag));
{ Text = text ?? throw new ArgumentNullException(nameof(text));
throw new ArgumentNullException(nameof(tag));
}
if (text == null)
{
throw new ArgumentNullException(nameof(text));
}
Tag = tag;
Text = text;
} }
public override string ToString() public override string ToString()
......
...@@ -85,27 +85,12 @@ internal IReadOnlyList<CompletionItem> Items ...@@ -85,27 +85,12 @@ internal IReadOnlyList<CompletionItem> Items
OptionSet options, OptionSet options,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
if (provider == null) this.Provider = provider ?? throw new ArgumentNullException(nameof(provider));
{ this.Document = document ?? throw new ArgumentNullException(nameof(document));
throw new ArgumentNullException(nameof(provider));
}
if (document == null)
{
throw new ArgumentNullException(nameof(document));
}
if (options == null)
{
throw new ArgumentException(nameof(options));
}
this.Provider = provider;
this.Document = document;
this.Position = position; this.Position = position;
this.CompletionListSpan = defaultSpan; this.CompletionListSpan = defaultSpan;
this.Trigger = trigger; this.Trigger = trigger;
this.Options = options; this.Options = options ?? throw new ArgumentException(nameof(options));
this.CancellationToken = cancellationToken; this.CancellationToken = cancellationToken;
_items = new List<CompletionItem>(); _items = new List<CompletionItem>();
} }
......
...@@ -20,18 +20,8 @@ public sealed class ExportCompletionProviderAttribute : ExportAttribute ...@@ -20,18 +20,8 @@ public sealed class ExportCompletionProviderAttribute : ExportAttribute
public ExportCompletionProviderAttribute(string name, string language) public ExportCompletionProviderAttribute(string name, string language)
: base(typeof(CompletionProvider)) : base(typeof(CompletionProvider))
{ {
if (name == null) this.Name = name ?? throw new ArgumentNullException(nameof(name));
{ this.Language = language ?? throw new ArgumentNullException(nameof(language));
throw new ArgumentNullException(nameof(name));
}
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.Name = name;
this.Language = language;
} }
} }
} }
...@@ -304,14 +304,15 @@ internal XElement CreateXElement() ...@@ -304,14 +304,15 @@ internal XElement CreateXElement()
internal static NamingStyle FromXElement(XElement namingStyleElement) internal static NamingStyle FromXElement(XElement namingStyleElement)
{ {
var result = new NamingStyle(); return new NamingStyle()
result.ID = Guid.Parse(namingStyleElement.Attribute(nameof(ID)).Value); {
result.Name = namingStyleElement.Attribute(nameof(Name)).Value; ID = Guid.Parse(namingStyleElement.Attribute(nameof(ID)).Value),
result.Prefix = namingStyleElement.Attribute(nameof(Prefix)).Value; Name = namingStyleElement.Attribute(nameof(Name)).Value,
result.Suffix = namingStyleElement.Attribute(nameof(Suffix)).Value; Prefix = namingStyleElement.Attribute(nameof(Prefix)).Value,
result.WordSeparator = namingStyleElement.Attribute(nameof(WordSeparator)).Value; Suffix = namingStyleElement.Attribute(nameof(Suffix)).Value,
result.CapitalizationScheme = (Capitalization)Enum.Parse(typeof(Capitalization), namingStyleElement.Attribute(nameof(CapitalizationScheme)).Value); WordSeparator = namingStyleElement.Attribute(nameof(WordSeparator)).Value,
return result; CapitalizationScheme = (Capitalization)Enum.Parse(typeof(Capitalization), namingStyleElement.Attribute(nameof(CapitalizationScheme)).Value)
};
} }
} }
} }
\ No newline at end of file
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
namespace Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles namespace Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles
...@@ -34,11 +31,12 @@ internal XElement CreateXElement() ...@@ -34,11 +31,12 @@ internal XElement CreateXElement()
internal static SerializableNamingRule FromXElement(XElement namingRuleElement) internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
{ {
var result = new SerializableNamingRule(); return new SerializableNamingRule()
result.EnforcementLevel = (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), namingRuleElement.Attribute(nameof(EnforcementLevel)).Value); {
result.NamingStyleID = Guid.Parse(namingRuleElement.Attribute(nameof(NamingStyleID)).Value); EnforcementLevel = (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), namingRuleElement.Attribute(nameof(EnforcementLevel)).Value),
result.SymbolSpecificationID = Guid.Parse(namingRuleElement.Attribute(nameof(SymbolSpecificationID)).Value); NamingStyleID = Guid.Parse(namingRuleElement.Attribute(nameof(NamingStyleID)).Value),
return result; SymbolSpecificationID = Guid.Parse(namingRuleElement.Attribute(nameof(SymbolSpecificationID)).Value)
};
} }
} }
} }
\ No newline at end of file
...@@ -20,7 +20,7 @@ internal class SerializableNamingStylePreferencesInfo ...@@ -20,7 +20,7 @@ internal class SerializableNamingStylePreferencesInfo
public List<SymbolSpecification> SymbolSpecifications; public List<SymbolSpecification> SymbolSpecifications;
public List<NamingStyle> NamingStyles; public List<NamingStyle> NamingStyles;
public List<SerializableNamingRule> NamingRules; public List<SerializableNamingRule> NamingRules;
private readonly static int _serializationVersion = 3; private readonly static int s_serializationVersion = 3;
internal SerializableNamingStylePreferencesInfo() internal SerializableNamingStylePreferencesInfo()
{ {
...@@ -47,7 +47,7 @@ public NamingStylePreferencesInfo GetPreferencesInfo() ...@@ -47,7 +47,7 @@ public NamingStylePreferencesInfo GetPreferencesInfo()
internal XElement CreateXElement() internal XElement CreateXElement()
{ {
return new XElement("NamingPreferencesInfo", return new XElement("NamingPreferencesInfo",
new XAttribute("SerializationVersion", _serializationVersion), new XAttribute("SerializationVersion", s_serializationVersion),
CreateSymbolSpecificationListXElement(), CreateSymbolSpecificationListXElement(),
CreateNamingStyleListXElement(), CreateNamingStyleListXElement(),
CreateNamingRuleTreeXElement()); CreateNamingRuleTreeXElement());
...@@ -94,7 +94,7 @@ internal static SerializableNamingStylePreferencesInfo FromXElement(XElement nam ...@@ -94,7 +94,7 @@ internal static SerializableNamingStylePreferencesInfo FromXElement(XElement nam
var namingPreferencesInfo = new SerializableNamingStylePreferencesInfo(); var namingPreferencesInfo = new SerializableNamingStylePreferencesInfo();
var serializationVersion = int.Parse(namingPreferencesInfoElement.Attribute("SerializationVersion").Value); var serializationVersion = int.Parse(namingPreferencesInfoElement.Attribute("SerializationVersion").Value);
if (serializationVersion != _serializationVersion) if (serializationVersion != s_serializationVersion)
{ {
namingPreferencesInfoElement = XElement.Parse(SimplificationOptions.NamingPreferences.DefaultValue); namingPreferencesInfoElement = XElement.Parse(SimplificationOptions.NamingPreferences.DefaultValue);
} }
......
...@@ -133,10 +133,11 @@ private XElement CreateModifiersXElement() ...@@ -133,10 +133,11 @@ private XElement CreateModifiersXElement()
internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement)
{ {
var result = new SymbolSpecification(); var result = new SymbolSpecification()
result.ID = Guid.Parse(symbolSpecificationElement.Attribute(nameof(ID)).Value); {
result.Name = symbolSpecificationElement.Attribute(nameof(Name)).Value; ID = Guid.Parse(symbolSpecificationElement.Attribute(nameof(ID)).Value),
Name = symbolSpecificationElement.Attribute(nameof(Name)).Value
};
result.PopulateSymbolKindListFromXElement(symbolSpecificationElement.Element(nameof(ApplicableSymbolKindList))); result.PopulateSymbolKindListFromXElement(symbolSpecificationElement.Element(nameof(ApplicableSymbolKindList)));
result.PopulateAccessibilityListFromXElement(symbolSpecificationElement.Element(nameof(ApplicableAccessibilityList))); result.PopulateAccessibilityListFromXElement(symbolSpecificationElement.Element(nameof(ApplicableAccessibilityList)));
result.PopulateModifierListFromXElement(symbolSpecificationElement.Element(nameof(RequiredModifierList))); result.PopulateModifierListFromXElement(symbolSpecificationElement.Element(nameof(RequiredModifierList)));
......
...@@ -19,18 +19,18 @@ internal abstract partial class AbstractNavigateToSearchService ...@@ -19,18 +19,18 @@ internal abstract partial class AbstractNavigateToSearchService
public static Task<ImmutableArray<INavigateToSearchResult>> SearchProjectInCurrentProcessAsync( public static Task<ImmutableArray<INavigateToSearchResult>> SearchProjectInCurrentProcessAsync(
Project project, string searchPattern, CancellationToken cancellationToken) Project project, string searchPattern, CancellationToken cancellationToken)
{ {
return FindNavigableDeclaredSymbolInfos( return FindNavigableDeclaredSymbolInfosAsync(
project, searchDocument: null, pattern: searchPattern, cancellationToken: cancellationToken); project, searchDocument: null, pattern: searchPattern, cancellationToken: cancellationToken);
} }
public static Task<ImmutableArray<INavigateToSearchResult>> SearchDocumentInCurrentProcessAsync( public static Task<ImmutableArray<INavigateToSearchResult>> SearchDocumentInCurrentProcessAsync(
Document document, string searchPattern, CancellationToken cancellationToken) Document document, string searchPattern, CancellationToken cancellationToken)
{ {
return FindNavigableDeclaredSymbolInfos( return FindNavigableDeclaredSymbolInfosAsync(
document.Project, document, searchPattern, cancellationToken); document.Project, document, searchPattern, cancellationToken);
} }
private static async Task<ImmutableArray<INavigateToSearchResult>> FindNavigableDeclaredSymbolInfos( private static async Task<ImmutableArray<INavigateToSearchResult>> FindNavigableDeclaredSymbolInfosAsync(
Project project, Document searchDocument, string pattern, CancellationToken cancellationToken) Project project, Document searchDocument, string pattern, CancellationToken cancellationToken)
{ {
var containsDots = pattern.IndexOf('.') >= 0; var containsDots = pattern.IndexOf('.') >= 0;
......
...@@ -15,18 +15,8 @@ internal class ExportSignatureHelpProviderAttribute : ExportAttribute ...@@ -15,18 +15,8 @@ internal class ExportSignatureHelpProviderAttribute : ExportAttribute
public ExportSignatureHelpProviderAttribute(string name, string language) public ExportSignatureHelpProviderAttribute(string name, string language)
: base(typeof(ISignatureHelpProvider)) : base(typeof(ISignatureHelpProvider))
{ {
if (name == null) this.Name = name ?? throw new ArgumentNullException(nameof(name));
{ this.Language = language ?? throw new ArgumentNullException(nameof(language));
throw new ArgumentNullException(nameof(name));
}
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.Name = name;
this.Language = language;
} }
} }
} }
...@@ -15,18 +15,8 @@ internal class ExportPerLanguageIncrementalAnalyzerProviderAttribute : ExportAtt ...@@ -15,18 +15,8 @@ internal class ExportPerLanguageIncrementalAnalyzerProviderAttribute : ExportAtt
public ExportPerLanguageIncrementalAnalyzerProviderAttribute(string name, string language) public ExportPerLanguageIncrementalAnalyzerProviderAttribute(string name, string language)
: base(typeof(IPerLanguageIncrementalAnalyzerProvider)) : base(typeof(IPerLanguageIncrementalAnalyzerProvider))
{ {
if (name == null) this.Name = name ?? throw new ArgumentNullException(nameof(name));
{ this.Language = language ?? throw new ArgumentNullException(nameof(language));
throw new ArgumentNullException(nameof(name));
}
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.Name = name;
this.Language = language;
} }
} }
} }
...@@ -36,12 +36,7 @@ internal abstract partial class AbstractEditorFactory : IVsEditorFactory, IVsEdi ...@@ -36,12 +36,7 @@ internal abstract partial class AbstractEditorFactory : IVsEditorFactory, IVsEdi
protected AbstractEditorFactory(Package package) protected AbstractEditorFactory(Package package)
{ {
if (package == null) _package = package ?? throw new ArgumentNullException(nameof(package));
{
throw new ArgumentNullException(nameof(package));
}
_package = package;
_componentModel = (IComponentModel)ServiceProvider.GetService(typeof(SComponentModel)); _componentModel = (IComponentModel)ServiceProvider.GetService(typeof(SComponentModel));
_editorAdaptersFactoryService = _componentModel.GetService<IVsEditorAdaptersFactoryService>(); _editorAdaptersFactoryService = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
......
...@@ -21,19 +21,9 @@ internal sealed class ProvideAutomationPropertiesAttribute : RegistrationAttribu ...@@ -21,19 +21,9 @@ internal sealed class ProvideAutomationPropertiesAttribute : RegistrationAttribu
public ProvideAutomationPropertiesAttribute(string category, string page, string packageGuid, int profileNodeLabelId, int profileNodeDescriptionId, string resourcePackageGuid = null) public ProvideAutomationPropertiesAttribute(string category, string page, string packageGuid, int profileNodeLabelId, int profileNodeDescriptionId, string resourcePackageGuid = null)
{ {
if (category == null)
{
throw new ArgumentNullException(nameof(category));
}
if (page == null)
{
throw new ArgumentNullException(nameof(page));
}
this.PackageGuid = Guid.Parse(packageGuid); this.PackageGuid = Guid.Parse(packageGuid);
this.Category = category; this.Category = category ?? throw new ArgumentNullException(nameof(category));
this.Page = page; this.Page = page ?? throw new ArgumentNullException(nameof(page));
this.ProfileNodeLabelId = profileNodeLabelId; this.ProfileNodeLabelId = profileNodeLabelId;
this.ProfileNodeDescriptionId = profileNodeDescriptionId; this.ProfileNodeDescriptionId = profileNodeDescriptionId;
......
...@@ -40,12 +40,7 @@ internal abstract class AbstractContainedLanguage : IDisposable ...@@ -40,12 +40,7 @@ internal abstract class AbstractContainedLanguage : IDisposable
public AbstractContainedLanguage( public AbstractContainedLanguage(
AbstractProject project) AbstractProject project)
{ {
if (project == null) this.Project = project ?? throw new ArgumentNullException(nameof(project));
{
throw new ArgumentNullException(nameof(project));
}
this.Project = project;
} }
/// <summary> /// <summary>
...@@ -54,12 +49,7 @@ internal abstract class AbstractContainedLanguage : IDisposable ...@@ -54,12 +49,7 @@ internal abstract class AbstractContainedLanguage : IDisposable
/// <param name="subjectBuffer"></param> /// <param name="subjectBuffer"></param>
protected void SetSubjectBuffer(ITextBuffer subjectBuffer) protected void SetSubjectBuffer(ITextBuffer subjectBuffer)
{ {
if (subjectBuffer == null) this.SubjectBuffer = subjectBuffer ?? throw new ArgumentNullException(nameof(subjectBuffer));
{
throw new ArgumentNullException(nameof(subjectBuffer));
}
this.SubjectBuffer = subjectBuffer;
} }
/// <summary> /// <summary>
...@@ -67,12 +57,7 @@ protected void SetSubjectBuffer(ITextBuffer subjectBuffer) ...@@ -67,12 +57,7 @@ protected void SetSubjectBuffer(ITextBuffer subjectBuffer)
/// </summary> /// </summary>
protected void SetDataBuffer(ITextBuffer dataBuffer) protected void SetDataBuffer(ITextBuffer dataBuffer)
{ {
if (dataBuffer == null) this.DataBuffer = dataBuffer ?? throw new ArgumentNullException(nameof(dataBuffer));
{
throw new ArgumentNullException(nameof(dataBuffer));
}
this.DataBuffer = dataBuffer;
} }
public abstract void Dispose(); public abstract void Dispose();
......
...@@ -28,12 +28,7 @@ public sealed class ApplyChangesOperation : CodeActionOperation ...@@ -28,12 +28,7 @@ public sealed class ApplyChangesOperation : CodeActionOperation
public ApplyChangesOperation(Solution changedSolution) public ApplyChangesOperation(Solution changedSolution)
{ {
if (changedSolution == null) ChangedSolution = changedSolution ?? throw new ArgumentNullException(nameof(changedSolution));
{
throw new ArgumentNullException(nameof(changedSolution));
}
ChangedSolution = changedSolution;
} }
internal override bool ApplyDuringTests => true; internal override bool ApplyDuringTests => true;
......
...@@ -15,12 +15,7 @@ public sealed class OpenDocumentOperation : CodeActionOperation ...@@ -15,12 +15,7 @@ public sealed class OpenDocumentOperation : CodeActionOperation
public OpenDocumentOperation(DocumentId documentId, bool activateIfAlreadyOpen = false) public OpenDocumentOperation(DocumentId documentId, bool activateIfAlreadyOpen = false)
{ {
if (documentId == null) _documentId = documentId ?? throw new ArgumentNullException(nameof(documentId));
{
throw new ArgumentNullException(nameof(documentId));
}
_documentId = documentId;
_activate = activateIfAlreadyOpen; _activate = activateIfAlreadyOpen;
} }
......
...@@ -19,18 +19,13 @@ internal class ExportCodeCleanupProvider : ExportAttribute ...@@ -19,18 +19,13 @@ internal class ExportCodeCleanupProvider : ExportAttribute
public ExportCodeCleanupProvider(string name, params string[] languages) public ExportCodeCleanupProvider(string name, params string[] languages)
: base(typeof(ICodeCleanupProvider)) : base(typeof(ICodeCleanupProvider))
{ {
if (languages == null)
{
throw new ArgumentNullException(nameof(languages));
}
if (languages.Length == 0) if (languages.Length == 0)
{ {
throw new ArgumentException("languages"); throw new ArgumentException("languages");
} }
this.Name = name; this.Name = name;
this.Languages = languages; this.Languages = languages ?? throw new ArgumentNullException(nameof(languages));
} }
} }
} }
...@@ -32,11 +32,6 @@ public sealed class ExportCodeFixProviderAttribute : ExportAttribute ...@@ -32,11 +32,6 @@ public sealed class ExportCodeFixProviderAttribute : ExportAttribute
params string[] additionalLanguages) params string[] additionalLanguages)
: base(typeof(CodeFixProvider)) : base(typeof(CodeFixProvider))
{ {
if (firstLanguage == null)
{
throw new ArgumentNullException(nameof(firstLanguage));
}
if (additionalLanguages == null) if (additionalLanguages == null)
{ {
throw new ArgumentNullException(nameof(additionalLanguages)); throw new ArgumentNullException(nameof(additionalLanguages));
...@@ -45,7 +40,7 @@ public sealed class ExportCodeFixProviderAttribute : ExportAttribute ...@@ -45,7 +40,7 @@ public sealed class ExportCodeFixProviderAttribute : ExportAttribute
this.Name = null; this.Name = null;
string[] languages = new string[additionalLanguages.Length + 1]; string[] languages = new string[additionalLanguages.Length + 1];
languages[0] = firstLanguage; languages[0] = firstLanguage ?? throw new ArgumentNullException(nameof(firstLanguage));
for (int index = 0; index < additionalLanguages.Length; index++) for (int index = 0; index < additionalLanguages.Length; index++)
{ {
languages[index + 1] = additionalLanguages[index]; languages[index + 1] = additionalLanguages[index];
......
...@@ -65,12 +65,6 @@ internal partial class FixAllState ...@@ -65,12 +65,6 @@ internal partial class FixAllState
FixAllContext.DiagnosticProvider fixAllDiagnosticProvider) FixAllContext.DiagnosticProvider fixAllDiagnosticProvider)
{ {
Contract.ThrowIfNull(project); Contract.ThrowIfNull(project);
if (codeFixProvider == null)
{
throw new ArgumentNullException(nameof(codeFixProvider));
}
if (diagnosticIds == null) if (diagnosticIds == null)
{ {
throw new ArgumentNullException(nameof(diagnosticIds)); throw new ArgumentNullException(nameof(diagnosticIds));
...@@ -81,19 +75,14 @@ internal partial class FixAllState ...@@ -81,19 +75,14 @@ internal partial class FixAllState
throw new ArgumentException(WorkspacesResources.Supplied_diagnostic_cannot_be_null, nameof(diagnosticIds)); throw new ArgumentException(WorkspacesResources.Supplied_diagnostic_cannot_be_null, nameof(diagnosticIds));
} }
if (fixAllDiagnosticProvider == null)
{
throw new ArgumentNullException(nameof(fixAllDiagnosticProvider));
}
this.FixAllProvider = fixAllProvider; this.FixAllProvider = fixAllProvider;
this.Document = document; this.Document = document;
this.Project = project; this.Project = project;
this.CodeFixProvider = codeFixProvider; this.CodeFixProvider = codeFixProvider ?? throw new ArgumentNullException(nameof(codeFixProvider));
this.Scope = scope; this.Scope = scope;
this.CodeActionEquivalenceKey = codeActionEquivalenceKey; this.CodeActionEquivalenceKey = codeActionEquivalenceKey;
this.DiagnosticIds = ImmutableHashSet.CreateRange(diagnosticIds); this.DiagnosticIds = ImmutableHashSet.CreateRange(diagnosticIds);
this.DiagnosticProvider = fixAllDiagnosticProvider; this.DiagnosticProvider = fixAllDiagnosticProvider ?? throw new ArgumentNullException(nameof(fixAllDiagnosticProvider));
} }
internal bool IsFixMultiple => this.DiagnosticProvider.IsFixMultiple; internal bool IsFixMultiple => this.DiagnosticProvider.IsFixMultiple;
......
...@@ -38,19 +38,9 @@ public struct CodeRefactoringContext ...@@ -38,19 +38,9 @@ public struct CodeRefactoringContext
Action<CodeAction> registerRefactoring, Action<CodeAction> registerRefactoring,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
if (document == null) Document = document ?? throw new ArgumentNullException(nameof(document));
{
throw new ArgumentNullException(nameof(document));
}
if (registerRefactoring == null)
{
throw new ArgumentNullException(nameof(registerRefactoring));
}
Document = document;
Span = span; Span = span;
_registerRefactoring = registerRefactoring; _registerRefactoring = registerRefactoring ?? throw new ArgumentNullException(nameof(registerRefactoring));
CancellationToken = cancellationToken; CancellationToken = cancellationToken;
} }
......
...@@ -30,11 +30,6 @@ public sealed class ExportCodeRefactoringProviderAttribute : ExportAttribute ...@@ -30,11 +30,6 @@ public sealed class ExportCodeRefactoringProviderAttribute : ExportAttribute
public ExportCodeRefactoringProviderAttribute(string firstLanguage, params string[] additionalLanguages) public ExportCodeRefactoringProviderAttribute(string firstLanguage, params string[] additionalLanguages)
: base(typeof(CodeRefactoringProvider)) : base(typeof(CodeRefactoringProvider))
{ {
if (firstLanguage == null)
{
throw new ArgumentNullException(nameof(firstLanguage));
}
if (additionalLanguages == null) if (additionalLanguages == null)
{ {
throw new ArgumentNullException(nameof(additionalLanguages)); throw new ArgumentNullException(nameof(additionalLanguages));
...@@ -43,7 +38,7 @@ public ExportCodeRefactoringProviderAttribute(string firstLanguage, params strin ...@@ -43,7 +38,7 @@ public ExportCodeRefactoringProviderAttribute(string firstLanguage, params strin
this.Name = null; this.Name = null;
string[] languages = new string[additionalLanguages.Length + 1]; string[] languages = new string[additionalLanguages.Length + 1];
languages[0] = firstLanguage; languages[0] = firstLanguage ?? throw new ArgumentNullException(nameof(firstLanguage));
for (int index = 0; index < additionalLanguages.Length; index++) for (int index = 0; index < additionalLanguages.Length; index++)
{ {
languages[index + 1] = additionalLanguages[index]; languages[index + 1] = additionalLanguages[index];
......
...@@ -20,17 +20,12 @@ public class SyntaxEditor ...@@ -20,17 +20,12 @@ public class SyntaxEditor
/// </summary> /// </summary>
public SyntaxEditor(SyntaxNode root, Workspace workspace) public SyntaxEditor(SyntaxNode root, Workspace workspace)
{ {
if (root == null)
{
throw new ArgumentNullException(nameof(root));
}
if (workspace == null) if (workspace == null)
{ {
throw new ArgumentNullException(nameof(workspace)); throw new ArgumentNullException(nameof(workspace));
} }
_root = root; _root = root ?? throw new ArgumentNullException(nameof(root));
_generator = SyntaxGenerator.GetGenerator(workspace, root.Language); _generator = SyntaxGenerator.GetGenerator(workspace, root.Language);
_changes = new List<Change>(); _changes = new List<Change>();
} }
......
...@@ -54,12 +54,7 @@ internal class SearchQuery ...@@ -54,12 +54,7 @@ internal class SearchQuery
private SearchQuery(string name, SearchKind kind) private SearchQuery(string name, SearchKind kind)
{ {
if (name == null) Name = name ?? throw new ArgumentNullException(nameof(name));
{
throw new ArgumentNullException(nameof(name));
}
Name = name;
Kind = kind; Kind = kind;
switch (kind) switch (kind)
...@@ -83,13 +78,8 @@ private SearchQuery(string name, SearchKind kind) ...@@ -83,13 +78,8 @@ private SearchQuery(string name, SearchKind kind)
private SearchQuery(Func<string, bool> predicate) private SearchQuery(Func<string, bool> predicate)
{ {
if (predicate == null)
{
throw new ArgumentNullException(nameof(predicate));
}
Kind = SearchKind.Custom; Kind = SearchKind.Custom;
_predicate = predicate; _predicate = predicate ?? throw new ArgumentNullException(nameof(predicate));
} }
public static SearchQuery Create(string name, bool ignoreCase) public static SearchQuery Create(string name, bool ignoreCase)
......
...@@ -32,19 +32,9 @@ internal partial class SyntaxTreeIdentifierInfo : AbstractSyntaxTreeInfo ...@@ -32,19 +32,9 @@ internal partial class SyntaxTreeIdentifierInfo : AbstractSyntaxTreeInfo
BloomFilter escapedIdentifierFilter) : BloomFilter escapedIdentifierFilter) :
base(version) base(version)
{ {
if (identifierFilter == null)
{
throw new ArgumentNullException(nameof(identifierFilter));
}
if (escapedIdentifierFilter == null)
{
throw new ArgumentNullException(nameof(escapedIdentifierFilter));
}
_version = version; _version = version;
_identifierFilter = identifierFilter; _identifierFilter = identifierFilter ?? throw new ArgumentNullException(nameof(identifierFilter));
_escapedIdentifierFilter = escapedIdentifierFilter; _escapedIdentifierFilter = escapedIdentifierFilter ?? throw new ArgumentNullException(nameof(escapedIdentifierFilter));
} }
/// <summary> /// <summary>
......
...@@ -18,13 +18,8 @@ internal class ExportFormattingRule : ExportAttribute ...@@ -18,13 +18,8 @@ internal class ExportFormattingRule : ExportAttribute
public ExportFormattingRule(string name, string language) public ExportFormattingRule(string name, string language)
: base(typeof(IFormattingRule)) : base(typeof(IFormattingRule))
{ {
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.Name = name; this.Name = name;
this.Language = language; this.Language = language ?? throw new ArgumentNullException(nameof(language));
} }
} }
} }
...@@ -12,11 +12,6 @@ public struct OptionKey : IEquatable<OptionKey> ...@@ -12,11 +12,6 @@ public struct OptionKey : IEquatable<OptionKey>
public OptionKey(IOption option, string language = null) public OptionKey(IOption option, string language = null)
{ {
if (option == null)
{
throw new ArgumentNullException(nameof(option));
}
if (language != null && !option.IsPerLanguage) if (language != null && !option.IsPerLanguage)
{ {
throw new ArgumentException(WorkspacesResources.A_language_name_cannot_be_specified_for_this_option); throw new ArgumentException(WorkspacesResources.A_language_name_cannot_be_specified_for_this_option);
...@@ -26,7 +21,7 @@ public OptionKey(IOption option, string language = null) ...@@ -26,7 +21,7 @@ public OptionKey(IOption option, string language = null)
throw new ArgumentNullException(WorkspacesResources.A_language_name_must_be_specified_for_this_option); throw new ArgumentNullException(WorkspacesResources.A_language_name_must_be_specified_for_this_option);
} }
this.Option = option; this.Option = option ?? throw new ArgumentNullException(nameof(option));
this.Language = language; this.Language = language;
} }
......
...@@ -47,12 +47,7 @@ public BloomFilter(double falsePositiveProbability, bool isCaseSensitive, IColle ...@@ -47,12 +47,7 @@ public BloomFilter(double falsePositiveProbability, bool isCaseSensitive, IColle
private BloomFilter(BitArray bitArray, int hashFunctionCount, bool isCaseSensitive) private BloomFilter(BitArray bitArray, int hashFunctionCount, bool isCaseSensitive)
{ {
if (bitArray == null) _bitArray = bitArray ?? throw new ArgumentNullException(nameof(bitArray));
{
throw new ArgumentNullException(nameof(bitArray));
}
_bitArray = bitArray;
_hashFunctionCount = hashFunctionCount; _hashFunctionCount = hashFunctionCount;
_isCaseSensitive = isCaseSensitive; _isCaseSensitive = isCaseSensitive;
} }
......
...@@ -16,13 +16,9 @@ internal class ExportIncrementalAnalyzerProviderAttribute : ExportAttribute ...@@ -16,13 +16,9 @@ internal class ExportIncrementalAnalyzerProviderAttribute : ExportAttribute
public ExportIncrementalAnalyzerProviderAttribute(params string[] workspaceKinds) public ExportIncrementalAnalyzerProviderAttribute(params string[] workspaceKinds)
: base(typeof(IIncrementalAnalyzerProvider)) : base(typeof(IIncrementalAnalyzerProvider))
{ {
if (workspaceKinds == null)
{
throw new ArgumentNullException(nameof(workspaceKinds));
}
// TODO: this will be removed once closed side changes are in. // TODO: this will be removed once closed side changes are in.
this.WorkspaceKinds = workspaceKinds; this.WorkspaceKinds = workspaceKinds ?? throw new ArgumentNullException(nameof(workspaceKinds));
this.Name = "Unknown"; this.Name = "Unknown";
this.HighPriorityForActiveFile = false; this.HighPriorityForActiveFile = false;
} }
...@@ -30,13 +26,8 @@ public ExportIncrementalAnalyzerProviderAttribute(params string[] workspaceKinds ...@@ -30,13 +26,8 @@ public ExportIncrementalAnalyzerProviderAttribute(params string[] workspaceKinds
public ExportIncrementalAnalyzerProviderAttribute(string name, string[] workspaceKinds) public ExportIncrementalAnalyzerProviderAttribute(string name, string[] workspaceKinds)
: base(typeof(IIncrementalAnalyzerProvider)) : base(typeof(IIncrementalAnalyzerProvider))
{ {
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
this.WorkspaceKinds = workspaceKinds; this.WorkspaceKinds = workspaceKinds;
this.Name = name; this.Name = name ?? throw new ArgumentNullException(nameof(name));
this.HighPriorityForActiveFile = false; this.HighPriorityForActiveFile = false;
} }
......
...@@ -84,12 +84,7 @@ internal partial struct SymbolKey ...@@ -84,12 +84,7 @@ internal partial struct SymbolKey
public SymbolKey(string symbolKeyData) public SymbolKey(string symbolKeyData)
{ {
if (symbolKeyData == null) _symbolKeyData = symbolKeyData ?? throw new ArgumentNullException();
{
throw new ArgumentNullException();
}
_symbolKeyData = symbolKeyData;
} }
public static IEqualityComparer<SymbolKey> GetComparer(bool ignoreCase, bool ignoreAssemblyKeys) public static IEqualityComparer<SymbolKey> GetComparer(bool ignoreCase, bool ignoreAssemblyKeys)
......
...@@ -48,12 +48,7 @@ internal class EditDistance : IDisposable ...@@ -48,12 +48,7 @@ internal class EditDistance : IDisposable
public EditDistance(string text) public EditDistance(string text)
{ {
if (text == null) _source = text ?? throw new ArgumentNullException(nameof(text));
{
throw new ArgumentNullException(nameof(text));
}
_source = text;
_sourceLowerCaseCharacters = ConvertToLowercaseArray(text); _sourceLowerCaseCharacters = ConvertToLowercaseArray(text);
} }
......
...@@ -108,12 +108,7 @@ public CacheResult(string candidate, bool areSimilar, double similarityWeight) ...@@ -108,12 +108,7 @@ public CacheResult(string candidate, bool areSimilar, double similarityWeight)
public WordSimilarityChecker(string text, bool substringsAreSimilar) public WordSimilarityChecker(string text, bool substringsAreSimilar)
{ {
if (text == null) _source = text ?? throw new ArgumentNullException(nameof(text));
{
throw new ArgumentNullException(nameof(text));
}
_source = text;
_threshold = GetThreshold(_source); _threshold = GetThreshold(_source);
_editDistance = new EditDistance(text); _editDistance = new EditDistance(text);
_substringsAreSimilar = substringsAreSimilar; _substringsAreSimilar = substringsAreSimilar;
......
...@@ -41,13 +41,8 @@ public ExportLanguageServiceAttribute(Type type, string language, string layer = ...@@ -41,13 +41,8 @@ public ExportLanguageServiceAttribute(Type type, string language, string layer =
throw new ArgumentNullException(nameof(type)); throw new ArgumentNullException(nameof(type));
} }
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.ServiceType = type.AssemblyQualifiedName; this.ServiceType = type.AssemblyQualifiedName;
this.Language = language; this.Language = language ?? throw new ArgumentNullException(nameof(language));
this.Layer = layer; this.Layer = layer;
} }
} }
......
...@@ -41,13 +41,8 @@ public ExportLanguageServiceFactoryAttribute(Type type, string language, string ...@@ -41,13 +41,8 @@ public ExportLanguageServiceFactoryAttribute(Type type, string language, string
throw new ArgumentNullException(nameof(type)); throw new ArgumentNullException(nameof(type));
} }
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
this.ServiceType = type.AssemblyQualifiedName; this.ServiceType = type.AssemblyQualifiedName;
this.Language = language; this.Language = language ?? throw new ArgumentNullException(nameof(language));
this.Layer = layer; this.Layer = layer;
} }
} }
......
...@@ -35,13 +35,8 @@ public ExportWorkspaceServiceAttribute(Type serviceType, string layer = ServiceL ...@@ -35,13 +35,8 @@ public ExportWorkspaceServiceAttribute(Type serviceType, string layer = ServiceL
throw new ArgumentNullException(nameof(serviceType)); throw new ArgumentNullException(nameof(serviceType));
} }
if (layer == null)
{
throw new ArgumentNullException(nameof(layer));
}
this.ServiceType = serviceType.AssemblyQualifiedName; this.ServiceType = serviceType.AssemblyQualifiedName;
this.Layer = layer; this.Layer = layer ?? throw new ArgumentNullException(nameof(layer));
} }
} }
} }
...@@ -35,13 +35,8 @@ public ExportWorkspaceServiceFactoryAttribute(Type serviceType, string layer = S ...@@ -35,13 +35,8 @@ public ExportWorkspaceServiceFactoryAttribute(Type serviceType, string layer = S
throw new ArgumentNullException(nameof(serviceType)); throw new ArgumentNullException(nameof(serviceType));
} }
if (layer == null)
{
throw new ArgumentNullException(nameof(layer));
}
this.ServiceType = serviceType.AssemblyQualifiedName; this.ServiceType = serviceType.AssemblyQualifiedName;
this.Layer = layer; this.Layer = layer ?? throw new ArgumentNullException(nameof(layer));
} }
} }
} }
...@@ -19,12 +19,7 @@ internal class MetadataReferenceCache ...@@ -19,12 +19,7 @@ internal class MetadataReferenceCache
public MetadataReferenceCache(Func<string, MetadataReferenceProperties, MetadataReference> createReference) public MetadataReferenceCache(Func<string, MetadataReferenceProperties, MetadataReference> createReference)
{ {
if (createReference == null) _createReference = createReference ?? throw new ArgumentNullException(nameof(createReference));
{
throw new ArgumentNullException(nameof(createReference));
}
_createReference = createReference;
} }
public MetadataReference GetReference(string path, MetadataReferenceProperties properties) public MetadataReference GetReference(string path, MetadataReferenceProperties properties)
......
...@@ -18,12 +18,7 @@ internal sealed class AdditionalTextDocument : AdditionalText ...@@ -18,12 +18,7 @@ internal sealed class AdditionalTextDocument : AdditionalText
/// </summary> /// </summary>
public AdditionalTextDocument(TextDocumentState document) public AdditionalTextDocument(TextDocumentState document)
{ {
if (document == null) _document = document ?? throw new ArgumentNullException(nameof(document));
{
throw new ArgumentNullException(nameof(document));
}
_document = document;
} }
/// <summary> /// <summary>
......
...@@ -167,18 +167,8 @@ internal class DocumentAttributes : IChecksummedObject, IObjectWritable ...@@ -167,18 +167,8 @@ internal class DocumentAttributes : IChecksummedObject, IObjectWritable
string filePath, string filePath,
bool isGenerated) bool isGenerated)
{ {
if (id == null) Id = id ?? throw new ArgumentNullException(nameof(id));
{ Name = name ?? throw new ArgumentNullException(nameof(name));
throw new ArgumentNullException(nameof(id));
}
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
Id = id;
Name = name;
Folders = folders.ToImmutableReadOnlyListOrEmpty(); Folders = folders.ToImmutableReadOnlyListOrEmpty();
SourceCodeKind = sourceCodeKind; SourceCodeKind = sourceCodeKind;
FilePath = filePath; FilePath = filePath;
......
...@@ -377,30 +377,10 @@ internal class ProjectAttributes : IChecksummedObject, IObjectWritable ...@@ -377,30 +377,10 @@ internal class ProjectAttributes : IChecksummedObject, IObjectWritable
bool isSubmission, bool isSubmission,
bool hasAllInformation) bool hasAllInformation)
{ {
if (id == null) Id = id ?? throw new ArgumentNullException(nameof(id));
{ Name = name ?? throw new ArgumentNullException(nameof(name));
throw new ArgumentNullException(nameof(id)); Language = language ?? throw new ArgumentNullException(nameof(language));
} AssemblyName = assemblyName ?? throw new ArgumentNullException(nameof(assemblyName));
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (language == null)
{
throw new ArgumentNullException(nameof(language));
}
if (assemblyName == null)
{
throw new ArgumentNullException(nameof(assemblyName));
}
Id = id;
Name = name;
Language = language;
AssemblyName = assemblyName;
Version = version; Version = version;
FilePath = filePath; FilePath = filePath;
......
...@@ -106,12 +106,7 @@ internal class SolutionAttributes : IChecksummedObject, IObjectWritable ...@@ -106,12 +106,7 @@ internal class SolutionAttributes : IChecksummedObject, IObjectWritable
public SolutionAttributes(SolutionId id, VersionStamp version, string filePath) public SolutionAttributes(SolutionId id, VersionStamp version, string filePath)
{ {
if (id == null) Id = id ?? throw new ArgumentNullException(nameof(id));
{
throw new ArgumentNullException(nameof(id));
}
Id = id;
Version = version; Version = version;
FilePath = filePath; FilePath = filePath;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册