-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect DCE of assignment to destructered parameter field with ES_2015 or higher #3499
Comments
Created internal Google issue http://b/143889127 |
const obj = {};
(function() {
const {obj: objLocal} = {obj};
objLocal.baa = "foo";
})();
console.log(obj.baa); becomes with the FOLD_CONSTANTS and COMPUTE_FUNCTION_SIDE_EFFECTS flags: const obj = {};
console.log(obj.baa); For whatever reason the peephole passes think the IIFE is a no-op and are deleting it. |
Any update on this issue? It forces us to introduce Babel into our pipeline to transpile spread operators before passing Closure Compiler. |
Hi, I'm afraid I don't have an update :( This is on our hotlist of issues to prioritize but no one is working on it at the moment. I'll try to take a look this week. |
Thank you! |
Update: I have a fix and am in the process of internal code review. This should be fixed in the next release. |
@lauraharker I just tested my sample code in Did your fix make it into the release? |
@lauraharker it looks like your smaller repro is fixed, but not my original one. |
Sorry about that, I'll reopen this issue. |
Code sample:
Command:
Version:
v20191027
Expected output: (as output by
--language_out ECMASCRIPT5
)Actual output:
It looks like CC is losing the assignment when the target language is
ECMASCRIPT_2015
or higher.The following non-destructered parameter works as expected:
The text was updated successfully, but these errors were encountered: