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
whitespace_only changes function names #2718
Comments
Could you supply a link to a repro? My attempt failed to reproduce the problem. |
Thanks Brad, I'm sorry I didn't provide enough details. You can see that cbar_log_console becomes cbar_log_console$8
|
Sounds like maybe the Normalize pass is running but the later pass which undoes that renaming is not. |
@nirbd thanks for the repro, but we could use a bit more help. Thanks. |
Thanks @nirbd ! Before: try {
function cbar_log_console(msg){}
} catch (err){
cbar_log_console('cbar error: '+err);
}; After: try{
var cbar_log_console$0 = function(msg){}
} catch(err) {
cbar_log_console("cbar error: "+err)
}; |
@brad4d Thanks for looking at this. Isn't whitespace-only mode supposed to maintain function names even if they're local?
|
normalization always runs and always renames local variables to be uniquely named even in WHITESPACE_ONLY. I don't think we'll change that. It is definitely wrong that the compiler is thinking that the Given how long this issue has lived without an update (my bad) it's clear that this isn't a use case we really deal with much. Code that declares something in the Sorry, but it doesn't seem likely we'll find time to hunt down and kill this bug. |
Hi,
Using the closure-compiler.appspot.com API in WHITESPACE_ONLY mode
functions like function cbar_log_error(msg){
get renamed to: var cbar_log_error$7=function(msg){
Is this a bug? If not how to avoid?
10X
The text was updated successfully, but these errors were encountered: