Skip to content

Commit 4656ce7

Browse files
committed
Fix "arguments" string parsing inside functions
This patch fixes #2656. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
1 parent aae50c9 commit 4656ce7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
17641764
&& memcmp (source_p + 1, "rgument", 7) == 0)
17651765
{
17661766
context_p->lit_object.type = LEXER_LITERAL_OBJECT_ARGUMENTS;
1767-
if (!(context_p->status_flags & PARSER_ARGUMENTS_NOT_NEEDED))
1767+
if (!(context_p->status_flags & PARSER_ARGUMENTS_NOT_NEEDED) && literal_type != LEXER_STRING_LITERAL)
17681768
{
17691769
context_p->status_flags |= PARSER_ARGUMENTS_NEEDED | PARSER_LEXICAL_ENV_NEEDED;
17701770
context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_NO_REG_STORE;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
var obj = { "arguments": "foo" }
16+
17+
function testcase ()
18+
{
19+
return obj.hasOwnProperty ("arguments");
20+
}
21+
22+
assert (testcase () === true);

0 commit comments

Comments
 (0)