private string Literal(Handle handle, Func <MetadataReader, Handle, string> getValue)
        {
            if (handle.IsNil)
            {
                return("nil");
            }

            if (aggregateReader != null)
            {
                int    generation;
                Handle generationHandle = aggregateReader.GetGenerationHandle(handle, out generation);

                var    generationReader = readers[generation];
                string value            = getValue(generationReader, generationHandle);
                int    offset           = generationReader.GetHeapOffset(handle);
                int    generationOffset = generationReader.GetHeapOffset(generationHandle);

                if (offset == generationOffset)
                {
                    return(string.Format("{0} (#{1})", value, offset));
                }
                else
                {
                    return(string.Format("{0} (#{1}/{2})", value, offset, generationOffset));
                }
            }

            if (IsDelta)
            {
                // we can't resolve the literal without aggregate reader
                return(string.Format("#{0}", reader.GetHeapOffset(handle)));
            }

            return(string.Format("{1} (#{0})", reader.GetHeapOffset(handle), getValue(reader, handle)));
        }
 private static void TestGenerationHandle(MetadataAggregator aggregator, Handle handle, Handle expectedHandle, int expectedGeneration)
 {
     int actualGeneration;
     var actualHandle = aggregator.GetGenerationHandle(handle, out actualGeneration);
     Assert.Equal(expectedGeneration, actualGeneration);
     Assert.Equal(expectedHandle, actualHandle);
 }
Beispiel #3
0
        private TEntity GetValue <TEntity>(Handle handle, Func <MetadataReader, Handle, TEntity> getter)
        {
            int generation;
            var genHandle = _aggregator.GetGenerationHandle(handle, out generation);

            return(getter(Readers[generation], genHandle));
        }
 private static void TestGenerationHandle(MetadataAggregator aggregator, int token, int expectedToken, int expectedGeneration)
 {
     int actualGeneration;
     var actualHandle = aggregator.GetGenerationHandle(new Handle((uint)token), out actualGeneration);
     Assert.Equal(expectedGeneration, actualGeneration);
     Assert.Equal(expectedToken, (int)actualHandle.value);
 }
        private static void TestGenerationHandle(MetadataAggregator aggregator, Handle handle, Handle expectedHandle, int expectedGeneration)
        {
            int actualGeneration;
            var actualHandle = aggregator.GetGenerationHandle(handle, out actualGeneration);

            Assert.Equal(expectedGeneration, actualGeneration);
            Assert.Equal(expectedHandle, actualHandle);
        }
        private static void TestGenerationHandle(MetadataAggregator aggregator, int token, int expectedToken, int expectedGeneration)
        {
            int actualGeneration;
            var actualHandle = aggregator.GetGenerationHandle(new Handle((uint)token), out actualGeneration);

            Assert.Equal(expectedGeneration, actualGeneration);
            Assert.Equal(expectedToken, (int)actualHandle.value);
        }