Skip to content

Commit 5e8c8e3

Browse files
author
Philip Guo
committed
cleaned up labels to match john denero's version
1 parent ac9beaf commit 5e8c8e3

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎v3/js/pytutor.js‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
102102
// with some new user input (somewhat hacky!)
103103
// highlightLines - highlight current and previously executed lines (default: false)
104104
// arrowLines - draw arrows pointing to current and previously executed lines (default: true)
105+
// compactFuncLabels - render functions with a 'func' prefix and no type label
105106
// pyCrazyMode - run with Py2crazy, which provides expression-level
106107
// granularity instead of line-level granularity (HIGHLY EXPERIMENTAL!)
107108
function ExecutionVisualizer(domRootID, dat, params) {
@@ -160,6 +161,8 @@ function ExecutionVisualizer(domRootID, dat, params) {
160161
this.params.arrowLines = !(this.params.highlightLines);
161162
}
162163

164+
this.compactFuncLabels = this.params.compactFuncLabels;
165+
163166
// audible!
164167
if (this.params.pyCrazyMode) {
165168
this.params.arrowLines = this.params.highlightLines = false;
@@ -485,7 +488,7 @@ ExecutionVisualizer.prototype.render = function() {
485488
// (note that we need to keep #globals_area separate from #stack for d3 to work its magic)
486489
this.domRoot.find("#globals_area").append('<div class="stackFrame" id="'
487490
+ myViz.generateID('globals') + '"><div id="' + myViz.generateID('globals_header')
488-
+ '" class="stackFrameHeader">Global variables</div><table class="stackFrameVarTable" id="'
491+
+ '" class="stackFrameHeader">Global frame</div><table class="stackFrameVarTable" id="'
489492
+ myViz.generateID('global_table') + '"></table></div>');
490493

491494

@@ -2393,13 +2396,17 @@ ExecutionVisualizer.prototype.renderDataStructures = function() {
23932396
var funcName = htmlspecialchars(obj[1]).replace('&lt;lambda&gt;', '\u03bb');
23942397
var parentFrameID = obj[2]; // optional
23952398

2396-
d3DomElement.append('<div class="typeLabel">' + typeLabelPrefix + 'function</div>');
2399+
if (!myViz.compactFuncLabels) {
2400+
d3DomElement.append('<div class="typeLabel">' + typeLabelPrefix + 'function</div>');
2401+
}
2402+
2403+
var funcPrefix = myViz.compactFuncLabels ? 'func' : '';
23972404

23982405
if (parentFrameID) {
2399-
d3DomElement.append('<div class="funcObj">' + funcName + ' [parent=f'+ parentFrameID + ']</div>');
2406+
d3DomElement.append('<div class="funcObj">' + funcPrefix + ' ' + funcName + ' [parent=f'+ parentFrameID + ']</div>');
24002407
}
24012408
else {
2402-
d3DomElement.append('<div class="funcObj">' + funcName + '</div>');
2409+
d3DomElement.append('<div class="funcObj">' + funcPrefix + ' ' + funcName + '</div>');
24032410
}
24042411
}
24052412
else if (obj[0] == 'HEAP_PRIMITIVE') {

0 commit comments

Comments
 (0)