if (scope->type == NJS_SCOPE_FUNCTION) {
nesting = scope->nesting + 1;
- if (nesting <= NJS_MAX_NESTING) {
+ if (nesting < NJS_MAX_NESTING) {
break;
}
/*
* The maximum possible function nesting level is (16 - NJS_SCOPE_CLOSURE),
- * that is 11. The 5 is reasonable limit.
+ * that is 11. The 8 is reasonable limit.
*/
-#define NJS_MAX_NESTING 5
+#define NJS_MAX_NESTING 8
#define NJS_SCOPES (NJS_SCOPE_CLOSURE + NJS_MAX_NESTING)
{ njs_str("function x(a) { while (a < 2) a++; return a + 1 } x(1) "),
njs_str("3") },
- { njs_str("(function(){(function(){(function(){(function(){"
- "(function(){(function(){(function(){})})})})})})})"),
- njs_str("SyntaxError: The maximum function nesting level is \"5\" in 1") },
+ { njs_str("(function(){"
+ "(function(){"
+ "(function(){"
+ "(function(){"
+ "(function(){"
+ "(function(){"
+ "(function(){"
+ "(function(){"
+ "(function(){})"
+ "})"
+ "})"
+ "})"
+ "})"
+ "})"
+ "})"
+ "})"
+ "})"),
+ njs_str("SyntaxError: The maximum function nesting level is \"8\" in 1") },
{ njs_str("Function.prototype.toString = function () {return 'X'};"
"eval"),