Skip to content

Commit ac9beaf

Browse files
author
Philip Guo
committed
simplified layout heuristics for 1-D linked data structures
1 parent ddb7bb9 commit ac9beaf

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎v3/js/pytutor.js‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,8 +1737,8 @@ ExecutionVisualizer.prototype.precomputeCurTraceLayouts = function() {
17371737
// $.extend(true /* make a deep copy */ , [], curRow),
17381738
// $.extend(true /* make a deep copy */ , [], newRow));
17391739

1740-
// heuristic for laying out 1-D linked data structures: check for enclosing elements that are
1741-
// structurally identical and then lay them out as siblings in the same "row"
1740+
// heuristic for laying out 1-D linked data structures:
1741+
// try to lay them out as "siblings" in the same row
17421742
var heapObj = curEntry.heap[id];
17431743
assert(heapObj);
17441744

@@ -1748,12 +1748,12 @@ ExecutionVisualizer.prototype.precomputeCurTraceLayouts = function() {
17481748

17491749
if (!isPrimitiveType(child)) {
17501750
var childID = getRefID(child);
1751-
if (structurallyEquivalent(heapObj, curEntry.heap[childID])) {
1752-
updateCurLayout(childID, curRow, newRow);
1753-
}
1754-
else if (myViz.disableHeapNesting) {
1751+
if (myViz.disableHeapNesting) {
17551752
updateCurLayout(childID, [], []);
17561753
}
1754+
else {
1755+
updateCurLayout(childID, curRow, newRow);
1756+
}
17571757
}
17581758
});
17591759
}
@@ -1772,12 +1772,12 @@ ExecutionVisualizer.prototype.precomputeCurTraceLayouts = function() {
17721772
var dictVal = child[1];
17731773
if (!isPrimitiveType(dictVal)) {
17741774
var childID = getRefID(dictVal);
1775-
if (structurallyEquivalent(heapObj, curEntry.heap[childID])) {
1776-
updateCurLayout(childID, curRow, newRow);
1777-
}
1778-
else if (myViz.disableHeapNesting) {
1775+
if (myViz.disableHeapNesting) {
17791776
updateCurLayout(childID, [], []);
17801777
}
1778+
else {
1779+
updateCurLayout(childID, curRow, newRow);
1780+
}
17811781
}
17821782
});
17831783
}
@@ -1797,12 +1797,12 @@ ExecutionVisualizer.prototype.precomputeCurTraceLayouts = function() {
17971797
var instVal = child[1];
17981798
if (!isPrimitiveType(instVal)) {
17991799
var childID = getRefID(instVal);
1800-
if (structurallyEquivalent(heapObj, curEntry.heap[childID])) {
1801-
updateCurLayout(childID, curRow, newRow);
1802-
}
1803-
else if (myViz.disableHeapNesting) {
1800+
if (myViz.disableHeapNesting) {
18041801
updateCurLayout(childID, [], []);
18051802
}
1803+
else {
1804+
updateCurLayout(childID, curRow, newRow);
1805+
}
18061806
}
18071807
});
18081808
}

0 commit comments

Comments
 (0)