Skip to content
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

Incorrect parentheses inserted around constructor invocation (coffeescript) #105

Open
davidbau opened this issue Jul 12, 2015 · 1 comment

Comments

@davidbau
Copy link
Member

Parentheses are put in the wrong place near a constructor. This is the weirdest part of the JavaScript (and CoffeeScript) grammar, and we get it wrong.

To repro, enter this file in text mode:

url = 'https://upload.wikimedia.org/wikipedia/commons/2/27/Rainstick.ogg'
new Audio(url).play()
  1. Play it. Hear a nice sound.
  2. Switch to block mode. Click on the (url) parameter and click away.
  3. Notice new (Audio(url)).play(). This means something different.
  4. Try to play it. Get an error message about invoking Audio with out "new".

We should detect the new case and be particularly careful about reparsing.

@davidbau
Copy link
Member Author

Actually a lot of coffeescript parentheses are put incorrectly. For example, dragging "and" into "not" messes things up, etc.

The whole precedence in coffee needs to be revisited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant