@position Directive

Provides meaningful position information in error messages.

@set @position(end | [file = fname ;] [line = lnum ;] [column = cnum])

Arguments

  • fname
    Required if file is used. A string literal that represents a filename, with or without drive or path information.

  • lnum
    Required if line is used. Any non-negative integer that represents a line of authored code.

  • cnum
    Required if column is used. Any non-negative integer that represents a column in authored code.

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, 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.

Example

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.

Requirements

Version .NET

See Also

Reference

@set Statement

@debug Directive