Fix strict mode in an object initializer's getters / setters definition.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan 2015-07-10 21:35:49 +03:00 committed by Evgeny Gavrin
parent 4f58104981
commit 7ccec19c26
2 changed files with 13 additions and 5 deletions

View File

@ -393,9 +393,6 @@ parse_property_assignment (void)
dump_function_end_for_rewrite ();
const bool is_strict = scopes_tree_strict_mode (STACK_TOP (scopes));
scopes_tree_set_strict_mode (STACK_TOP (scopes), false);
token_after_newlines_must_be (TOK_OPEN_BRACE);
skip_newlines ();
@ -410,8 +407,6 @@ parse_property_assignment (void)
token_after_newlines_must_be (TOK_CLOSE_BRACE);
scopes_tree_set_strict_mode (STACK_TOP (scopes), is_strict);
dump_ret ();
rewrite_function_end (VARG_FUNC_EXPR);

View File

@ -24,3 +24,16 @@ function c() {
assert (b.let + b.enum === 25)
}
c();
function d () {
"use strict";
try {
/* 'let' is a FutureReservedWord in strict mode code */
eval ('var a = { get prop () { let = 1; } }');
assert (false);
} catch (e) {
assert (e instanceof SyntaxError);
}
}
d ();