mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
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:
parent
17f7bad242
commit
f20db76dfb
@ -2447,7 +2447,7 @@ parse_switch_statement (void)
|
||||
{
|
||||
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);
|
||||
|
||||
start_dumping_case_clauses ();
|
||||
@ -2529,7 +2529,6 @@ parse_switch_statement (void)
|
||||
}
|
||||
|
||||
current_token_must_be (TOK_CLOSE_BRACE);
|
||||
skip_token ();
|
||||
|
||||
jsp_label_rewrite_jumps_and_pop (&label,
|
||||
serializer_get_current_instr_counter ());
|
||||
|
||||
22
tests/jerry/regression-test-issue-725.js
Normal file
22
tests/jerry/regression-test-issue-725.js
Normal file
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user