Debugging Closure-compiler Compiled Javascript

前端 未结 3 1642
忘掉有多难
忘掉有多难 2021-01-13 18:19

I have a complex dojo app that works correctly uncompiled, but after compiling with Google\'s Closure Compiler, I get subtle differences in some behaviours.

As it is

3条回答
  •  囚心锁ツ
    2021-01-13 19:15

    With the help of Chad's answer, I found a bug where my working code like so:

    a = [b, b = a][0]; // swap variable values
    

    Was compiled to:

    a = b;
    

    It might be fixed in later versions, because tests with the online Closure compiler app don't demonstrate the same bug. Fixed it by not trying to be clever, and using a 3rd variable to hold the old value while swapping values.

提交回复
热议问题