Parser p = new Parser(compilerEnv, compilationErrorReporter);
if (returnFunction) {
p.calledByCompileFunction = true;
}
AstRoot ast;
if (sourceString != null) {
ast = p.parse(sourceString, sourceName, lineno);
} else {
ast = p.parse(sourceReader, sourceName, lineno);
}
if (returnFunction) {
// parser no longer adds function to script node
if (!(ast.getFirstChild() != null
&& ast.getFirstChild().getType() == Token.FUNCTION))
{
// XXX: the check just looks for the first child
// and allows for more nodes after it for compatibility
// with sources like function() {};;;
throw new IllegalArgumentException(