Exemplo n.º 1
0
        public ExecutionModel(
            IHeapModel heapModel,
            ImmutableArray <FlowNode> pathNodes,
            ImmutableArray <ImmutableArray <Interpretation> > nodeInterpretations,
            ImmutableArray <ImmutableArray <HeapModelLocation> > heapLocations)
        {
            Contract.Requires(pathNodes != null);
            Contract.Requires(nodeInterpretations != null);
            Contract.Requires(heapLocations != null);
            Contract.Requires(heapModel != null);
            Contract.Requires(pathNodes.Length == nodeInterpretations.Length);
            Contract.Requires(nodeInterpretations.Length == heapLocations.Length);

            this.HeapModel           = heapModel;
            this.PathNodes           = pathNodes;
            this.NodeInterpretations = nodeInterpretations;
            this.HeapLocations       = heapLocations;
        }
Exemplo n.º 2
0
        public Graph Convert(IHeapModel heap, int version)
        {
            var graph = new Graph();

            foreach (var location in heap.GetLocations(version))
            {
                var node = graph.AddNode(location.Id.ToString());

                node.LabelText = location.ToString();

                foreach (var reference in heap.GetReferences(location))
                {
                    graph.AddEdge(location.Id.ToString(), reference.Field.ToString(), reference.LocationId.ToString());
                }

                foreach (var value in heap.GetValues(location))
                {
                    node.LabelText += $"\n{value.Field} = {value.Value}";
                }
            }

            return(graph);
        }
Exemplo n.º 3
0
 public IValueModel GetValueModel(ITypeSymbol type, HeapModelLocation location, IHeapModel heap)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 4
0
        public IValueModel GetValueModel(ITypeSymbol type, HeapModelLocation location, IHeapModel heap)
        {
            Contract.Requires(type != null, nameof(type));
            Contract.Requires(this.IsTypeSupported(type), nameof(type));

            return(new ReferenceValueModel(this, location, heap));
        }
Exemplo n.º 5
0
 internal ReferenceValueModel(ReferenceModelFactory factory, HeapModelLocation location, IHeapModel heap)
     : base(factory)
 {
     this.location = location;
     this.heap     = heap;
 }