Exemplo n.º 1
0
        public override LocalDefinition GetPreviousLocal(
            Cci.ITypeReference currentType,
            ILocalSymbolInternal currentLocalSymbol,
            string nameOpt,
            SynthesizedLocalKind kind,
            LocalDebugId id,
            LocalVariableAttributes pdbAttributes,
            LocalSlotConstraints constraints,
            ImmutableArray <bool> dynamicTransformFlags,
            ImmutableArray <string> tupleElementNames)
        {
            if (id.IsNone)
            {
                return(null);
            }

            LocalDebugId previousId;

            if (!TryGetPreviousLocalId(currentLocalSymbol.GetDeclaratorSyntax(), id, out previousId))
            {
                return(null);
            }

            var previousType = _symbolMap.MapReference(currentType);

            if (previousType == null)
            {
                return(null);
            }

            // 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 EncLocalInfo(new LocalSlotDebugInfo(kind, previousId), previousType, constraints, signature: null);

            int slot;

            if (!_previousLocalSlots.TryGetValue(localKey, out slot))
            {
                return(null);
            }

            return(new LocalDefinition(
                       currentLocalSymbol,
                       nameOpt,
                       currentType,
                       slot,
                       kind,
                       id,
                       pdbAttributes,
                       constraints,
                       dynamicTransformFlags,
                       tupleElementNames));
        }
Exemplo n.º 2
0
        private static EncHoistedLocalInfo MapHoistedLocalSlot(EncHoistedLocalInfo info, SymbolMatcher map)
        {
            if (info.IsUnused)
            {
                return(info);
            }

            return(new EncHoistedLocalInfo(info.SlotInfo, map.MapReference(info.Type)));
        }
Exemplo n.º 3
0
        private static EncLocalInfo MapLocalInfo(EncLocalInfo info, SymbolMatcher map)
        {
            Debug.Assert(!info.IsDefault);
            if (info.IsUnused)
            {
                Debug.Assert(info.Signature != null);
                return(info);
            }

            return(new EncLocalInfo(info.SlotInfo, map.MapReference(info.Type), info.Constraints, info.Signature));
        }