Bug 313803 uneval() on func with embedded object with getter or setter has unmatched parenthesis

patch by colin@theblakes.com r=mrbkap sr=brendan
This commit is contained in:
timeless%mozdev.org 2005-10-26 05:23:50 +00:00
Родитель bb90d10c30
Коммит cb74f5c92d
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -540,7 +540,7 @@ js_printf(JSPrinter *jp, const char *format, ...)
/* Suppress newlines (must be once per format, at the end) if not pretty. */ /* Suppress newlines (must be once per format, at the end) if not pretty. */
fp = NULL; fp = NULL;
if (!jp->pretty && format[cc = strlen(format)-1] == '\n') { if (!jp->pretty && format[cc = strlen(format) - 1] == '\n') {
fp = JS_strdup(jp->sprinter.context, format); fp = JS_strdup(jp->sprinter.context, format);
if (!fp) if (!fp)
return -1; return -1;
@ -2448,13 +2448,15 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
rval); rval);
#else #else
if (lastop == JSOP_GETTER || lastop == JSOP_SETTER) { if (lastop == JSOP_GETTER || lastop == JSOP_SETTER) {
todo = Sprint(&ss->sprinter, "%s%s%s %s%s", rval += strlen(js_function_str) + 1;
todo = Sprint(&ss->sprinter, "%s%s%s %s%.*s",
lval, lval,
(lval[1] != '\0') ? ", " : "", (lval[1] != '\0') ? ", " : "",
(lastop == JSOP_GETTER) (lastop == JSOP_GETTER)
? js_get_str : js_set_str, ? js_get_str : js_set_str,
xval, xval,
rval + strlen(js_function_str) + 1); strlen(rval) - 1,
rval);
} else { } else {
todo = Sprint(&ss->sprinter, "%s%s%s:%s", todo = Sprint(&ss->sprinter, "%s%s%s:%s",
lval, lval,