tc39 / proposal-bind-operator

This-Binding Syntax for ECMAScript
1.75k stars 30 forks source link

Allow super references in unary bind expressions #21

Closed zenparsing closed 8 years ago

zenparsing commented 9 years ago

We currently throw a runtime error if the operand is a super reference. We can probably remove this restriction though, as it seems pretty clear what the semantics would be. Given something like:

class C extends B {
    foo() {
        let fn = ::super.foo;
    }
}

The function fn would be B.prototype.foo bound to the current this value.

bergus commented 9 years ago

+1 for this. If not, is it possible to make this a compile time error?

zenparsing commented 8 years ago

Leaving it a syntax error for now.

bergus commented 8 years ago

Can we re-open this please? It seems to be a rather trivial and maybe unimportant change, but one that should definitely be made.

zenparsing commented 8 years ago

Just added support in 0533fdae49940be8fed3407bb6d7852ee0f53de9 . Good?

Thanks for bringing this back up.

bergus commented 8 years ago

LGTM after a quick glance. Thanks!