diff --git a/jerry-core/parser/js/js-lexer.c b/jerry-core/parser/js/js-lexer.c index f3ba9cc7ea..1351dc330c 100644 --- a/jerry-core/parser/js/js-lexer.c +++ b/jerry-core/parser/js/js-lexer.c @@ -1764,7 +1764,8 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */ && memcmp (source_p + 1, "rgument", 7) == 0) { context_p->lit_object.type = LEXER_LITERAL_OBJECT_ARGUMENTS; - if (!(context_p->status_flags & PARSER_ARGUMENTS_NOT_NEEDED)) + if (!(context_p->status_flags & PARSER_ARGUMENTS_NOT_NEEDED) + && literal_type == LEXER_IDENT_LITERAL) { context_p->status_flags |= PARSER_ARGUMENTS_NEEDED | PARSER_LEXICAL_ENV_NEEDED; context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_NO_REG_STORE; diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c index 9e4f46d111..9da259a919 100644 --- a/jerry-core/parser/js/js-parser-expr.c +++ b/jerry-core/parser/js/js-parser-expr.c @@ -1549,9 +1549,9 @@ parser_process_unary_expression (parser_context_t *context_p) /**< context */ else { if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL - && context_p->last_cbc.literal_object_type == LEXER_LITERAL_OBJECT_EVAL) + && context_p->last_cbc.literal_object_type == LEXER_LITERAL_OBJECT_EVAL + && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL) { - JERRY_ASSERT (context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL); context_p->status_flags |= PARSER_ARGUMENTS_NEEDED | PARSER_LEXICAL_ENV_NEEDED | PARSER_NO_REG_STORE; is_eval = true; } diff --git a/tests/jerry/fail/regression-test-issue-2659.js b/tests/jerry/fail/regression-test-issue-2659.js new file mode 100644 index 0000000000..8943ad950d --- /dev/null +++ b/tests/jerry/fail/regression-test-issue-2659.js @@ -0,0 +1,15 @@ +// 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. + +`eval`("eval ('super (a, b, c)')"); diff --git a/tests/jerry/regression-test-issue-2656.js b/tests/jerry/regression-test-issue-2656.js new file mode 100644 index 0000000000..dda755beaa --- /dev/null +++ b/tests/jerry/regression-test-issue-2656.js @@ -0,0 +1,22 @@ +// 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. + +var obj = { "arguments": "foo" } + +function testcase () +{ + return obj.hasOwnProperty ("arguments"); +} + +assert (testcase () === true);