archives

« Bugzilla Issues Index

#2201 — 14.1.1, 14.2.1, 14.3.1, 15.2.1, 19.2.1.1: Contains(YieldExpression) restriction no longer needed resp. does no longer apply


14.1.1 Static Semantics: Early Errors
> It is a Syntax Error if FunctionBody Contains YieldExpression is true.

> It is a Syntax Error if FormalParameters Contains YieldExpression is true.

> It is a Syntax Error if BindingElement Contains YieldExpression.


14.2.1 Static Semantics: Early Errors

> It is a Syntax Error if AssignmentExpression Contains YieldExpression.


14.3.1 Static Semantics: Early Errors

> It is a Syntax Error if PropertySetParameterList Contains YieldExpression.


15.2.1 Static Semantics: Early Errors

> It is a Syntax Error if ScriptItemList Contains YieldExpression.


19.2.1.1 Function (p1, p2, … , pn, body)

> If body Contains YieldExpression is true, then throw a SyntaxError exception.


Contains(YieldExpression) is no longer possible with parametrised production rules, so the early error rules can be removed.


Related:
- `function* yield(yield) {}` is currently allowed, correct?
- `function* yield(yield) { function yield(){} }` is also currently allowed, correct?

Assuming the use "containing" or "contained" means applying the static semantic rule `Contains`.


function * (yield) {}
should be illegal because yield is treated as a keyword within within generator functions

let x=function *yield() {};
should also be illegal because it also is essentially a binding of yield within a generator

function *yield() {}
at the top level or nested in another function is valid in non-strict code because it is legal bind yield in those contexts.

function *() {
function *yield() {}
}

is illegal is all modes because yield is a non-bindable keyword in that context.

Fixed (I think) in rev21 editor's draft


fixed in rev21 draft