[Nice-commit] Nice/src/bossa/syntax if.nice,1.2,1.3
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-11-06 21:47:17
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23128/F:/nice/src/bossa/syntax Modified Files: if.nice Log Message: Improved pretty printing of if and ?:. Index: if.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/if.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** if.nice 3 Sep 2004 18:07:27 -0000 1.2 --- if.nice 6 Nov 2004 21:46:13 -0000 1.3 *************** *** 52,64 **** toString() { ! return ! "if(" + ! String.valueOf(condition) + ! ")\n" + ! String.valueOf(thenExp) + ! "\nelse\n" + ! String.valueOf(elseExp) + ! "\n" ! ; } } --- 52,62 ---- toString() { ! if (elseExp instanceof VoidConstantExp) ! return "if (" + condition + ")\n" + thenExp + "\n"; ! ! if (! (elseExp instanceof StatementExp)) ! return condition + " ? " + thenExp + " : " + elseExp; ! ! return "if (" + condition + ")\n" + thenExp + "\nelse\n" + elseExp + "\n"; } } |