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

Can't use object-rest-spread in a function #6247

Closed
hzoo opened this issue Sep 14, 2017 · 5 comments
Closed

Can't use object-rest-spread in a function #6247

hzoo opened this issue Sep 14, 2017 · 5 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@hzoo
Copy link
Member

hzoo commented Sep 14, 2017

Original issue submitted by @tolmasky in babel/babylon#724

Here's the REPL example: https://babeljs.io/repl/#?babili=false&browsers=&build=&builtIns=false&code_lz=FAMwrgdgxgLglgewgAgB4AoCUwDewCQAbgIYBOyxyAvMujsgHROkCmAzjMgL7XJsIBbFjAAWcCAHNMAbmBcgA&debug=false&circleciRepo=&evaluate=false&lineWrap=true&presets=es2015%2Creact%2Cstage-0&prettier=false&targets=&version=6.26.0

function x()
{
	var a = ({ ...rest } = something);
}

If you comment out "function x()" it works fine. The actual example from my code was

function *x() { yield { capture:({ ...rest } = s) } }

Input Code

var your => (code) => here;

Babylon/Babel Configuration

plugins:["objectRestSpread"] for parser.
and transform-object-rest-spread.
@tolmasky
Copy link
Contributor

In 6 this seems to happen because of this: https://github.com/babel/babel/blob/6.x/packages/babel-plugin-transform-object-rest-spread/src/index.js#L183

That is false and thus ref is never set, causing undefined to be used into createObjectSpread. Does the REPL use 7-beta? This code looks very different there.

@tolmasky
Copy link
Contributor

I guess its fixed in 7? https://runkit.com/tolmasky/59bac814a0dafb0012fb9954

Would it be possible to backport these changes to the 6 branch or are they 7 reliant? We've got users running into this now, and even after 7 ships we'll probably have to start on 6 for a while.

@jridgewell
Copy link
Member

Yup, fixed in 7.

@tolmasky
Copy link
Contributor

Would it be possible to backport these changes to the 6 branch or are they 7 reliant? We've got users running into this now, and even after 7 ships we'll probably have to start on 6 for a while.

@jridgewell
Copy link
Member

I don't think we're cutting any more 6 releases, mainly because there's not enough of us to fix 6 bugs and work on 7.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

3 participants