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:
committed by
Evgeny Gavrin
parent
0422e2230d
commit
4870550c8a
@@ -2879,6 +2879,12 @@ preparse_scope (bool is_global)
|
|||||||
size_t nesting_level = 0;
|
size_t nesting_level = 0;
|
||||||
while (nesting_level > 0 || !token_is (end_tt))
|
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 (token_is (TOK_NAME))
|
||||||
{
|
{
|
||||||
if (lit_literal_equal_type_cstr (lit_get_literal_by_cp (token_data_as_lit_cp ()), "arguments"))
|
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;
|
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 ();
|
skip_token ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ assert (z === undefined);
|
|||||||
assert (i === undefined);
|
assert (i === undefined);
|
||||||
assert (j === undefined);
|
assert (j === undefined);
|
||||||
assert (q === undefined);
|
assert (q === undefined);
|
||||||
|
assert (v === undefined);
|
||||||
|
|
||||||
eval ('var n');
|
eval ('var n');
|
||||||
eval ('var m = 1');
|
eval ('var m = 1');
|
||||||
@@ -46,3 +47,5 @@ for (var i, j = function () {var p;}; i === undefined; i = null)
|
|||||||
for (var q in {})
|
for (var q in {})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ var v = 1 }
|
||||||
|
|||||||
Reference in New Issue
Block a user