diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index aa4438cedf..f22b3b10d4 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -2463,15 +2463,11 @@ and seekReadImplMap (ctxt: ILMetadataReader) nm midx = and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start seqpoints = let labelsOfRawOffsets = new Dictionary<_, _>(sz/2) let ilOffsetsOfLabels = new Dictionary<_, _>(sz/2) - let tryRawToLabel rawOffset = - match labelsOfRawOffsets.TryGetValue rawOffset with - | true, v -> Some v - | _ -> None - + let rawToLabel rawOffset = - match tryRawToLabel rawOffset with - | Some l -> l - | None -> + match labelsOfRawOffsets.TryGetValue rawOffset with + | true, l -> l + | _ -> let lab = generateCodeLabel() labelsOfRawOffsets.[rawOffset] <- lab lab @@ -2700,9 +2696,9 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s // the start of the next instruction referred to by the raw offset. let raw2nextLab rawOffset = let isInstrStart x = - match tryRawToLabel x with - | None -> false - | Some lab -> ilOffsetsOfLabels.ContainsKey lab + match labelsOfRawOffsets.TryGetValue x with + | true, lab -> ilOffsetsOfLabels.ContainsKey lab + | _ -> false if isInstrStart rawOffset then rawToLabel rawOffset elif isInstrStart (rawOffset+1) then rawToLabel (rawOffset+1) else failwith ("the bytecode raw offset "+string rawOffset+" did not refer either to the start or end of an instruction")