Fix delayed variable creation for function declarations. (#3687)

Fixes #3658.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-04-21 11:59:30 +02:00
committed by GitHub
parent 0269b6c25d
commit 3900152631
2 changed files with 26 additions and 1 deletions
+2 -1
View File
@@ -525,7 +525,8 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
}
#if ENABLED (JERRY_ES2015)
if (is_function && (type & (SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LOCAL)) == SCANNER_LITERAL_IS_FUNC)
if (is_function
&& (type & (SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_FUNC_DECLARATION)) == SCANNER_LITERAL_IS_FUNC)
{
if (prev_literal_pool_p == NULL
&& (context_p->global_status_flags & ECMA_PARSE_DIRECT_EVAL)
@@ -0,0 +1,24 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// 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.
function g({
["y"]: {
a
}
})
{
{
function a() {}
}
}