Fix false-positive unexpected EOF in preparse_scope.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan 2015-06-30 14:33:48 +03:00 committed by Evgeny Gavrin
parent 0422e2230d
commit 4870550c8a
2 changed files with 16 additions and 0 deletions

View File

@ -2879,6 +2879,12 @@ preparse_scope (bool is_global)
size_t nesting_level = 0;
while (nesting_level > 0 || !token_is (end_tt))
{
/*
* FIXME:
* Remove preparse_scope; move variable declaration search to main pass of parser.
* When byte-code and scope storages would be introduced, move variable declarations
* from byte-code to scope descriptor.
*/
if (token_is (TOK_NAME))
{
if (lit_literal_equal_type_cstr (lit_get_literal_by_cp (token_data_as_lit_cp ()), "arguments"))
@ -2933,6 +2939,13 @@ preparse_scope (bool is_global)
{
break;
}
else if (token_is (TOK_CLOSE_BRACE))
{
/* the '}' would be handled during next iteration, reducing nesting level counter */
is_in_var_declaration_list = false;
break;
}
skip_token ();
}

View File

@ -18,6 +18,7 @@ assert (z === undefined);
assert (i === undefined);
assert (j === undefined);
assert (q === undefined);
assert (v === undefined);
eval ('var n');
eval ('var m = 1');
@ -46,3 +47,5 @@ for (var i, j = function () {var p;}; i === undefined; i = null)
for (var q in {})
{
}
{ var v = 1 }