public Object visit(ReturnStatement node) {
            Type type;
            Expression expr = node.getExpression();

            if (expr != null) {
                check(expr);
                type = expr.getType();
            }
            else {
                type = Type.VOID_TYPE;
            }

            if (mReturnType == null) {
                mReturnType = type;
            }
            else {
                Type newType = mReturnType.getCompatibleType(type);
                if (newType == null) {
                    error("returnstatement.type", type.getSimpleName(),
                          mReturnType.getSimpleName(), node);
                }
                mReturnType = newType;

                if (expr != null) {
                    expr.convertTo(mReturnType);
                }
            }

            return null;
        }