Skip to content

Commit 48cec48

Browse files
rerobikadbatyai
authored andcommitted
Identifiers should be stored in the lexical environment if argument object needs to be created (#2816)
This patch fixes #2699. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 40f7b1c commit 48cec48

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

jerry-core/parser/js/js-parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
226226
{
227227
if (literal_p->status_flags & LEXER_FLAG_VAR)
228228
{
229-
if (status_flags & PARSER_NO_REG_STORE)
229+
if (status_flags & (PARSER_NO_REG_STORE | PARSER_ARGUMENTS_NEEDED))
230230
{
231231
literal_p->status_flags |= LEXER_FLAG_NO_REG_STORE;
232232
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
function f(a) {
16+
function a() {
17+
return 5;
18+
}
19+
20+
assert (typeof a === "function");
21+
assert (a () === 5);
22+
assert (arguments[0] () === 5);
23+
}
24+
25+
f (6);

0 commit comments

Comments
 (0)