12.1.7.2 Runtime Semantics: Evaluation.
The note in 12.1.7.2 only describes that the GeneratorFunction object is unobservable from ECMAScript code, so an implementation may avoid its allocation, but care must be taken to create the `prototype` object. Actually there's another caveat which may be worthwhile to document:
In addition to the `prototype` object, an implementation must also ensure to create a new variable environment (not only a new lexical environment!) for the generator comprehension. This is currently only implicitly specified due to the use of a GeneratorFunction object to implement the generator comprehension semantics.
Test case:
---
function outer() {
var x = 0;
function inner() {
// The direct eval creates a new var-binding in the variable environment
// of the generator comprehension, not in the variable environment
// of the 'inner' function
var r = (for (x of [0]) (eval("var x = 1"), x)).next().value;
return [x, r];
}
return inner();
}
outer(); // returns [0, 1]
---
fixed in rev25 editor's draft
Added to 12.2.7.2 note as suggested.
Created bug 2853 relating to the legality of that particular eval.
in rev25