Skip to content

Fat arrow method in namespaced class causes syntax error #2

@vjpr

Description

@vjpr
#app.coffee

class S.Application
  test: =>

Generates:

var S.Application = function() {
  this.test = __bind(this.test, this);
};

and causes the following error:

ERROR - Parse error. missing ; before statement
var S.Application = function() {
       ^

app/assets/javascripts/app.coffee.js:14: ERROR - Parse error. syntax error
  this.test = __bind(this.test, this);
        ^

app/assets/javascripts/app.coffee.js:15: ERROR - Parse error. syntax error
};
 ^

Regular coffeescript generates the following:

S.Application = (function() {

    function Application() {
      this.test = __bind(this.test, this);
    }

}

How would I fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions