Bug 750606 - Remove TreeContext::parser, thus avoiding cycles between TreeContext and Parser objects. r=bhackett.

This commit is contained in:
Nicholas Nethercote
2012-04-30 22:20:06 -07:00
parent addc7f53df
commit 92bf708d23
14 changed files with 439 additions and 424 deletions

View File

@@ -227,10 +227,10 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
if (inDirectivePrologue && !parser.recognizeDirectivePrologue(pn, &inDirectivePrologue))
goto out;
if (!FoldConstants(cx, pn, &bce))
if (!FoldConstants(cx, pn, bce.parser))
goto out;
if (!AnalyzeFunctions(&bce))
if (!AnalyzeFunctions(bce.parser))
goto out;
bce.functionList = NULL;
@@ -241,7 +241,7 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
if (!pn->isKind(PNK_SEMI) || !pn->pn_kid || !pn->pn_kid->isXMLItem())
onlyXML = false;
#endif
bce.freeTree(pn);
bce.parser->freeTree(pn);
}
#if JS_HAS_XML_SUPPORT
@@ -308,7 +308,7 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
return false;
/* FIXME: make Function format the source for a function definition. */
ParseNode *fn = FunctionNode::create(PNK_NAME, &funbce);
ParseNode *fn = FunctionNode::create(PNK_NAME, funbce.parser);
if (fn) {
fn->pn_body = NULL;
fn->pn_cookie.makeFree();
@@ -324,7 +324,7 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
fn = NULL;
} else {
for (unsigned i = 0; i < nargs; i++) {
if (!DefineArg(fn, names[i].maybeAtom, i, &funbce)) {
if (!DefineArg(fn, names[i].maybeAtom, i, funbce.parser)) {
fn = NULL;
break;
}
@@ -343,10 +343,10 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
if (!tokenStream.matchToken(TOK_EOF)) {
parser.reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
pn = NULL;
} else if (!FoldConstants(cx, pn, &funbce)) {
} else if (!FoldConstants(cx, pn, funbce.parser)) {
/* FoldConstants reported the error already. */
pn = NULL;
} else if (!AnalyzeFunctions(&funbce)) {
} else if (!AnalyzeFunctions(funbce.parser)) {
pn = NULL;
} else {
if (fn->pn_body) {