@@ -654,7 +654,7 @@ ExecutionVisualizer.prototype.render = function() {
654654 // (note that we need to keep #globals_area separate from #stack for d3 to work its magic)
655655 this . domRoot . find ( "#globals_area" ) . append ( '<div class="stackFrame" id="'
656656 + myViz . generateID ( 'globals' ) + '"><div id="' + myViz . generateID ( 'globals_header' )
657- + '" class="stackFrameHeader">Global frame</div><table class="stackFrameVarTable" id="'
657+ + '" class="stackFrameHeader">' + this . getRealLabel ( ' Global frame' ) + ' </div><table class="stackFrameVarTable" id="'
658658 + myViz . generateID ( 'global_table' ) + '"></table></div>' ) ;
659659
660660
@@ -3220,17 +3220,17 @@ ExecutionVisualizer.prototype.renderPrimitiveObject = function(obj, d3DomElement
32203220 var typ = typeof obj ;
32213221
32223222 if ( obj == null ) {
3223- d3DomElement . append ( '<span class="nullObj">None</span>' ) ;
3223+ d3DomElement . append ( '<span class="nullObj">' + this . getRealLabel ( ' None' ) + ' </span>') ;
32243224 }
32253225 else if ( typ == "number" ) {
32263226 d3DomElement . append ( '<span class="numberObj">' + obj + '</span>' ) ;
32273227 }
32283228 else if ( typ == "boolean" ) {
32293229 if ( obj ) {
3230- d3DomElement . append ( '<span class="boolObj">True</span>' ) ;
3230+ d3DomElement . append ( '<span class="boolObj">' + this . getRealLabel ( ' True' ) + ' </span>') ;
32313231 }
32323232 else {
3233- d3DomElement . append ( '<span class="boolObj">False</span>' ) ;
3233+ d3DomElement . append ( '<span class="boolObj">' + this . getRealLabel ( ' False' ) + ' </span>') ;
32343234 }
32353235 }
32363236 else if ( typ == "string" ) {
@@ -3419,11 +3419,7 @@ function(objID, stepNum, d3DomElement, isTopLevel) {
34193419 assert ( obj . length >= headerLength ) ;
34203420
34213421 if ( isInstance ) {
3422- if ( obj . length === headerLength ) {
3423- d3DomElement . append ( '<div class="typeLabel">' + typeLabelPrefix + obj [ 1 ] + ' empty ' + myViz . getRealLabel ( 'instance' ) + '</div>' ) ;
3424- } else {
3425- d3DomElement . append ( '<div class="typeLabel">' + typeLabelPrefix + obj [ 1 ] + ' ' + myViz . getRealLabel ( 'instance' ) + '</div>' ) ;
3426- }
3422+ d3DomElement . append ( '<div class="typeLabel">' + typeLabelPrefix + obj [ 1 ] + ' ' + myViz . getRealLabel ( 'instance' ) + '</div>' ) ;
34273423 }
34283424 else {
34293425 var superclassStr = '' ;
@@ -3523,7 +3519,7 @@ function(objID, stepNum, d3DomElement, isTopLevel) {
35233519 var parentFrameID = obj [ 2 ] ; // optional
35243520
35253521 if ( ! myViz . compactFuncLabels ) {
3526- d3DomElement . append ( '<div class="typeLabel">' + typeLabelPrefix + 'function</div>' ) ;
3522+ d3DomElement . append ( '<div class="typeLabel">' + typeLabelPrefix + myViz . getRealLabel ( 'function' ) + ' </div>') ;
35273523 }
35283524
35293525 var funcPrefix = myViz . compactFuncLabels ? 'func' : '' ;
@@ -3613,14 +3609,24 @@ ExecutionVisualizer.prototype.getRealLabel = function(label) {
36133609 return 'array' ;
36143610 } else if ( label === 'instance' ) {
36153611 return 'object' ;
3612+ } else if ( label === 'True' ) {
3613+ return 'true' ;
3614+ } else if ( label === 'False' ) {
3615+ return 'false' ;
36163616 }
36173617 }
36183618
36193619 if ( this . params . lang === 'ruby' ) {
36203620 if ( label === 'dict' ) {
36213621 return 'hash' ;
3622+ } else if ( label === 'set' ) {
3623+ return 'Set' ; // the Ruby Set class is capitalized
36223624 } else if ( label === 'function' ) {
36233625 return 'method' ;
3626+ } else if ( label === 'None' ) {
3627+ return 'nil' ;
3628+ } else if ( label === 'Global frame' ) {
3629+ return 'Global Object' ;
36243630 }
36253631 }
36263632
@@ -3715,6 +3721,8 @@ String.prototype.rtrim = function() {
37153721// also some variable names are like '.0' (for generator expressions),
37163722// and '.' seems to be illegal.
37173723//
3724+ // also '!' and '?' are common in Ruby, so escape those as well
3725+ //
37183726// also spaces are illegal, so convert to '_'
37193727// TODO: what other characters are illegal???
37203728var lbRE = new RegExp ( '\\[|{|\\(|<' , 'g' ) ;
@@ -3724,6 +3732,8 @@ function varnameToCssID(varname) {
37243732 // rather than just replacing the first entry
37253733 return varname . replace ( lbRE , 'LeftB_' )
37263734 . replace ( rbRE , '_RightB' )
3735+ . replace ( / [ ! ] / g, '_BANG_' )
3736+ . replace ( / [ ? ] / g, '_QUES_' )
37273737 . replace ( / [: ] / g, '_COLON_' )
37283738 . replace ( / [ . ] / g, '_DOT_' )
37293739 . replace ( / / g, '_' ) ;
0 commit comments