Skip to content

Commit e7f8219

Browse files
committed
Better wording
1 parent 3b0a2d3 commit e7f8219

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Realm/Realm.Weaver/RealmWeaver.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ private static void RemoveBackingFields(TypeDefinition type, HashSet<MetadataTok
258258
}
259259
}
260260

261-
// Iterates through all constructor's instructions from the end to start.
261+
// Iterates through all constructors' instructions from the end to start.
262262
foreach (var constructor in type.GetConstructors())
263263
{
264264
// Index of the most recent "Stfld <backing_field>" instruction
@@ -278,8 +278,8 @@ private static void RemoveBackingFields(TypeDefinition type, HashSet<MetadataTok
278278
}
279279

280280
// If it comes across "Ldarg 0",
281-
// it considers this the start index of backing field initializaion instructions.
282-
// And removes all backing field instructions from end to start.
281+
// it considers this the start index of backing field initializaion instructions
282+
// and removes all backing field instructions from end to start.
283283
else if (instruction.OpCode == OpCodes.Ldarg_0)
284284
{
285285
for (var j = backingFieldInstructionsEnd; j >= i; j--)

Tests/Realm.Tests/Database/RealmObjectTests.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,15 @@ public void RealmObject_Equals_WhenOtherIsNull_ReturnsFalse()
523523
[Test]
524524
public void RealmObject_InitializedFields_GetCorrectValues()
525525
{
526-
// This tests the Realm object for a scenario like i.e. where we have a class that
527-
// has an ID field that gets incremented every time a new class instance is created
528-
// by incrementing an external variable and assigning it to the Id field.
526+
// This test ensures we only run the initialization instructions of Realm Object fields once.
527+
// i.e. where we have a class that has an ID field that gets incremented every time a new class
528+
// instance is created by incrementing an external variable and assigning it to the Id field.
529529
//
530530
// class FieldObject { Id: Generator.Id() } where Generator.Id = () => _currentId++;
531531
//
532-
// It could be that because of i.e. copying over initialization commands to
533-
// the accessor but not removing from the original constructor, the initialization
534-
// of the field would get repeated, thus leading to the _currentId being incremented
535-
// twice. This test ensures we only run the initialization of fields once.
532+
// It could be that because of i.e. copying over initialization commands to the accessor
533+
// but not removing from the original constructor, the initialization of the field
534+
// would get repeated, thus leading to the _currentId being incremented twice.
536535
var obj0 = new InitializedFieldObject();
537536
var obj1 = new InitializedFieldObject();
538537
var obj2 = new InitializedFieldObject();

0 commit comments

Comments
 (0)