[Pas2js] Directive {$I %LINE%} - Feature request

warleyalex warleyalex at yahoo.com.br
Thu Jan 25 18:53:01 CET 2018


Special directives that dumps string literal with the relevant information it
would be nice!
i think it's a great solution for debuging and tracing line numbers in the
source code.

WriteLn ('Error in the method ' + {$I %FUNCTION%} + ' on line ' + {$I
%LINE%});

{$I %FUNCTION%} : includes a string literal containing the name of the
function or method where the directive is.  

{$I %FILE%} : includes a string literal containing the current file name
where the directive is.  

{$I %LINE%} : includes a string literal containing the line number where the
directive is.  

{$I %DATE%} : includes a string literal containing the date of compilation
(yyyy-mm-dd).  

{$I %TIME%} : includes a string literal containing the time of compilation
(hh:nn:ss).  




. Instead they insert [current file name] / [current line] at compile time. 

('Error in file ' + {$INCLUDE %FILE%} + ' on line ' + {$INCLUDE %LINE%});

Instead they insert [current file name] / [current line] at compile time. So
you can make something like this: DebugLn ('Error in file ' + {$INCLUDE
%FILE%} + ' on line ' + {$INCLUDE %LINE%});

  Function GetCurrentLineNumber: String;
  begin
    Result := {$I %LINE%};
  end;



--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list