Bug 514585: Move 'grouped' to explicit param of JS_NEW_PRINTER. r=igor

Make all the JSPrinter status bits explicit flags to JS_NEW_PRINTER.
Only in public-facing functions like JS_DecompileFunction should we be
peeling bits out of indent values and turning them into flags;
internally, we can change interfaces to make more sense.

This is preparation for adding another flag to JS_NEW_PRINTER.
This commit is contained in:
Jim Blandy
2009-11-05 14:34:39 -08:00
parent 6744dd7625
commit bdf67b8e69
3 changed files with 49 additions and 52 deletions

View File

@@ -276,16 +276,16 @@ js_QuoteString(JSContext *cx, JSString *str, jschar quote);
*/
#ifdef JS_ARENAMETER
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
js_NewPrinter(cx, name, fun, indent, pretty)
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped) \
js_NewPrinter(cx, name, fun, indent, pretty, grouped)
#else
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty) \
js_NewPrinter(cx, fun, indent, pretty)
# define JS_NEW_PRINTER(cx, name, fun, indent, pretty, grouped) \
js_NewPrinter(cx, fun, indent, pretty, grouped)
#endif
extern JSPrinter *
JS_NEW_PRINTER(JSContext *cx, const char *name, JSFunction *fun,
uintN indent, JSBool pretty);
uintN indent, JSBool pretty, JSBool grouped);
extern void
js_DestroyPrinter(JSPrinter *jp);
@@ -427,6 +427,11 @@ js_DecompileFunctionBody(JSPrinter *jp);
extern JSBool
js_DecompileFunction(JSPrinter *jp);
extern JSString *
js_DecompileToString(JSContext *cx, const char *name, JSFunction *fun,
uintN indent, JSBool pretty, JSBool grouped,
JSBool (*decompiler)(JSPrinter *jp));
/*
* Find the source expression that resulted in v, and return a newly allocated
* C-string containing it. Fall back on v's string conversion (fallback) if we