Skip to content

Commit 6972de2

Browse files
committed
Add "this." prefix to all field accesses
1 parent 41abf66 commit 6972de2

File tree

20 files changed

+72
-71
lines changed

20 files changed

+72
-71
lines changed

CommunityToolkit.Common/Deferred/DeferredEventArgs.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public class DeferredEventArgs : EventArgs
2929
/// <returns><see cref="EventDeferral"/> instance.</returns>
3030
public EventDeferral GetDeferral()
3131
{
32-
lock (_eventDeferralLock)
32+
lock (this._eventDeferralLock)
3333
{
34-
return _eventDeferral ??= new EventDeferral();
34+
return this._eventDeferral ??= new EventDeferral();
3535
}
3636
}
3737

@@ -45,11 +45,11 @@ public EventDeferral GetDeferral()
4545
[Obsolete("This is an internal only method to be used by EventHandler extension classes, public callers should call GetDeferral() instead.")]
4646
public EventDeferral? GetCurrentDeferralAndReset()
4747
{
48-
lock (_eventDeferralLock)
48+
lock (this._eventDeferralLock)
4949
{
50-
EventDeferral? eventDeferral = _eventDeferral;
50+
EventDeferral? eventDeferral = this._eventDeferral;
5151

52-
_eventDeferral = null;
52+
this._eventDeferral = null;
5353

5454
return eventDeferral;
5555
}

CommunityToolkit.Common/Deferred/EventDeferral.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal EventDeferral()
2626
/// <summary>
2727
/// Call when finished with the Deferral.
2828
/// </summary>
29-
public void Complete() => _taskCompletionSource.TrySetResult(null);
29+
public void Complete() => this._taskCompletionSource.TrySetResult(null);
3030

3131
/// <summary>
3232
/// Waits for the <see cref="EventDeferral"/> to be completed by the event handler.
@@ -38,9 +38,9 @@ internal EventDeferral()
3838
[Obsolete("This is an internal only method to be used by EventHandler extension classes, public callers should call GetDeferral() instead on the DeferredEventArgs.")]
3939
public async Task WaitForCompletion(CancellationToken cancellationToken)
4040
{
41-
using (cancellationToken.Register(() => _taskCompletionSource.TrySetCanceled()))
41+
using (cancellationToken.Register(() => this._taskCompletionSource.TrySetCanceled()))
4242
{
43-
_ = await _taskCompletionSource.Task;
43+
_ = await this._taskCompletionSource.Task;
4444
}
4545
}
4646

CommunityToolkit.HighPerformance/Buffers/SpanOwner{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public Span<T> Span
142142
get
143143
{
144144
#if NETCOREAPP3_1_OR_GREATER
145-
ref T r0 = ref array!.DangerousGetReference();
145+
ref T r0 = ref this.array!.DangerousGetReference();
146146

147147
return MemoryMarshal.CreateSpan(ref r0, this.length);
148148
#else
@@ -174,7 +174,7 @@ public ref T DangerousGetReference()
174174
[MethodImpl(MethodImplOptions.AggressiveInlining)]
175175
public ArraySegment<T> DangerousGetArray()
176176
{
177-
return new(array!, 0, this.length);
177+
return new(this.array!, 0, this.length);
178178
}
179179

180180
/// <summary>

CommunityToolkit.HighPerformance/Enumerables/RefEnumerable{T}.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public readonly ref struct RefEnumerable<T>
5555
[MethodImpl(MethodImplOptions.AggressiveInlining)]
5656
internal RefEnumerable(ref T reference, int length, int step)
5757
{
58-
Span = MemoryMarshal.CreateSpan(ref reference, length);
59-
Step = step;
58+
this.Span = MemoryMarshal.CreateSpan(ref reference, length);
59+
this.Step = step;
6060
}
6161

6262
/// <summary>
@@ -94,10 +94,11 @@ public static RefEnumerable<T> DangerousCreate(ref T value, int length, int step
9494
[MethodImpl(MethodImplOptions.AggressiveInlining)]
9595
internal RefEnumerable(object? instance, IntPtr offset, int length, int step)
9696
{
97-
Instance = instance;
98-
Offset = offset;
97+
this.Instance = instance;
98+
this.Offset = offset;
99+
this.Step = step;
100+
99101
Length = length;
100-
Step = step;
101102
}
102103
#endif
103104

CommunityToolkit.HighPerformance/NullableRef{T}.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public readonly ref struct NullableRef<T>
3232
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3333
public NullableRef(ref T value)
3434
{
35-
Span = MemoryMarshal.CreateSpan(ref value, 1);
35+
this.Span = MemoryMarshal.CreateSpan(ref value, 1);
3636
}
3737

3838
/// <summary>
@@ -42,7 +42,7 @@ public NullableRef(ref T value)
4242
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4343
private NullableRef(Span<T> span)
4444
{
45-
Span = span;
45+
this.Span = span;
4646
}
4747

4848
/// <summary>
@@ -69,7 +69,7 @@ public unsafe bool HasValue
6969
// also account for the byte endianness of the current system),
7070
// and then reinterpret that value to a bool flag.
7171
// This results in a single movzx instruction on x86-64.
72-
byte length = unchecked((byte)Span.Length);
72+
byte length = unchecked((byte)this.Span.Length);
7373

7474
return *(bool*)&length;
7575
}
@@ -89,7 +89,7 @@ public ref T Value
8989
ThrowInvalidOperationException();
9090
}
9191

92-
return ref MemoryMarshal.GetReference(Span);
92+
return ref MemoryMarshal.GetReference(this.Span);
9393
}
9494
}
9595

CommunityToolkit.HighPerformance/ReadOnlyRef{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public ReadOnlyRef(in T value)
3737
{
3838
ref T r0 = ref Unsafe.AsRef(value);
3939

40-
Span = MemoryMarshal.CreateReadOnlySpan(ref r0, 1);
40+
this.Span = MemoryMarshal.CreateReadOnlySpan(ref r0, 1);
4141
}
4242

4343
/// <summary>
@@ -56,7 +56,7 @@ public unsafe ReadOnlyRef(void* pointer)
5656
public ref readonly T Value
5757
{
5858
[MethodImpl(MethodImplOptions.AggressiveInlining)]
59-
get => ref MemoryMarshal.GetReference(Span);
59+
get => ref MemoryMarshal.GetReference(this.Span);
6060
}
6161

6262
/// <summary>

CommunityToolkit.HighPerformance/Ref{T}.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public readonly ref struct Ref<T>
3535
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3636
public Ref(ref T value)
3737
{
38-
Span = MemoryMarshal.CreateSpan(ref value, 1);
38+
this.Span = MemoryMarshal.CreateSpan(ref value, 1);
3939
}
4040

4141
/// <summary>
@@ -54,7 +54,7 @@ public unsafe Ref(void* pointer)
5454
public ref T Value
5555
{
5656
[MethodImpl(MethodImplOptions.AggressiveInlining)]
57-
get => ref MemoryMarshal.GetReference(Span);
57+
get => ref MemoryMarshal.GetReference(this.Span);
5858
}
5959
#else
6060
/// <summary>
@@ -80,8 +80,8 @@ public ref T Value
8080
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8181
public Ref(object owner, ref T value)
8282
{
83-
Owner = owner;
84-
Offset = ObjectMarshal.DangerousGetObjectDataByteOffset(owner, ref value);
83+
this.Owner = owner;
84+
this.Offset = ObjectMarshal.DangerousGetObjectDataByteOffset(owner, ref value);
8585
}
8686

8787
/// <summary>
@@ -90,7 +90,7 @@ public Ref(object owner, ref T value)
9090
public ref T Value
9191
{
9292
[MethodImpl(MethodImplOptions.AggressiveInlining)]
93-
get => ref ObjectMarshal.DangerousGetObjectDataReferenceAt<T>(Owner, Offset);
93+
get => ref ObjectMarshal.DangerousGetObjectDataReferenceAt<T>(this.Owner, this.Offset);
9494
}
9595
#endif
9696

CommunityToolkit.Mvvm.SourceGenerators/Helpers/HashCode.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -410,32 +410,32 @@ private static uint MixFinal(uint hash)
410410
private void Add(int value)
411411
{
412412
uint val = (uint)value;
413-
uint previousLength = length++;
413+
uint previousLength = this.length++;
414414
uint position = previousLength % 4;
415415

416416
if (position == 0)
417417
{
418-
queue1 = val;
418+
this.queue1 = val;
419419
}
420420
else if (position == 1)
421421
{
422-
queue2 = val;
422+
this.queue2 = val;
423423
}
424424
else if (position == 2)
425425
{
426-
queue3 = val;
426+
this.queue3 = val;
427427
}
428428
else
429429
{
430430
if (previousLength == 3)
431431
{
432-
Initialize(out v1, out v2, out v3, out v4);
432+
Initialize(out this.v1, out this.v2, out this.v3, out this.v4);
433433
}
434434

435-
v1 = Round(v1, queue1);
436-
v2 = Round(v2, queue2);
437-
v3 = Round(v3, queue3);
438-
v4 = Round(v4, val);
435+
this.v1 = Round(this.v1, this.queue1);
436+
this.v2 = Round(this.v2, this.queue2);
437+
this.v3 = Round(this.v3, this.queue3);
438+
this.v4 = Round(this.v4, val);
439439
}
440440
}
441441

@@ -447,21 +447,21 @@ public int ToHashCode()
447447
{
448448
uint length = this.length;
449449
uint position = length % 4;
450-
uint hash = length < 4 ? MixEmptyState() : MixState(v1, v2, v3, v4);
450+
uint hash = length < 4 ? MixEmptyState() : MixState(this.v1, this.v2, this.v3, this.v4);
451451

452452
hash += length * 4;
453453

454454
if (position > 0)
455455
{
456-
hash = QueueRound(hash, queue1);
456+
hash = QueueRound(hash, this.queue1);
457457

458458
if (position > 1)
459459
{
460-
hash = QueueRound(hash, queue2);
460+
hash = QueueRound(hash, this.queue2);
461461

462462
if (position > 2)
463463
{
464-
hash = QueueRound(hash, queue3);
464+
hash = QueueRound(hash, this.queue3);
465465
}
466466
}
467467
}

CommunityToolkit.Mvvm/ComponentModel/__Internals/__TaskExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public Awaiter(Task task)
8787
public bool IsCompleted
8888
{
8989
[MethodImpl(MethodImplOptions.AggressiveInlining)]
90-
get => taskAwaiter.IsCompleted;
90+
get => this.taskAwaiter.IsCompleted;
9191
}
9292

9393
/// <summary>

CommunityToolkit.Mvvm/Messaging/Internals/System/Gen2GcCallback.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static void Register(Action<object> callback, object target)
7777
}
7878
else
7979
{
80-
handle.Free();
80+
this.handle.Free();
8181
}
8282
}
8383
}

0 commit comments

Comments
 (0)