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

Conditional assignment fails with object literals #2138

Closed
jussiry opened this issue Feb 25, 2012 · 2 comments
Closed

Conditional assignment fails with object literals #2138

jussiry opened this issue Feb 25, 2012 · 2 comments

Comments

@jussiry
Copy link

jussiry commented Feb 25, 2012

foo ?=
  bar: true
  baz: false

compiles quite unexpectedly to:

if (typeof foo === "undefined" || foo === null) {
  foo = {
    bar: true
  };
}
({
  baz: false
});

Adding parenthesis makes it work again, but since normal assignment works also without parenthesis this can easily result in strange errors in code.

@michaelficarra
Copy link
Collaborator

Duplicate of #1961 and #1974, fixed by 62a331a on master. Related: #2135

@jussiry
Copy link
Author

jussiry commented Feb 25, 2012

Quick work, good to hear it's already fixed for next version. :)

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