I am using Google's closure compiler optimization (simple optimization) to reduce the size of some of my JS script files. Whilst this works well I have run into issues with eval statements in some of my functions where replacement of local variables by the compiler wrecks havoc. I could try to recode the offending functions to beat the compiler but that is liable to be painful - and in the long term dangerous since the tricks I use today may well not work tomorrow.
It would be nicer if I could simply mark the bits of code I want the compiler to leave untouched. At present I am contemplating taking all functions that use evals, putting them in a separate file and tagging that file oat the end of the compiler output. However, before I do that I thought it worth asking here - is there a way to tell the compiler to skip optimizations on certain functions. e.g.
// @compilation_level SIMPLE_OPTIMIZATIONS
function test(one,two)
{
}
function testTwo(alpha,beta)
{
}
// @Closure:Skip
function evalFunc(one,two)
{
//eval code here
}
//@Closure:EndSkip
The end result - the code between the Skip, EndSkip sections passes through the compiler without any changes.
I have looked through the documentation but have not found anything that might do just this.