code: public void castToBool(int mark, boolean emptyDefault) {
          int size = stack.size();
          MethodVisitor mv = controller.getMethodVisitor();
          if (mark==size) {
              // no element, so use emptyDefault
              if (emptyDefault) {
                  mv.visitIntInsn(BIPUSH, 1);
              } else {
                  mv.visitIntInsn(BIPUSH, 0);
              }
              stack.add(null);
          } else if (mark==stack.size()-1) {
              ClassNode last =  stack.get(size-1);
              // nothing to do in that case
              if (last == ClassHelper.boolean_TYPE) return;
              // not a primitive type, so call booleanUnbox
              if (!ClassHelper.isPrimitiveType(last)) {
                  controller.getInvocationWriter().castNonPrimitiveToBool(last);
              } else {
                  primitive2b(mv,last);
              }            
          } else { 
              throw new GroovyBugError(
                      "operand stack contains "+stack.size()+
                      " elements, but we expected only "+mark
                  );
          }
          stack.set(mark,ClassHelper.boolean_TYPE);
      }
docs: ensure last marked parameter on the stack is a primitive boolean
  if mark==stack size, we assume an empty expression or statement.
  was used and we will use the value given in emptyDefault as boolean
  if mark==stack.size()-1 the top element will be cast to boolean using
  Groovy truth.
  In other cases we throw a GroovyBugError