olegam
olegam

Reputation: 95

Why do I get syntax error trying to call super?

I have a Coffeescript class and a subclass. From the subclass constructor i want to call the super implementation. I do like this:

class MyTestAbstract
  constructor: ->
    @created_at = new Date()

class MyTestConcrete extends MyTestAbstract
  constructor: ->
    super

But I get the following syntax error:

/usr/local/lib/node_modules/coffee-script-redux/bin/coffee --source-map -i test_class.coffee
Syntax error on line 7, column 10: unexpected '\n' (\u000A)
4 : 
5 : class MyTestConcrete extends MyTestAbstract
6 :   constructor: ->
7 :     super
^ :~~~~~~~~~^
8 : 

What is wrong here?

UPDATE: Seems to be CoffeeScriptRedux issue. I have created an issue on github: https://github.com/michaelficarra/CoffeeScriptRedux/issues/244

Upvotes: 0

Views: 183

Answers (2)

Ven
Ven

Reputation: 19040

super is not implemented in redux yet.

See the Progress Wiki Page.

Upvotes: 2

TheHippo
TheHippo

Reputation: 63139

You code works fine with the newest coffeescript compiler.

Have you tried making it a explicit call?

class MyTestConcrete extends MyTestAbstract
  constructor: ->
    super()

Is it possible the line after the super call contains white spaces?

Upvotes: 0

Related Questions