archives

« Bugzilla Issues Index

#4420 — 14.4.1: missing early error for direct super call in function* definitions


GeneratorDeclaration and GeneratorExpression should not allow a SuperCall of occur in their body or parameters.

Need to add the rules:


It is a Syntax Error if FormalParameters Contains SuperCall is true.

It is a Syntax Error if GeneratorBody Contains SuperCall is true.

to the last rule group in 14.4.1


GeneratorDeclaration and GeneratorExpression already use HasDirectSuper to detect this:

---
14.4.1 Static Semantics: Early Errors

GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
- It is a Syntax Error if HasDirectSuper of GeneratorDeclaration is true.

GeneratorExpression : function * BindingIdentifieropt ( FormalParameters ) { GeneratorBody }
- It is a Syntax Error if HasDirectSuper of GeneratorExpression is true.


14.4.6 Static Semantics: HasDirectSuper

GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
1. If FormalParameters Contains SuperCall is true, return true.
2. Return GeneratorBody Contains SuperCall.
---


Agreed with André. My early error checker was already catching these cases through the early error rules that André lists.


Fixed in ES2016 Draft (cdab871).