mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-22 14:19:14 +02:00
codetools: add support for class constructors and class destructors
git-svn-id: trunk@24630 -
This commit is contained in:
parent
5118ed289e
commit
526fcbcc5f
@ -78,7 +78,7 @@ ResourceString
|
||||
ctsEndForRecordNotFound = 'end for record not found';
|
||||
ctsMissingEnumList = 'missing enum list';
|
||||
ctsMissingTypeIdentifier = 'missing type identifier';
|
||||
ctsProcedureOrFunction = 'procedure or function';
|
||||
ctsProcedureOrFunctionOrConstructorOrDestructor = 'procedure or function or constructor or destructor';
|
||||
ctsMethodName = 'method name';
|
||||
ctsIdentifier = 'identifier';
|
||||
ctsSemicolonNotFound = 'semicolon not found';
|
||||
|
@ -1128,12 +1128,14 @@ function TPascalParserTool.KeyWordFuncClassClass: boolean;
|
||||
{ parse
|
||||
class procedure
|
||||
class property
|
||||
class constructor
|
||||
class destructor
|
||||
class var
|
||||
class type
|
||||
}
|
||||
begin
|
||||
ReadNextAtom;
|
||||
if UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION') then begin
|
||||
if UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION') or UpAtomIs('CONSTRUCTOR') or UpAtomIs('DESTRUCTOR') then begin
|
||||
UndoReadNextAtom;
|
||||
Result:=KeyWordFuncClassMethod;
|
||||
end else if UpAtomIs('PROPERTY') then begin
|
||||
@ -1180,8 +1182,8 @@ begin
|
||||
// read method keyword
|
||||
if UpAtomIs('CLASS') or (UpAtomIs('STATIC')) then begin
|
||||
ReadNextAtom;
|
||||
if (not UpAtomIs('PROCEDURE')) and (not UpAtomIs('FUNCTION')) then begin
|
||||
RaiseStringExpectedButAtomFound(ctsProcedureOrFunction);
|
||||
if (not UpAtomIs('PROCEDURE')) and (not UpAtomIs('FUNCTION')) and (not UpAtomIs('CONSTRUCTOR')) and (not UpAtomIs('DESTRUCTOR')) then begin
|
||||
RaiseStringExpectedButAtomFound(ctsProcedureOrFunctionOrConstructorOrDestructor);
|
||||
end;
|
||||
end;
|
||||
IsFunction:=UpAtomIs('FUNCTION');
|
||||
@ -2253,10 +2255,10 @@ begin
|
||||
if not (CurSection in [ctnImplementation]+AllSourceTypes) then
|
||||
RaiseStringExpectedButAtomFound(ctsIdentifier);
|
||||
ReadNextAtom;
|
||||
if UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION') then
|
||||
if UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION') or UpAtomIs('CONSTRUCTOR') or UpAtomIs('DESTRUCTOR') then
|
||||
IsClassProc:=true
|
||||
else
|
||||
RaiseStringExpectedButAtomFound('"procedure"');
|
||||
RaiseStringExpectedButAtomFound(ctsProcedureOrFunctionOrConstructorOrDestructor);
|
||||
end else
|
||||
IsClassProc:=false;
|
||||
ChildCreated:=true;
|
||||
|
Loading…
Reference in New Issue
Block a user