Open arkarkark opened 10 years ago
Your code looks bad for me too. Anyway, if I modify your code just for a bit:
angular.module('App').controller('AppController', [
'$location', '$scope', (
$location, $scope) ->
@link = (field) ->
("http://example.com" +
"/" + field)
@
])
CoffeeScriptRedux compiles it as expected:
// Generated by CoffeeScript 2.0.0-beta8
angular.module('App').controller('AppController', [
'$location',
'$scope',
function ($location, $scope) {
this.link = function (field) {
return 'http://example.com' + '/' + field;
};
return this;
}
]);
indeed, but if it's valid for the original coffee compiler, shouldn't your compiler like it too?
@arkarkark Honestly, I can't understand why vanilla coffee-script acts so "forgiving".
:-D
OK, so why is this invalid?
a(b,
c)
→ Syntax error on line 1, column 5: unexpected '\n' (\u000A)
isn’t the grouping given via parens?
it’s especially of interest for me because coffee-react-transform creates such code:
Car = React.createClass
render: ->
React.createElement(Vehicle, {"doors": (4), "locked": (isLocked()), "data-colour": "red", "on": true},
React.createElement(Parts.FrontSeat, null),
React.createElement(Parts.BackSeat, null),
React.createElement("p", {"className": "seat"}, "Which seat can I take? ", (@props?.seat or 'none'))
)
@flying-sheep
a(b
,c)
# or
a \
b
, c
thanks but:
coffee-react-transform
did, so i have no control over it.
the following code (bad.coffee) is parsed by the original coffee but not CoffeeScriptRedux
if I modify it to this (good.coffee) it works
I can't tell if this is #119 or #142 related so apologies if it's a dupe.
I installed from npm
and the original CoffeeScript