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

[[]] = f() #1103

Closed
satyr opened this issue Feb 1, 2011 · 8 comments
Closed

[[]] = f() #1103

satyr opened this issue Feb 1, 2011 · 8 comments

Comments

@satyr
Copy link
Collaborator

satyr commented Feb 1, 2011

$ coffee -bpe '[[]] = f()'
false;
@satyr
Copy link
Collaborator Author

satyr commented Feb 1, 2011

Related (?):

$ coffee -bpe 'for k, {} of o then'
var k;
for (k in o) {
  false;
}

@OnesimusUnbound
Copy link

Also this one

[] = 1
{} = [1, 3, 5]
[] = {}

I think is has to do with attempting destructuring assignment.

@satyr
Copy link
Collaborator Author

satyr commented Mar 23, 2011

[] = 1 ...

Those are expected.

$ js -e 'print([] = 1)'
1

$ coffee -e 'console.log [] = 1'
1

@OnesimusUnbound
Copy link

The expression [] = 1 will generate the JavaScript false;

> coffee -bpe "[] = 1"
false;

Using your first example, when the expression [[]] = f() is a parameter of console.log

> coffee -bpe "console.log [[]] = f()"
var _ref;
console.log((_ref = f(), _ref));

Again, the false; statement seems to appear in {} = expr or [] = expr. one - liner.

@satyr
Copy link
Collaborator Author

satyr commented Mar 23, 2011

The expression [] = 1 will generate the JavaScript false;

Oh right. Was assuming those were unaffected from the regression (at 4ce374b); not the case apparently.

@michaelficarra
Copy link
Collaborator

Looks like all the cases in this ticket were fixed by 230dea1 as well. Closing.

@satyr
Copy link
Collaborator Author

satyr commented Apr 9, 2011

230dea1

This effectively reverts #870.
$ bin/coffee -bpe '[a, [], b] = c'
var a, b;
a = c[0], c[1], b = c[2];

@michaelficarra
Copy link
Collaborator

@satyr: Yeah, that optimization is now gone. But it was breaking other things anyway, so it was a bad optimization. I will open #870 so that someone can make a good optimization or just implement the [first, ..., last] syntax.

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

3 participants