Removing debug code from inside a function using Closure Compiler simple optimisations
===

I'm looking for a way to strip out debug code from functions so I can add test hooks to closures.  I've read
http://stackoverflow.com/questions/4167519/google-closure-compiler-advanced-remove-code-blocks-at-compile-time and tested out removing debug code with the following:

    /** @define {boolean} */
    var DEBUG = true;
    
    if (DEBUG) {
        console.log('remove me');
    }

Simple optimisation with `--define='DEBUG=false'` reduces this to `var DEBUG=!1;`.  The same applies for this:


    /** @const */
    var DEBUG = false;
    
    if (DEBUG) {
        console.log('remove me');
    }

Where I run into trouble is using this convention inside a function:

    /** @const */
    var DEBUG = false;
    
    function logMe() {
        if (DEBUG) {
            console.log('remove me');
        }
    }

This reduces to the following:

    var DEBUG=!1;function logMe(){DEBUG&&console.log("remove me")};

I would expect it to reduce further to:

    var DEBUG=!1;function logMe(){};

Is there a reason this is not working as expected?  I'm really just looking for a clean way to strip debug code and am not ready to take the plunge into advanced optimizations.