Files
vectorcraft/docs
dotCooCoo 2f9621bc38 Scripts: direct eval inside a function reads its new.target
In a .js script, `function F() { return eval("new.target"); } new F()`
threw a SyntaxError: eval code was always parsed as if it were at the
top of a script, where `new.target` is not allowed (ECMA-262 2015
section 18.2.1.1).

A function that calls eval now keeps its new.target in the hidden
binding arrow functions already use, also when it was compiled as ES5.1.
A direct eval looks that binding up through the caller's scopes (one
unit of fuel per scope); when it finds one, the eval code may use
`new.target` and reads that value. At the top of a script, in an arrow
function there, and through an indirect eval it stays a SyntaxError.
`super` in eval code is still not supported.

A test in es2015_tests.rs covers plain, strict, arrow, nested-eval and
class-constructor callers and the three SyntaxError cases; it fails
without the change. Follows #9094.
2026-11-28 14:47:16 -08:00
..
2026-11-28 08:00:38 -08:00
…