Improve new.target handling in case of eval calls (#3517)
Only direct eval calls propagate the "new.target" information. In any other eval cases the "new.target" invocation is a syntax error. Added test cases also. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
05b4bda927
commit
608bc9e5ff
@@ -91,6 +91,30 @@ function eval_eval_test () {
|
||||
|
||||
new eval_eval_test ();
|
||||
|
||||
/* new.target is only valid in direct eval */
|
||||
function eval_test_2 () {
|
||||
var ev = eval;
|
||||
try {
|
||||
ev ("new.target");
|
||||
assert (false);
|
||||
} catch (ex) {
|
||||
assert (ex instanceof SyntaxError);
|
||||
}
|
||||
}
|
||||
|
||||
new eval_test_2 ();
|
||||
|
||||
function eval_test_3 () {
|
||||
var ev = eval;
|
||||
try {
|
||||
eval ("ev ('new.target')");
|
||||
assert (false);
|
||||
} catch (ex) {
|
||||
assert (ex instanceof SyntaxError);
|
||||
}
|
||||
}
|
||||
|
||||
new eval_test_3 ();
|
||||
|
||||
/* test assignment of the "new.target" */
|
||||
function expect_syntax_error (src)
|
||||
|
||||
Reference in New Issue
Block a user