Skip to content

newlines in function arguments or parenthesis enclosed blocks #325

Description

@arkarkark

the following code (bad.coffee) is parsed by the original coffee but not CoffeeScriptRedux

angular.module('App').controller('AppController',
['$location', '$scope', (
  $location,   $scope) ->

  @link = (field) ->
    ("http://example.com" +
     "/" + field)
  @
])

if I modify it to this (good.coffee) it works

angular.module('App').controller('AppController',['$location', '$scope', (  $location,   $scope) ->

  @link = (field) ->
    ("http://example.com" +     "/" + field)
  @
])

I can't tell if this is #119 or #142 related so apologies if it's a dupe.

I installed from npm

$ ./bin/coffee -v
CoffeeScript version 2.0.0-beta8
$ ./bin/coffee -js < ~/mysrc/third_party/bad.coffee
Syntax error on line 1, column 50: unexpected '\n' (\u000A)
1 : angular.module('App').controller('AppController',
^ :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
2 : ['$location', '$scope', (
3 :   $location,   $scope) ->
4 :

and the original CoffeeScript

$ coffee -v
CoffeeScript version 1.7.1
$ coffee -p ~/mysrc/third_party/bad.coffee
(function() {
  angular.module('App').controller('AppController', [
    '$location', '$scope', function($location, $scope) {
      this.link = function(field) {
        return "http://example.com" + "/" + field;
      };
      return this;
    }
  ]);

}).call(this);

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3560984-newlines-in-function-arguments-or-parenthesis-enclosed-blocks?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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