Address PR review comments

This commit is contained in:
Tamas Vajk
2020-12-16 16:12:11 +01:00
parent a7451a12fc
commit 1bc65a68df
12 changed files with 45 additions and 60 deletions

View File

@@ -178,7 +178,7 @@ namespace Semmle.Extraction.CIL.Entities
}
}
private IEnumerable<IExtractionProduct> Decode(byte[] ilbytes, Dictionary<int, Instruction> jump_table)
private IEnumerable<IExtractionProduct> Decode(byte[]? ilbytes, Dictionary<int, Instruction> jump_table)
{
// Sequence points are stored in order of offset.
// We use an enumerator to locate the correct sequence point for each instruction.
@@ -203,9 +203,9 @@ namespace Semmle.Extraction.CIL.Entities
}
var child = 0;
for (var offset = 0; offset < ilbytes.Length;)
for (var offset = 0; offset < (ilbytes?.Length ?? 0);)
{
var instruction = new Instruction(Cx, this, ilbytes, offset, child++);
var instruction = new Instruction(Cx, this, ilbytes!, offset, child++);
yield return instruction;
if (nextSequencePoint != null && offset >= nextSequencePoint.Current.Offset)
@@ -245,12 +245,12 @@ namespace Semmle.Extraction.CIL.Entities
var ilbytes = body.GetILBytes();
var child = 0;
for (var offset = 0; offset < ilbytes.Length;)
for (var offset = 0; offset < (ilbytes?.Length ?? 0);)
{
Instruction decoded;
try
{
decoded = new Instruction(Cx, this, ilbytes, offset, child++);
decoded = new Instruction(Cx, this, ilbytes!, offset, child++);
offset += decoded.Width;
}
catch // lgtm[cs/catch-of-all-exceptions]