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:
committed by
Evgeny Gavrin
parent
4f58104981
commit
7ccec19c26
@@ -393,9 +393,6 @@ parse_property_assignment (void)
|
|||||||
|
|
||||||
dump_function_end_for_rewrite ();
|
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);
|
token_after_newlines_must_be (TOK_OPEN_BRACE);
|
||||||
skip_newlines ();
|
skip_newlines ();
|
||||||
|
|
||||||
@@ -410,8 +407,6 @@ parse_property_assignment (void)
|
|||||||
|
|
||||||
token_after_newlines_must_be (TOK_CLOSE_BRACE);
|
token_after_newlines_must_be (TOK_CLOSE_BRACE);
|
||||||
|
|
||||||
scopes_tree_set_strict_mode (STACK_TOP (scopes), is_strict);
|
|
||||||
|
|
||||||
dump_ret ();
|
dump_ret ();
|
||||||
rewrite_function_end (VARG_FUNC_EXPR);
|
rewrite_function_end (VARG_FUNC_EXPR);
|
||||||
|
|
||||||
|
|||||||
@@ -24,3 +24,16 @@ function c() {
|
|||||||
assert (b.let + b.enum === 25)
|
assert (b.let + b.enum === 25)
|
||||||
}
|
}
|
||||||
c();
|
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 ();
|
||||||
|
|||||||
Reference in New Issue
Block a user