jashkenas/coffee-script — Issue #2156: Calling super() inside non-class methods
Author: adambeynon
Created: 2012-02-28 11:00:33+00:00
State: open

It would be nice if the following could work:

```coffee
class Foo
someMethod: ->
'foo'

obj = new Foo
someMethod: ->
super + ' bar'

obj.someMethod()
```

Currently 'someMethod' compiles into:

```javascript
obj = new Foo({
someMethod: function() {
return someMethod.__super__.constructor.apply(this, arguments) + ' bar';
}
});
```

To make the output more generic for functions outside of a class body, compiling `super` to something like the following might work:

```javascript
obj = new Foo({
someMethod: function() {
return this.constructor.prototype.someMethod.apply(this, arguments) + ' bar';
}
});
```