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

destructing bug with object literals #1509

Closed
joeybaker opened this issue May 12, 2015 · 2 comments
Closed

destructing bug with object literals #1509

joeybaker opened this issue May 12, 2015 · 2 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@joeybaker
Copy link

problem: https://babeljs.io/repl/#?experimental=false&evaluate=true&loose=false&spec=false&code=const%20a%20%3D%20%7Bb%3A%20%7Bc%3A%20Function()%7D%7D%0Aconst%20%7Bc%7D%20%3D%20a.b%0Aconst%20d%20%3D%20%7B%0A%20%20c%20()%20%7B%0A%20%20%20%20console.log(typeof%20c)%20%2F%2F%20should%20be%20function%2C%20is%20undefined%0A%20%20%7D%0A%7D

Input code

const a = {b: {c: Function()}}
const {c} = a.b
const d = {
  c () {
    console.log(typeof c) // should be function, is undefined
  }
}

yields:

"use strict";

var a = { b: { c: Function() } };
var _c = a.b._c; // this should be `c`, not `_c`

var d = {
  c: function c() {
    console.log(typeof _c);
  }
};
// should be function, is undefined
@sebmck
Copy link
Contributor

sebmck commented May 12, 2015

Duplicate of #1458.

@sebmck sebmck closed this as completed May 12, 2015
@joeybaker
Copy link
Author

Ah! Thanks! Sorry for the dupe.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 18, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 18, 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

2 participants