Skip to content

Confuses default values in destructuring assignment #502

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

Closed
FuzzOli87 opened this issue Jun 20, 2016 · 5 comments
Closed

Confuses default values in destructuring assignment #502

FuzzOli87 opened this issue Jun 20, 2016 · 5 comments
Assignees

Comments

@FuzzOli87
Copy link

FuzzOli87 commented Jun 20, 2016

screenshot_20160620_122522
http://imgur.com/n3f0Tat

As you can see, the second function loses syntax. It confuses the braces in the default assignment "settings" for closing braces.

It's weird that the top function also has destructuring but it does not flake out.

@amadeus
Copy link
Collaborator

amadeus commented Jun 20, 2016

Can you paste that snippet as a code block and I can look into it? Also, is this on master or develop branch?

@FuzzOli87
Copy link
Author

@amadeus This is definitely master.

function createJobMetaLog(options, prefix = '') {
  const { meta: { processor: { name, version } = {} } = {} } = options;

  return `${prefix} ${name} v.${version}`;
}

function settingsHandler(options = {}) {
  const { settings = {} } = options;

  return {
    getSetting(setting) {
      return settings[setting];
    }
  };
}

HOWEVER!

I just tried the 'develop' branch on my .nvimrc and the syntax error is resolved. So, fix for this seems to be coming down the pipeline.

image

@amadeus
Copy link
Collaborator

amadeus commented Jun 20, 2016

Awesome, good to hear. Yeah, I just refactored how we handle destructuring, so glad to hear it's fixed.

@amadeus
Copy link
Collaborator

amadeus commented Jun 20, 2016

Your example was actually super helpful though, I've found another destructuring case that I didn't handle from before, so thanks for that! I'll get a PR together to improve develop further.

@amadeus amadeus mentioned this issue Jun 20, 2016
@amadeus
Copy link
Collaborator

amadeus commented Jun 20, 2016

Closing this as the issue that you found without realizing it, is now a PR for develop. Thanks again!

@amadeus amadeus closed this as completed Jun 20, 2016
@amadeus amadeus self-assigned this Jun 20, 2016
amadeus added a commit that referenced this issue Jun 21, 2016
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

2 participants