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

?= compilation #1216

Closed
michaelficarra opened this issue Mar 21, 2011 · 5 comments · Fixed by #1353
Closed

?= compilation #1216

michaelficarra opened this issue Mar 21, 2011 · 5 comments · Fixed by #1353
Labels

Comments

@michaelficarra
Copy link
Collaborator

Currently, a=0; a ?= b compiles to

var a;
a = 0;
a != null ? a : a = b;

I propose changing the last line to a != null || (a = b); or if(a == null) a = b; (no preference here) when its value goes unused like this.

@satyr
Copy link
Collaborator

satyr commented Mar 21, 2011

a != null && (a = b);

||?

@michaelficarra
Copy link
Collaborator Author

Yes, ||. Fixed.

@geraldalewis
Copy link
Contributor

Working on this now.

geraldalewis added a commit to geraldalewis/coffee-script that referenced this issue May 10, 2011
geraldalewis added a commit to geraldalewis/coffee-script that referenced this issue May 11, 2011
…mantics while prettying the compiled output
geraldalewis added a commit to geraldalewis/coffee-script that referenced this issue May 11, 2011
@jashkenas
Copy link
Owner

Gerald's new fix for this is merged to master.

@geraldalewis
Copy link
Contributor

Thanks @jashkenas :)

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

Successfully merging a pull request may close this issue.

4 participants