-
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
Renaming causes bug to occur on iOS device #3164
Comments
Created Google internal issue b/120558057 |
This doesn't seem specific to iOS. The code will cause the same error in any environment. It might be a destructuring-related bug in the CoalesceVariableNames pass. |
@EatingW we did not experience any problems with V8 (Node.js/Chrome/Chromium). I don't know the language spec well enough to say whether this construction is legal or not but it is definitely not ideal from my point of view because it's confusing. I don't think the Closure Compiler should repurpose any variable name in scope. I don't think the trade off is worth it. But this is just my opinion. |
Sorry, Yiting's earlier comment was my mistake. This code is valid in the language. You can workaround this by with Here's a smaller repro that fails in Safari v12.0.1 for me on MacOS, but works in other browsers: Could you explain what trade offs of variable name repurposing you're referring to? Just this one bug, or have you run into other issues with the pass? |
Looks like https://bugs.webkit.org/show_bug.cgi?id=182414. |
Great, I'll use this for now. |
I was thinking about the space saving of minification trade off. That while reusing |
I'm implementing a workaround for the Safari bug. Re debugging minified code - I agree that this makes debugging harder. Since it benefits code size it still seems worth having on by default to me. (As long as the source map information is corret.) |
Agreed. |
One more debugging item I forgot about earlier: If you enable |
The following JavaScript
Compiled like this
Results in the following code
This line
Both
appContext
andfetchProjectDetails
was renamed toa
which appears to confuse iOS. The error we get isundefined is not an object (evaluating 'a.import')
. This is a consistent issue across all iOS devices we've been able to test with and I'm wondering whether there's a way to get around this issue without switching toWHITESPACE_ONLY
.The text was updated successfully, but these errors were encountered: