77- substitute in a non-live version of the live editor from opt-live.js
88 in addition to the janky current version of the editor
99
10- - test Java after massive refactorings
11-
12- - parse Java viz_options in users' java code:
13- https://github.com/daveagp/java_visualize/blob/1489078712310eda44391f09405e0f71b2b190c9/jv-frontend.js#L101
14-
15- - implement other missing Java functionality while i'm at it :0
16- - also implement these options and stdin support too:
17- var optionNames = ['showStringsAsObjects', 'showAllFields', 'disableNesting'];
18-
19- [probably do this in the FRONTEND and not in pytutor.js]
20-
2110*/
2211
2312
@@ -735,18 +724,7 @@ export class ExecutionVisualizer {
735724 function ( args ) {
736725 var obj = args . obj , d3DomElement = args . d3DomElement ;
737726 var typ = typeof obj ;
738- // TODO: can probably simplify with default handling and getRealLabel:
739- if ( obj == null )
740- d3DomElement . append ( '<span class="nullObj">null</span>' ) ;
741- else if ( typ == "number" )
742- d3DomElement . append ( '<span class="numberObj">' + obj + '</span>' ) ;
743- else if ( typ == "boolean" ) {
744- if ( obj )
745- d3DomElement . append ( '<span class="boolObj">true</span>' ) ;
746- else
747- d3DomElement . append ( '<span class="boolObj">false</span>' ) ;
748- }
749- else if ( obj instanceof Array && obj [ 0 ] == "VOID" ) {
727+ if ( obj instanceof Array && obj [ 0 ] == "VOID" ) {
750728 d3DomElement . append ( '<span class="voidObj">void</span>' ) ;
751729 }
752730 else if ( obj instanceof Array && obj [ 0 ] == "NUMBER-LITERAL" ) {
@@ -1176,9 +1154,7 @@ class DataVisualizer {
11761154 } else if ( label === 'set' ) {
11771155 return 'Set' ;
11781156 }
1179- }
1180-
1181- if ( this . params . lang === 'ruby' ) {
1157+ } else if ( this . params . lang === 'ruby' ) {
11821158 if ( label === 'dict' ) {
11831159 return 'hash' ;
11841160 } else if ( label === 'set' ) {
@@ -1190,9 +1166,17 @@ class DataVisualizer {
11901166 } else if ( label === 'Global frame' ) {
11911167 return 'Global Object' ;
11921168 }
1169+ } else if ( this . params . lang === 'java' ) {
1170+ if ( label === 'None' ) {
1171+ return 'null' ;
1172+ } else if ( label === 'True' ) {
1173+ return 'true' ;
1174+ } else if ( label === 'False' ) {
1175+ return 'false' ;
1176+ }
11931177 }
11941178
1195- // default fallthrough case
1179+ // default fallthrough case if no matches above
11961180 return label ;
11971181 }
11981182
0 commit comments