Provides meaningful position information in error messages.
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, but it has the potential to cause confusion for the author when errors occur.
Instead of correctly identifying the line of the author's code where an error occurred, the compiler may incorrectly identify an error line that doesn't even exist in the original authored code. This is because the additional generated code has changed the relative position of the author's original code.
In the following example, the line number in a file is changed to accommodate code inserted into the author's code by a JScript host. The line numbers in the left column represent the original source as seen by the user.
01 .. // 10 lines of host-inserted code. .. .. //... 10 .. // End of host-inserted code. 11 .. @set @position(line = 1) 12 01 var i : int = 42; 13 02 var x = ; // Error reported as being on line 2. 14 03 //Remainder of file.