252995: reordering script_toSource and script_toString, r=brendan

This commit is contained in:
crowder%fiverocks.com 2007-01-29 04:50:34 +00:00
parent 5f4bc4067d
commit 5f80275577

View File

@ -72,13 +72,17 @@ static JSBool
script_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
{
uint32 indent;
JSScript *script;
size_t i, j, k, n;
char buf[16];
jschar *s, *t;
uint32 indent;
JSString *str;
indent = 0;
if (argc && !js_ValueToECMAUint32(cx, argv[0], &indent))
return JS_FALSE;
if (!JS_InstanceOf(cx, obj, &js_ScriptClass, argv))
return JS_FALSE;
script = (JSScript *) JS_GetPrivate(cx, obj);
@ -91,9 +95,6 @@ script_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
k = 0;
s = NULL; /* quell GCC overwarning */
} else {
indent = 0;
if (argc && !js_ValueToECMAUint32(cx, argv[0], &indent))
return JS_FALSE;
str = JS_DecompileScript(cx, script, "Script.prototype.toSource",
(uintN)indent);
if (!str)
@ -133,10 +134,14 @@ static JSBool
script_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
{
JSScript *script;
uint32 indent;
JSScript *script;
JSString *str;
indent = 0;
if (argc && !js_ValueToECMAUint32(cx, argv[0], &indent))
return JS_FALSE;
if (!JS_InstanceOf(cx, obj, &js_ScriptClass, argv))
return JS_FALSE;
script = (JSScript *) JS_GetPrivate(cx, obj);
@ -145,9 +150,6 @@ script_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
return JS_TRUE;
}
indent = 0;
if (argc && !js_ValueToECMAUint32(cx, argv[0], &indent))
return JS_FALSE;
str = JS_DecompileScript(cx, script, "Script.prototype.toString",
(uintN)indent);
if (!str)