private static EncHoistedLocalInfo MapHoistedLocalSlot(EncHoistedLocalInfo info, SymbolMatcher map)
        {
            if (info.IsUnused)
            {
                return(info);
            }

            return(new EncHoistedLocalInfo(info.SlotInfo, map.MapReference(info.Type)));
        }
        public override bool TryGetPreviousHoistedLocalSlotIndex(
            SyntaxNode currentDeclarator,
            Cci.ITypeReference currentType,
            SynthesizedLocalKind synthesizedKind,
            LocalDebugId currentId,
            DiagnosticBag diagnostics,
            out int slotIndex)
        {
            // The previous method was not a state machine (it is allowed to change non-state machine to a state machine):
            if (_hoistedLocalSlotsOpt == null)
            {
                slotIndex = -1;
                return(false);
            }

            LocalDebugId previousId;

            if (!TryGetPreviousLocalId(currentDeclarator, currentId, out previousId))
            {
                slotIndex = -1;
                return(false);
            }

            var previousType = _symbolMap.MapReference(currentType);

            if (previousType == null)
            {
                slotIndex = -1;
                return(false);
            }

            // TODO (bug #781309): Should report a warning if the type of the local has changed
            // and the previous value will be dropped.
            var localKey = new EncHoistedLocalInfo(new LocalSlotDebugInfo(synthesizedKind, previousId), previousType);

            return(_hoistedLocalSlotsOpt.TryGetValue(localKey, out slotIndex));
        }