maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
727 stars 58 forks source link

Bug - weird deviation from CoffeeScript: 'doSomthing()' and 'doSomthing ()' are very different #119

Open gdennie opened 10 years ago

gdennie commented 10 years ago

In the following snippet, a space between the '$http' and open parenthesis, '(', dramatically alters the translation. Importantly, this same issue does not occur in CoffeeScript. I believe this is a significant bug in part because it is so slight:

angular.module "contactsApp.service", [], ($provide) ->
    $provide.factory "ContactsService", 
       ["$http", "$location", ($http, $location) -> 
         contacts = []
         return {
          addItem : (item) ->
            contacts.push item
            $http(        #<--- BUG!!  '$http (' compiles to somethingelse
                url: "/api/contacts"
                method: "POST"
                data: JSON.stringify item
                )
            .success ->
                toastr.success "You have  contact!", "Success!"
                $location.path "/"
            }
       ]