termi / es6-transpiler

Tomorrow's JavaScript syntax today
Other
216 stars 18 forks source link

super method in subclass methods breaks? #44

Closed vectorsize closed 10 years ago

vectorsize commented 10 years ago

When using the super() method inside a subclass' method it's not being transpiled.
The super() inside a constructor works like a charm though. for example here:

class Parent {
  constructor(){}
  add(){}
}

class Child extends Parent {
  constructor() {
    super();
  }

  add() {
    super();
  }
}

The constructor's super is properly transpiled to:

function Child() {
  super$0.call(this);
}

whereas the super inside add is kept as is:

Child.prototype.add = function() {
  super();
}

Did I misunderstand something? is super not supposed to be used in any method?

Thank you. Victor