Fix handling of EOF in insert_semicolon.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
committed by
Evgeny Gavrin
parent
cf9d54545f
commit
c120433158
@@ -2536,15 +2536,13 @@ insert_semicolon (void)
|
|||||||
{
|
{
|
||||||
// We cannot use tok, since we may use lexer_save_token
|
// We cannot use tok, since we may use lexer_save_token
|
||||||
skip_token ();
|
skip_token ();
|
||||||
if (token_is (TOK_NEWLINE) || lexer_prev_token ().type == TOK_NEWLINE)
|
|
||||||
|
bool is_new_line_occured = (token_is (TOK_NEWLINE) || lexer_prev_token ().type == TOK_NEWLINE);
|
||||||
|
bool is_close_brace_or_eof = (token_is (TOK_CLOSE_BRACE) || token_is (TOK_EOF));
|
||||||
|
|
||||||
|
if (is_new_line_occured || is_close_brace_or_eof)
|
||||||
{
|
{
|
||||||
lexer_save_token (tok);
|
lexer_save_token (tok);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (token_is (TOK_CLOSE_BRACE))
|
|
||||||
{
|
|
||||||
lexer_save_token (tok);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (!token_is (TOK_SEMICOLON))
|
else if (!token_is (TOK_SEMICOLON))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2015 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
var f = new Function ('return a');
|
||||||
Reference in New Issue
Block a user