mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 05:29:51 +02:00
codetools: parse generic class method
git-svn-id: trunk@57638 -
This commit is contained in:
parent
f029765fd9
commit
aca4d3b81b
@ -203,6 +203,7 @@ type
|
||||
function KeyWordFuncClassClass: boolean;
|
||||
function KeyWordFuncClassFinal: boolean;
|
||||
function KeyWordFuncClassMethod: boolean;
|
||||
function KeyWordFuncClassGenericMember: boolean;
|
||||
function KeyWordFuncClassProperty: boolean;
|
||||
function KeyWordFuncClassIdentifier: boolean;
|
||||
// keyword lists
|
||||
@ -519,6 +520,8 @@ begin
|
||||
'I': if CompareSrcIdentifiers(p,'FINAL') and Scanner.Values.IsDefined('CPUJVM')
|
||||
then exit(KeyWordFuncClassFinal);
|
||||
end;
|
||||
'G':
|
||||
if CompareSrcIdentifiers(p,'GENERIC') then exit(KeyWordFuncClassGenericMember);
|
||||
'P':
|
||||
case UpChars[p[1]] of
|
||||
'R':
|
||||
@ -1374,6 +1377,21 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TPascalParserTool.KeyWordFuncClassGenericMember: boolean;
|
||||
var
|
||||
p: PChar;
|
||||
begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafNone then
|
||||
SaveRaiseStringExpectedButAtomFound(20180410195348,'class');
|
||||
p:=@Src[CurPos.StartPos];
|
||||
case UpChars[p^] of
|
||||
'C':
|
||||
if CompareSrcIdentifiers(p,'CLASS') then exit(KeyWordFuncClassClass);
|
||||
end;
|
||||
SaveRaiseStringExpectedButAtomFound(20180410195349,'class');
|
||||
end;
|
||||
|
||||
function TPascalParserTool.ReadParamList(ExceptionOnError, Extract: boolean;
|
||||
const Attr: TProcHeadAttributes): boolean;
|
||||
{ parse parameter list
|
||||
|
@ -421,6 +421,7 @@ begin
|
||||
' TBird<B> = class(TAnimal<B>)',
|
||||
' procedure DoIt;', // normal proc inside generic class
|
||||
' procedure DoSome<T>;', // generic proc inside generic class
|
||||
' generic class procedure DoGen<P>(i: P);',
|
||||
' end;',
|
||||
'procedure TRec.Proc<T>;', // generic proc inside normal record
|
||||
'begin',
|
||||
@ -431,6 +432,9 @@ begin
|
||||
'procedure TBird<B>.DoSome<T>;', // generic proc inside generic class
|
||||
'begin',
|
||||
'end;',
|
||||
'generic class procedure TBird<B>.DoGen<P>(i: P);',
|
||||
'begin',
|
||||
'end;',
|
||||
'begin']);
|
||||
ParseModule;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user