Skip to content

Commit a536073

Browse files
Add literal registration in parse_member_expression (TOK_KEYWORD case).
Related issue: #116 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
1 parent 89a7449 commit a536073

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

jerry-core/parser/js/parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ parse_member_expression (operand *this_arg, operand *prop_gl)
773773
else if (token_is (TOK_KEYWORD))
774774
{
775775
const char *s = lexer_keyword_to_string ((keyword) token_data ());
776-
literal_t lit = lit_find_literal_by_charset ((const ecma_char_t *) s, (ecma_length_t) strlen (s));
776+
literal_t lit = lit_find_or_create_literal_from_charset ((const ecma_char_t *) s, (ecma_length_t) strlen (s));
777777
if (lit == NULL)
778778
{
779779
EMIT_ERROR ("Expected identifier");
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2015 Samsung Electronics Co., Ltd.
2+
// Copyright 2015 University of Szeged.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
try
17+
{
18+
Symbol.for.length.toString.length.toExponential.length.valueOf.length.toExponential.length.valueOf.length.toFixed.name.anchor.name.bold.length.toExponential.caller;
19+
assert (false);
20+
}
21+
catch (e)
22+
{
23+
assert (e instanceof ReferenceError);
24+
}

0 commit comments

Comments
 (0)