Skip to content

Commit 787baa2

Browse files
committed
bam
1 parent c985f70 commit 787baa2

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

PyTutorGAE/js/pytutor.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,12 +1453,6 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
14531453

14541454
// Render globals and then stack frames using d3:
14551455

1456-
// TODO: However, I need to think carefully about what to use as
1457-
// object keys for stack objects. Perhaps a combination of function
1458-
// name and current position index? This might handle recursive calls
1459-
// well (i.e., when there are multiple invocations of the same
1460-
// function on the stack)
1461-
14621456

14631457
// render all global variables IN THE ORDER they were created by the program,
14641458
// in order to ensure continuity:
@@ -1569,7 +1563,9 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
15691563

15701564
var stackFrameDiv = stackDiv.selectAll('div')
15711565
.data(curEntry.stack_to_render, function(frame) {
1572-
return frame.unique_hash; // VERY IMPORTANT for properly handling closures and nested functions
1566+
// VERY VERY VERY IMPORTANT for properly handling closures and nested functions
1567+
// (see the backend code for more details)
1568+
return frame.unique_hash;
15731569
});
15741570

15751571
stackFrameDiv.enter()
@@ -1578,9 +1574,6 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
15781574
.attr('id', function(d, i) {return d.is_zombie ? myViz.generateID("zombie_stack" + i)
15791575
: myViz.generateID("stack" + i);
15801576
})
1581-
//.append('div')
1582-
//.attr('class', 'stackFrameHeader')
1583-
// TODO: perhaps this table keeps on getting cleared out since it's done on enter()?!?
15841577
.append('table')
15851578
.attr('class', 'stackFrameVarTable')
15861579

@@ -1609,30 +1602,23 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
16091602

16101603
stackVarTableCells.enter()
16111604
.append('td')
1605+
.attr('class', function(d, i) {return (i == 0) ? 'stackFrameVar' : 'stackFrameValue';})
16121606

16131607
stackVarTableCells
16141608
.order() // VERY IMPORTANT to put in the order corresponding to data elements
1615-
.attr('class', function(d, i) {return (i == 0) ? 'stackFrameVar' : 'stackFrameValue';})
1616-
.html(function(d, i) {
1609+
.each(function(d, i) {
16171610
var varname = d.varname;
16181611
var frame = d.frame;
1612+
16191613
if (i == 0) {
16201614
if (varname == '__return__' && !frame.is_zombie) {
1621-
return '<span class="retval">Return value</span>'
1615+
$(this).html('<span class="retval">Return value</span>');
16221616
}
16231617
else {
1624-
return varname;
1618+
$(this).html(varname);
16251619
}
16261620
}
16271621
else {
1628-
return ''; // will update in .each()
1629-
}
1630-
})
1631-
.each(function(d, i) {
1632-
var varname = d.varname;
1633-
var frame = d.frame;
1634-
1635-
if (i == 1) {
16361622
var val = frame.encoded_locals[varname];
16371623

16381624
// include type in repr to prevent conflating integer 5 with string "5"

0 commit comments

Comments
 (0)