Conditional Compilation With FDT

Conditional compilation in FDT is problematic since FDT tries to identify errors in the code before compilation. This is of course a strength of FDT but since it does not know about compiler arguments the only way to use conditional compilation is by tricking FDT to ignore possible errors by constants caused. This is possible by using the /*FDT_IGNORE*/ keyword.

The compiler arguments for the following example are: -define=CONFIG::Debug,true -define+=CONFIG::Release,false

Normal Solution
The normal solution works with editors like FlexBuilder since it generates its errors based on compilation results. This version works of course also when using a text editor and compiling manually.

function foo: void { 	CONFIG::Debug { 		trace( 'Debug' ); } 	CONFIG::Release { 		trace( 'Release' ); } }

FDT Solution
By using the /*FDT_IGNORE*/ keyword FDT starts to ignore a certain region of code.

/*FDT_IGNORE*/ // ignore code goes here /*FDT_IGNORE*/

This enabled conditional compilation by ignoring the code region where compiler constants are involved.

function foo: void { 	/*FDT_IGNORE*/ CONFIG::Debug { 	/*FDT_IGNORE*/ trace( 'Debug' ); /*FDT_IGNORE*/ } 	CONFIG::Release { 	/*FDT_IGNORE*/ trace( 'Release' ); /*FDT_IGNORE*/ } 	/*FDT_IGNORE*/ }