Fix parse error of parse_switch_statement
Related issue: #725 JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
This commit is contained in:
@@ -2447,7 +2447,7 @@ parse_switch_statement (void)
|
|||||||
{
|
{
|
||||||
assert_keyword (KW_SWITCH);
|
assert_keyword (KW_SWITCH);
|
||||||
|
|
||||||
const jsp_operand_t switch_expr = parse_expression_inside_parens ();
|
const jsp_operand_t switch_expr = dump_assignment_of_lhs_if_literal (parse_expression_inside_parens ());
|
||||||
token_after_newlines_must_be (TOK_OPEN_BRACE);
|
token_after_newlines_must_be (TOK_OPEN_BRACE);
|
||||||
|
|
||||||
start_dumping_case_clauses ();
|
start_dumping_case_clauses ();
|
||||||
@@ -2529,7 +2529,6 @@ parse_switch_statement (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_token_must_be (TOK_CLOSE_BRACE);
|
current_token_must_be (TOK_CLOSE_BRACE);
|
||||||
skip_token ();
|
|
||||||
|
|
||||||
jsp_label_rewrite_jumps_and_pop (&label,
|
jsp_label_rewrite_jumps_and_pop (&label,
|
||||||
serializer_get_current_instr_counter ());
|
serializer_get_current_instr_counter ());
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2015 Samsung Electronics Co., Ltd.
|
||||||
|
// Copyright 2015 University of Szeged.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
try {
|
||||||
|
eval("switch(foo){} {}");
|
||||||
|
assert(false);
|
||||||
|
} catch (e) {
|
||||||
|
assert(e instanceof ReferenceError);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user