@@ -846,13 +846,13 @@ public boolean visit(PostfixExpression node) {
846846 }
847847 return false ;
848848 }
849- ITypeBinding typeBinding = node . getOperand () .resolveTypeBinding ();
849+ ITypeBinding typeBinding = left .resolveTypeBinding ();
850850 if (typeBinding != null && typeBinding .isPrimitive ()) {
851851 if ("char" .equals (typeBinding .getName ())) {
852852 buffer .append ("(" );
853- node . getOperand () .accept (this );
853+ left .accept (this );
854854 buffer .append (" = String.fromCharCode (($c$ = " );
855- node . getOperand () .accept (this );
855+ left .accept (this );
856856 String op = node .getOperator ().toString ();
857857 if ("++" .equals (op )) {
858858 buffer .append (").charCodeAt (0) + 1)" );
@@ -863,7 +863,7 @@ public boolean visit(PostfixExpression node) {
863863 return false ;
864864 }
865865 }
866- boxingNode (node . getOperand () );
866+ boxingNode (left );
867867 return false ;
868868 //return super.visit(node);
869869 }
@@ -971,24 +971,30 @@ public boolean visit(PrefixExpression node) {
971971 }
972972 return false ;
973973 }
974- ITypeBinding typeBinding = node . getOperand () .resolveTypeBinding ();
974+ ITypeBinding typeBinding = left .resolveTypeBinding ();
975975 if (typeBinding .isPrimitive ()) {
976976 if ("char" .equals (typeBinding .getName ())) {
977977 buffer .append ("(" );
978- node .getOperand ().accept (this );
979- buffer .append (" = String.fromCharCode ((" );
980- node .getOperand ().accept (this );
978+ left .accept (this );
979+ buffer .append (" = String.fromCharCode (" );
980+ if (left instanceof SimpleName || left instanceof QualifiedName ) {
981+ left .accept (this );
982+ } else {
983+ buffer .append ("(" );
984+ left .accept (this );
985+ buffer .append (")" );
986+ }
981987 if ("++" .equals (op )) {
982- buffer .append (") .charCodeAt (0) + 1)" );
988+ buffer .append (".charCodeAt (0) + 1)" );
983989 } else {
984- buffer .append (") .charCodeAt (0) - 1)" );
990+ buffer .append (".charCodeAt (0) - 1)" );
985991 }
986992 buffer .append (")" );
987993 return false ;
988994 }
989995 }
990996 buffer .append (node .getOperator ());
991- boxingNode (node . getOperand () );
997+ boxingNode (left );
992998 return false ;
993999 }
9941000
0 commit comments