views:

284

answers:

3

When using the Google closure compiler to try and compile a load of closure dependencies taken from their editor demo (no external code) using calcdeps.py I get the following error when then running the compiler on the produced code (which runs fine):

 {SyntheticVarsDeclar}: ERROR - Variable COMPILED first declared in {SyntheticVarsDeclar}

The variable COMPILED is only used in 2 places within the file that calculated dependencies produces and isn't declared anywhere in there. The only place I see it declared is in base.js.

A: 

Try declaring it at the start and use this tag like this:

/**
* @define {boolean} Overridden to true by the compiler when --closure_pass
*                   or --mark_as_compiled is specified.
*/
var COMPILED = false;

I'm almost sure that it will fix the problem, in fact I even think that you don't need the tag. Also try downloading latest compiler or compile it from svn because there was suspiciously similar bug reported earlier and it got fixed.

Maiku Mori
A: 

This used to be a bug in the closure compiler. Apparently it has already been fixed. You should download a current version of the closure compiler.

There is a closed bug report for this issue in the closure-compiler issue tracker.

Fabian Jakobs
A: 

I still get this problem with my js; for example with variable $ and setInterval (the $ is from JQuery). If I declare var $,setInterval; it does compile but, of course, does not run as they should not be declared in my source. It compiles cleanly on the web base compiler.

John Fisher