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

Getters and setters with computed names emit invalid code #69

Open
adrianheine opened this issue Dec 7, 2017 · 5 comments
Open

Getters and setters with computed names emit invalid code #69

adrianheine opened this issue Dec 7, 2017 · 5 comments
Labels

Comments

@adrianheine
Copy link
Member

obj = {
  get [x] () { return 1 },
  set [x] (value) { valueSet = value }
};

emits

obj = {};
objget [x] = () { return 1 };
objset [x] = (value) { valueSet = value };
@adrianheine adrianheine added the bug label Dec 7, 2017
@adrianheine
Copy link
Member Author

See also #20 about getters and setters in general.

@nathancahill
Copy link
Collaborator

I think the only way to support this concisely is by using Object.defineProperty which isn't supported in IE8.

@nathancahill
Copy link
Collaborator

Would still be better than invalid code.

@adrianheine
Copy link
Member Author

We could just bail if target is IE8 and we try to transpile getters or setters.

@adrianheine
Copy link
Member Author

Note that in class bodies computed getters and setters throw an error, and I implemented my last suggestion in 9d0e728.

@adrianheine adrianheine pinned this issue Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants