Skip to content

Commit

Permalink
Join null check with assignement
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentkempe committed Aug 25, 2018
1 parent 712fa20 commit 165872d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
10 changes: 3 additions & 7 deletions GitDiffMargin/Core/BackgroundParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ protected BackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler,
{
if (textBuffer == null)
throw new ArgumentNullException(nameof(textBuffer));
if (taskScheduler == null)
throw new ArgumentNullException(nameof(taskScheduler));
if (textDocumentFactoryService == null)
throw new ArgumentNullException(nameof(textDocumentFactoryService));

_textBuffer = new WeakReference<ITextBuffer>(textBuffer);
_taskScheduler = taskScheduler;
TextDocumentFactoryService = textDocumentFactoryService;

_taskScheduler = taskScheduler ?? throw new ArgumentNullException(nameof(taskScheduler));
TextDocumentFactoryService = textDocumentFactoryService ?? throw new ArgumentNullException(nameof(textDocumentFactoryService));

textBuffer.PostChanged += TextBufferPostChanged;

Expand Down
9 changes: 2 additions & 7 deletions GitDiffMargin/GitDiffMarginCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ public GitDiffMarginCommandHandler(IVsTextView textViewAdapter,
IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextView textView)
: base(textViewAdapter)
{
if (editorAdaptersFactoryService == null)
throw new ArgumentNullException(nameof(editorAdaptersFactoryService));
if (textView == null)
throw new ArgumentNullException(nameof(textView));

_editorAdaptersFactoryService = editorAdaptersFactoryService;
_textView = textView;
_editorAdaptersFactoryService = editorAdaptersFactoryService ?? throw new ArgumentNullException(nameof(editorAdaptersFactoryService));
_textView = textView ?? throw new ArgumentNullException(nameof(textView));
}

protected override OLECMDF QueryCommandStatus(ref Guid commandGroup, uint commandId,
Expand Down
5 changes: 1 addition & 4 deletions GitDiffMargin/ViewModel/DiffMarginViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ internal abstract class DiffMarginViewModelBase : ViewModelBase

protected DiffMarginViewModelBase(IMarginCore marginCore)
{
if (marginCore == null)
throw new ArgumentNullException(nameof(marginCore));

MarginCore = marginCore;
MarginCore = marginCore ?? throw new ArgumentNullException(nameof(marginCore));

DiffViewModels = new ObservableCollection<DiffViewModel>();

Expand Down
5 changes: 1 addition & 4 deletions GitDiffMargin/ViewModel/EditorDiffMarginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ internal EditorDiffMarginViewModel(IMarginCore marginCore,
Action<DiffViewModel, HunkRangeInfo> updateDiffDimensions) :
base(marginCore)
{
if (updateDiffDimensions == null)
throw new ArgumentNullException(nameof(updateDiffDimensions));

_updateDiffDimensions = updateDiffDimensions;
_updateDiffDimensions = updateDiffDimensions ?? throw new ArgumentNullException(nameof(updateDiffDimensions));
}

public RelayCommand<DiffViewModel> PreviousChangeCommand =>
Expand Down
5 changes: 1 addition & 4 deletions GitDiffMargin/ViewModel/ScrollDiffMarginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ internal ScrollDiffMarginViewModel(IMarginCore marginCore,
Action<DiffViewModel, HunkRangeInfo> updateDiffDimensions) :
base(marginCore)
{
if (updateDiffDimensions == null)
throw new ArgumentNullException(nameof(updateDiffDimensions));

_updateDiffDimensions = updateDiffDimensions;
_updateDiffDimensions = updateDiffDimensions ?? throw new ArgumentNullException(nameof(updateDiffDimensions));
}

protected override DiffViewModel CreateDiffViewModel(HunkRangeInfo hunkRangeInfo)
Expand Down

0 comments on commit 165872d

Please sign in to comment.