You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This compiles to what you'd expect, the statements with 'foo' and 'bar' are both in the function passed to jQuery:
// Generated by CoffeeScript 1.6.3(function(){varjQuery,root;jQuery=require('./jquery-1.10.0.min.js').jQuery;root=typeofexports!=="undefined"&&exports!==null ? exports : this;jQuery(function(){$('body').each(function(){returnconsole.log("foo");});returnconsole.log('bar');});}).call(this);
But if we move the bracket on line seven by one space...
jQuery=require('./jquery-1.10.0.min.js').jQueryroot=exports?thisjQuery->$('body').each-> (
console.log("foo")
) # one extra space to the left of the bracketconsole.log('bar')
... now for some reason, the bracket does not end the function passed to each(), but seems to end the function passed to jQuery() instead. The 'bar' log statement runs somewhere we weren't expecting it to.
// Generated by CoffeeScript 1.6.3(function(){varjQuery,root;jQuery=require('./jquery-1.10.0.min.js').jQuery;root=typeofexports!=="undefined"&&exports!==null ? exports : this;jQuery(function(){return$('body').each(function(){returnconsole.log("foo");});});console.log('bar');}).call(this);
Should this happen? The bracket should either match to the last open bracket (and close each()'s function), or the compiler should report an indentation error.
What's the point of allowing brackets if they don't override whitespacing rules?
The text was updated successfully, but these errors were encountered:
Hello,
I've noticed some strange behaviour in the coffeescript compiler.
This compiles to what you'd expect, the statements with 'foo' and 'bar' are both in the function passed to jQuery:
But if we move the bracket on line seven by one space...
... now for some reason, the bracket does not end the function passed to each(), but seems to end the function passed to jQuery() instead. The 'bar' log statement runs somewhere we weren't expecting it to.
Should this happen? The bracket should either match to the last open bracket (and close each()'s function), or the compiler should report an indentation error.
What's the point of allowing brackets if they don't override whitespacing rules?
The text was updated successfully, but these errors were encountered: