lukehoban/es6features

`super` call in object literals

amatiasq opened this issue · 2 comments

I've reading harmony's draft and it looks like super calls on object literals were removed:

Changes from May TC39 Review
    Tentative addition of Class Definitions Syntax [...]
    11.1.5 make super references illegal in method definitions within object literals

It does not match with the enhanced object literals section

I'm wrong? it was changed to legal again?

This was changed in the November meeting, I believe. http://esdiscuss.org/notes/2013-11-20

Right - I was not at the November meeting, but my understanding from those notes and later discussion was that super is now supported in object literals.

From a quick review, I believe the draft spec is up to date with the decisions from November. Syntactically, super is now allowed as a general expression, but it will throw a ReferenceError when evaluated in any context that does not return true for HasSuperBinding. Many/most environments will not have a super binding, but class methods, and methods or function literal properties of object literals will have a super binding.

The fact that super will be a dynamic error in most locations in ES source text was one of the original reasons I was uncomfortable with allowing it outside of classes. But it sounds like the use cases for object literals won out here.