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-10-27 16:38:09 -07:00
parent aa84d1298b
commit 035f154980
3 changed files with 53 additions and 56 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, bool pretty, bool grouped);
extern void
js_DestroyPrinter(JSPrinter *jp);
@@ -421,12 +421,17 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc,
extern JSBool
js_DecompileScript(JSPrinter *jp, JSScript *script);
extern JSBool
extern bool
js_DecompileFunctionBody(JSPrinter *jp);
extern JSBool
extern bool
js_DecompileFunction(JSPrinter *jp);
extern JSString *
js_DecompileToString(JSContext *cx, const char *name, JSFunction *fun,
uintN indent, bool pretty, bool grouped,
bool (*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