From 04ca231fa4a75dda17c1e5cdd4c59b39ac8d0fce Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Wed, 28 Oct 2015 21:30:48 +0300 Subject: [PATCH] Fix jsp_early_error_check_for_duplication_of_prop_names. Related issue: #689 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com --- jerry-core/parser/js/jsp-early-error.cpp | 1 + tests/jerry/regression-test-issue-689.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/jerry/regression-test-issue-689.js diff --git a/jerry-core/parser/js/jsp-early-error.cpp b/jerry-core/parser/js/jsp-early-error.cpp index 8667b44b1..39433eed8 100644 --- a/jerry-core/parser/js/jsp-early-error.cpp +++ b/jerry-core/parser/js/jsp-early-error.cpp @@ -125,6 +125,7 @@ jsp_early_error_check_for_duplication_of_prop_names (bool is_strict, locus loc _ { if (STACK_SIZE (props) - STACK_TOP (size_t_stack) < 2) { + STACK_DROP (props, (size_t) (STACK_SIZE (props) - STACK_TOP (size_t_stack))); STACK_DROP (size_t_stack, 1); return; } diff --git a/tests/jerry/regression-test-issue-689.js b/tests/jerry/regression-test-issue-689.js new file mode 100644 index 000000000..925a85611 --- /dev/null +++ b/tests/jerry/regression-test-issue-689.js @@ -0,0 +1,20 @@ +// 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. + +'use strict'; + +function f (g) { + new g ({prop_name: 'value'}); +}