default: JS_ReportError(cx, "unknown type %d", (int)type);
default: { char numBuf[12]; sprintf(numBuf, "%d", (int)type); JS_ReportErrorNumber(cx, NULL, JSMSG_BAD_TYPE, numBuf);
JS_ConvertValue(JSContext *cx, jsval v, JSType type, jsval *vp){    JSBool ok, b;    JSObject *obj;    JSFunction *fun;    JSString *str;    jsdouble d, *dp;    CHECK_REQUEST(cx);    switch (type) {      case JSTYPE_VOID:	*vp = JSVAL_VOID;	break;      case JSTYPE_OBJECT:	ok = js_ValueToObject(cx, v, &obj);	if (ok)	    *vp = OBJECT_TO_JSVAL(obj);	break;      case JSTYPE_FUNCTION:	fun = js_ValueToFunction(cx, &v, JS_FALSE);	ok = (fun != NULL);	if (ok)	    *vp = OBJECT_TO_JSVAL(fun->object);	break;      case JSTYPE_STRING:	str = js_ValueToString(cx, v);	ok = (str != NULL);	if (ok)	    *vp = STRING_TO_JSVAL(str);	break;      case JSTYPE_NUMBER:	ok = js_ValueToNumber(cx, v, &d);	if (ok) {	    dp = js_NewDouble(cx, d);	    ok = (dp != NULL);	    if (ok)		*vp = DOUBLE_TO_JSVAL(dp);	}	break;      case JSTYPE_BOOLEAN:	ok = js_ValueToBoolean(cx, v, &b);	if (ok)	    *vp = BOOLEAN_TO_JSVAL(b);	break;      default:	JS_ReportError(cx, "unknown type %d", (int)type);	ok = JS_FALSE;	break;    }    return ok;}