Skip to content

Commit

Permalink
Review 1
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioaversa committed Mar 24, 2023
1 parent 7e2de77 commit 08ef95f
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ void OutParams(int? iParam)
_ = iLocal.Value; // Compliant

iLocal = null;
ModifyOutParamAndRead(out iLocal, iLocal.Value); // Compliant, FN
ModifyOutParamAndRead(out iLocal, iLocal.Value); // FN

iLocal = null;
ReadAndModifyOutParam(iLocal.Value, out iLocal); // Noncompliant
Expand All @@ -672,7 +672,19 @@ void RefParams(int? iParam)
ModifyRefParam(ref iLocal);
_ = iLocal.Value; // Compliant

iLocal = null;
ModifyRefParamAndRead(ref iLocal, iLocal.Value); // FN

iLocal = null;
ReadAndModifyRefParam(iLocal.Value, ref iLocal); // Noncompliant

nullableField = null;
ModifyRefParam(ref nullableField);
_ = nullableField.Value; // Compliant

static void ModifyRefParam(ref int? i) => i = null;
static void ModifyRefParamAndRead(ref int? i1, int? i2) => i1 = i2;
static void ReadAndModifyRefParam(int? i1, ref int? i2) => i2 = i1;
}
}

Expand Down

0 comments on commit 08ef95f

Please sign in to comment.