コード例 #1
0
        /// <summary>
        /// Return zero or more locations in primary source documents that correspond to the given derived (non primary) document location.
        /// </summary>
        /// <param name="location">A location in a document that have been derived from one or more source documents.</param>
        public IEnumerable <IPrimarySourceLocation> GetPrimarySourceLocationsFor(ILocation location)
        {
            var psloc = location as IPrimarySourceLocation;

            if (psloc != null)
            {
                return(IteratorHelper.GetSingletonEnumerable(psloc));
            }
            else
            {
                return(this.MapLocationToSourceLocations(location));
            }
        }
コード例 #2
0
        /// <summary>
        /// Return zero or more locations in primary source documents that correspond to the definition of the given local.
        /// </summary>
        public IEnumerable <IPrimarySourceLocation> GetPrimarySourceLocationsForDefinitionOf(ILocalDefinition localDefinition)
        {
            PdbFunction /*?*/ pdbFunction = this.GetPdbFunctionFor(localDefinition);

            if (pdbFunction != null)
            {
                uint index = 0;
                foreach (ILocation location in localDefinition.Locations)
                {
                    IILLocation /*?*/ mbLocation = location as IILLocation;
                    if (mbLocation != null)
                    {
                        index = mbLocation.Offset;
                        break;
                    }
                }
                PdbSlot /*?*/ slot = this.GetSlotFor(pdbFunction.scopes, index);
                if (slot != null && (slot.flags & 0x4) == 0)
                {
                    return(IteratorHelper.GetSingletonEnumerable <IPrimarySourceLocation>(new LocalNameSourceLocation(slot.name)));
                }
            }
            return(Enumerable <IPrimarySourceLocation> .Empty);
        }