Fixing bug 309029: remind parser about Context.compileFunction case.

This commit is contained in:
igor%mir2.org 2005-09-18 11:11:06 +00:00
parent 942745b2cd
commit d3457ec733
3 changed files with 23 additions and 1 deletions

View File

@ -360,6 +360,22 @@ rethrown erro...</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl26" style="height: 12.75pt; width: 48pt; text-align: left;" x:num="" height="17" width="64"><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=306825">306825</a></td>
<td class="xl25" style="width: 330pt;" width="440">Allow to use shell.Global in servlets</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl26" style="height: 12.75pt; width: 48pt; text-align: left;" x:num="" height="17" width="64"><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=309029"></a>309029</td>
<td class="xl25" style="width: 330pt;" width="440">Exception when evaluating recursive function</td>
</tr>
</tbody>
</table>

View File

@ -2182,6 +2182,9 @@ public class Context
}
Parser p = new Parser(compilerEnv, compilationErrorReporter);
if (returnFunction) {
p.calledByCompileFunction = true;
}
ScriptOrFnNode tree;
if (sourceString != null) {
tree = p.parse(sourceString, sourceName, lineno);

View File

@ -68,6 +68,7 @@ public class Parser
CompilerEnvirons compilerEnv;
private ErrorReporter errorReporter;
private String sourceURI;
boolean calledByCompileFunction;
private TokenStream ts;
private int currentFlaggedToken;
@ -340,7 +341,9 @@ public class Parser
if (tt == Token.FUNCTION) {
consumeToken();
try {
n = function(FunctionNode.FUNCTION_STATEMENT);
n = function(calledByCompileFunction
? FunctionNode.FUNCTION_EXPRESSION
: FunctionNode.FUNCTION_STATEMENT);
} catch (ParserException e) {
break;
}