mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
cbc695b831
* Give the notes about `super` and `this` their own section in the docs * 2.0.2 changelog * 2.0.2 release output * Rewrite
595 B
595 B
super
and this
In the constructor of a derived class (a class that extends
another class), this
cannot be used before calling super
:
class B extends A
constructor: -> this # Throws a compiler error
This also means you cannot pass a reference to this
as an argument to super
in the constructor of a derived class:
class B extends A
constructor: (@arg) ->
super @arg # Throws a compiler error
This is a limitation of ES2015 classes. As a workaround, assign to this
after the super
call:
codeFor('breaking_change_super_this')