michaelficarra / CoffeeScriptRedux

:sweat: rewrite of the CoffeeScript compiler with proper compiler design principles and a focus on robustness and extensibility
https://michaelficarra.github.com/CoffeeScriptRedux/
BSD 3-Clause "New" or "Revised" License
1.84k stars 110 forks source link

Indented objects cause syntax errors #232

Open malixsys opened 11 years ago

malixsys commented 11 years ago

The following code is valid in coffee-script:

passport.use new LocalStrategy(
  usernameField: "email"
  passwordField: "password"
, (email, password, done) ->
  users = app.DI.get("users")
  users.auth email, password, done
)

Compiles to:

    passport.use(new LocalStrategy({
      usernameField: "email",
      passwordField: "password"
    }, function(email, password, done) {
      var users;
      users = app.DI.get("users");
      return users.auth(email, password, done);
    }));

In Redux:

    Syntax error on line 5, column 5: unexpected ',' (\u002C)
    2 : passport.use new LocalStrategy( 
    3 : usernameField: "email" 
    4 : passwordField: "password" 
    5 : , (email, password, done) -> 
    ^ :~~~~^
    6 : users = app.DI.get("users") 
    7 : users.auth email, password, done 
    8 : )

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/904611-indented-objects-cause-syntax-errors?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).
tiye commented 11 years ago

https://github.com/michaelficarra/CoffeeScriptRedux/issues/83 again. fails when using indentation among arguments.