The ES2015 subset now runs the tests whose sources the token reader
rejects, 151 more runs, so the evidence line gives 533 of 708 other runs
and lists the forms that the runs that do not parse use.
- Spreading an array checks the room in the result as each element is
read, so a getter that shrinks an array of length 4294967295 gives the
elements it reads. An array no getter reads, and any other object, is
still checked against its length when spread begins.
- Spread counts each element's index name, and each character of a
string, against the heap as it reads them.
- A function with default or rest parameters checks the heap again before
its body's environment and declarations are made, since the parameters'
values may have used the room the call reserved.
- Without the ES2015 option, a function that eval code declares on the
global object closes over the global scope, so it sees the scripts'
`let` and `const` names, as functions of global code do.
- With the ES2015 option, a global `var` whose name the global object
only inherits gets its own property.
- The test262 ES2015 subset runs a test whose source does not tokenize,
so the error counts as a failure instead of a skip.
- A block function whose name a function of an enclosing block declares is
not assigned to the variable of that name.
- A labelled function in a block is made when the block is entered, and the
parser checks it against the `let` and `const` names of its statement list.
- A function standing alone as an `if` branch gets a block of its own.
- Spread reads a `String` object by code point, and reads an array's length
again before each element.
- A `var` or function declared on the global object stops a later `let` or
`const` of its name until its property is deleted, and a `var` the global
object cannot take is a `TypeError` before anything is declared.
- A call keeps its callee, receiver and arguments reachable until its frame
holds them, and global and eval code keep their environment and their heap
charge until their frame is pushed.
- Template objects are released when no code that can run holds their sites,
even when one code has several sites.
- `Realm::set_es2015` during a run applies once the run ends.
- A template piece that spans lines does not let a preprocessor line start
after it on its last line.
With ES2015 scripts, a function declaration was judged by a property the
global object inherits, so a fixed property on Object.prototype stopped
`function name() {}`. The check now reads the global object's own
property, as ECMA-262 2015 section 8.1.1.4.16 does, and declares nothing
when the global object is not extensible and has no property of that
name. Indirect eval code makes the same check for all of its functions
before it declares any of them, and a function declaration never adds a
property to a global object that is not extensible.
A call to a function with a rest parameter built the array of its extra
arguments without reserving room for it, so `f.apply(null, big)` could
push the heap estimate past the limit. The call now counts the rest
array, its binding and one property per extra argument in the room it
reserves before the function's environment is made.
Spreading a concatenated string (`[...s]`, `f(...s)`) flattened it before
any limit was checked, so a script could make the host build the whole
copy before the per-element fuel and heap accounting ran. The spread now
flattens through the same counted helper the string built-ins use, which
ends the run with the heap limit before the copy is made.
A function declared in a block sets the enclosing variable of its name
only when that declaration itself is eligible, so a declaration inside
a let of the same name no longer assigns the variable because another
declaration of that name elsewhere in the body is eligible.
Spread of an object with a length property reads the length with
ToLength, so a negative or NaN length adds no elements instead of
wrapping to a count near 2^32. A function body's environments stay on
the collector's roots while its scope, functions and arguments object
are made.
Global code runs in the realm's lexical scope in either language, so a
function an earlier ES5.1 run, an indirect eval or the Function
constructor made can read a let or const a later .js run declares. With
the ES2015 option, a script whose function cannot replace a property of
the global object throws a TypeError before any of its let or const
names is declared, so a failed run leaves no name uninitialized.
vectorcraft-js gains Options::es2015, which reads and runs these
ECMAScript 2015 forms: let and const with block scope and their
temporal dead zone, a new let binding for each loop iteration,
function declarations scoped to their block (with the Annex B.3.3
variable outside strict mode code), arrow functions, template
literals and tagged templates, default and rest parameters, and
spread in array literals, calls and new. Spread reads arrays,
strings by code point and objects with a length, by index, and
throws a TypeError for anything else until iterators are added.
Eval code outside strict mode code cannot declare a var that clashes
with a let or const around it, or with a parameter inside a default
value. Spread, template objects and the new scopes take fuel and
count against the heap limit, and nested arrows and templates count
against the depth limit.
script.run sets the option for a .js file; eval, Function, #include
files, $.evalFile and a kept #targetengine read code the way the
running script does. A .jsx file and a source string stay ES5.1.
The test262 runner gains an ES2015 subset run, read without and with
the option. docs/mcp.md and docs/target-app-parity.md describe the
new forms.