Skip to content

Incorrectly indented return causes unexpected exception (1.6.3) #3063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JofArnold opened this issue Jul 9, 2013 · 9 comments
Closed

Incorrectly indented return causes unexpected exception (1.6.3) #3063

JofArnold opened this issue Jul 9, 2013 · 9 comments

Comments

@JofArnold
Copy link

E.g. (exact copy including prefixed spaces)

  btnHandler: (e) =>
    target =  $(e.target).data().target
    D.router.navByUI(target)
  return

Error message:

Running "coffee:root" (coffee) task
>> Got an unexpected exception from the coffee-script compiler. The original exception was: TypeError: Cannot call method 'push' of undefined

GruntJS with grunt-contrib-coffee (0.7.0) watching .coffee file changes

@vendethiel
Copy link
Collaborator

Can't reproduce neither on coffeescript.org nor on master.
Can you give a bit more information ? Can you double-check grunt-coffee is using 1.6.3 ?

@vendethiel vendethiel reopened this Jul 9, 2013
@JofArnold
Copy link
Author

I can replicate it in any file under the above conditions. (Added grunt-contrib-watch version too in case it helps)

@vendethiel
Copy link
Collaborator

So

Can you double-check grunt-coffee is using 1.6.3 ?

if it's grunt-contrib-coffee, it seems to be 1.6.2

@JofArnold
Copy link
Author

Confirmed.

@vendethiel
Copy link
Collaborator

I'll wait for somebody to be able to reproduce then.

@JofArnold
Copy link
Author

I can confirm I can cause this error without grunt by running the command coffee -o output.js problemfile.coffee

@vendethiel
Copy link
Collaborator

$ git checkout 1.6.3
Note: checking out '1.6.3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 84b8b5c... CoffeeScript 1.6.3

$ mv ../a.coffee a.coffee && cat a.coffee
a =
  btnHandler: (e) =>
    target =  $(e.target).data().target
    D.router.navByUI(target)
  return

$ coffee a.coffee
a.coffee:5:3: error: unexpected TERMINATOR
  return
  ^

@JofArnold
Copy link
Author

Try this:

class D.View.About extends D.View
  constructor: ->
    super
  return

@vendethiel
Copy link
Collaborator

Marked as bug.

marchaefner pushed a commit to marchaefner/coffee-script that referenced this issue Nov 1, 2013
* Break up `Closure` and merge `Closure.wrap` into `Base.compileClosure`
* Construct class closure directly in `Class.compileNode`
* Reuse `isLiteralArguments` in `Range.compileArray`
* Move all helpers to bottom of file
* Add test for jashkenas#3063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants