@debug Directive
Turns the emission of debug symbols on or off.
@set @debug(on | off)
Arguments
on
Default. Keyword that turns debug on.off
Optional. Keyword that turns debug off.
Remarks
Program code that a JScript author writes sometimes differs from the actual code being compiled and run. Host environments, such as ASP.NET, or development tools may generate their own code and add it into the program. This code is generally of no interest to the author during debugging. Consequently, when debugging their code, code authors generally only want to see the parts of the program that they wrote without the parts generated by their development tools. Package authors may want to turn off debugging for similar reasons.
The compiler emits debugging symbols only when compiling from the command line with the /debug option or when compiling an ASP.NET page with the debug flag set in the @page directive. In those circumstances, the debug directive is on by default. When the debug directive appears, it remains in effect until the end of the file is encountered or until the next debug directive is found.
When the debug directive is off, the compiler does not emit debugging information for local variables (variables defined within functions or methods). However, the debug directive does not prevent emission of the debugging information for global variables.
Example
The following code emits debug symbols for the local variable debugOnVar, but not for debugOffVar, when compiled from the command line with the /debug option:
function debugDemo() {
// Turn debugging information off for debugOffVar.
@set @debug(off)
var debugOffVar = 42;
// Turn debugging information on.
@set @debug(on)
// debugOnVar has debugging information.
var debugOnVar = 10;
// Launch the debugger.
debugger;
}
// Call the demo.
debugDemo();