Skip to content

[es6-super-construct] default constructor body for null extends #22

@allenwb

Description

@allenwb

On Jan 9, 2015, at 7:43 AM, Erik Arvidsson wrote:

Happy New Year!

(I don't know which thread is the active thread.)

https://github.com/tc39/ecma262/blob/master/workingdocs/ES6-super-construct%3Dproposal.md

Point 12: If a class definition does not include an explicit constructor definition, it defaults to: constructor(...args) {super(...args)}; if the class has a non-null extends clause. Otherwise it defaults to: constructor() {};.

This is problematic since we have to evaluate the extends expression to know if it is null or not. This means that the default constructor needs to be:

constructor(...args) {
if (%extendsValue !== null) super(...args);
}

where %extendsValue is the result of evaluating the extends expression and it has to be captured for later references.

erik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions