TatScriptRefactor.DeclareRoutine Method
Overloads
TatScriptRefactor.DeclareRoutine(string)
Declares a routine named ProcName in the script source and returns the line number of the first statement.
Remarks
Declare a routine named ProcName in source code, and return the line number of the declared routine. The line number returned is not the line where the routine is declared, but the line with the first statement. For example, in pascal, it returns the line after the "begin" of the procedure.
Syntax
Unit: atScript
function TatScriptRefactor.DeclareRoutine(ProcName: string): Integer; overload;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| ProcName | string |
See also
TatScriptRefactor.DeclareRoutine(TatRoutineInfo)
Declares a routine described by AInfo in the script source and returns the line number of the first statement.
Remarks
Declare a routine in source code, and return the line number of the declared routine. The line number returned is not the line where the routine is declared, but the line with the first statement. For example, in pascal, it returns the line after the "begin" of the procedure. This method uses the AInfo property to retrieve information about the procedure to be declared. Basicaly it uses AInfo.Name as the name of routine to be declared, and also uses AInfo.Variables to declare the parameters. The following code is an exmaple.
AInfo.Name := 'MyRoutine'; AInfo.IsFunction := true; AInfo.ResultTypeDecl := 'string'; With AInfo.Variables.Add do begin VarName := 'MyParameter'; Modifier := moVar; TypeDecl := 'integer'; end; With AInfo.Variables.Add do begin VarName := 'SecondPar'; Modifier := moNone; TypeDecl := 'TObject'; end; ALine := Script.DeclareRoutine(AInfo);
The script below will declare the following routine (in pascal).
function MyRoutine(var MyParameter: integer; SecondPar: TObject): string;
Syntax
Unit: atScript
function TatScriptRefactor.DeclareRoutine(AInfo: TatRoutineInfo): Integer; overload; virtual;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| AInfo | TatRoutineInfo |