mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 20:29:16 +02:00
Codetools: Make auto-indent understand trivial classes. Issue #19832, patch from Anton
git-svn-id: trunk@31880 -
This commit is contained in:
parent
c56a916203
commit
8c93353490
@ -153,7 +153,8 @@ type
|
||||
bbtIfBegin, // child of bbtIfThen or bbtIfElse
|
||||
bbtStatement,
|
||||
bbtStatementRoundBracket,
|
||||
bbtStatementEdgedBracket
|
||||
bbtStatementEdgedBracket,
|
||||
bbtProperty // global or class property
|
||||
);
|
||||
TFABBlockTypes = set of TFABBlockType;
|
||||
|
||||
@ -227,7 +228,8 @@ const
|
||||
'bbtIfBegin',
|
||||
'bbtStatement',
|
||||
'bbtStatementRoundBracket',
|
||||
'bbtStatementEdgedBracket'
|
||||
'bbtStatementEdgedBracket',
|
||||
'bbtProperty'
|
||||
);
|
||||
|
||||
type
|
||||
@ -689,13 +691,19 @@ var
|
||||
begin
|
||||
if Stack.TopType<>bbtDefinition then
|
||||
EndIdentifierSectionAndProc;
|
||||
if Stack.TopType in (bbtAllCodeSections+bbtAllProcedures+[bbtNone,bbtDefinition])
|
||||
if Stack.TopType in (bbtAllCodeSections+bbtAllProcedures+[bbtNone,bbtDefinition,bbtClassSection])
|
||||
then begin
|
||||
BeginBlock(Typ);
|
||||
BeginBlock(bbtProcedureHead);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure StartProperty;
|
||||
begin
|
||||
if Stack.TopType in [bbtNone, bbtClassSection] then
|
||||
BeginBlock(bbtProperty);
|
||||
end;
|
||||
|
||||
procedure StartClassSection;
|
||||
begin
|
||||
if (LastAtomStart>0) and (CompareIdentifiers('STRICT',@Src[LastAtomStart])=0)
|
||||
@ -1080,6 +1088,9 @@ begin
|
||||
StartClassSection;
|
||||
'O': // PRO
|
||||
case UpChars[r[3]] of
|
||||
'P': // PROP
|
||||
if (CompareIdentifiers('PROPERTY',r)=0) then
|
||||
StartProperty;
|
||||
'T': // PROT
|
||||
if (CompareIdentifiers('PROTECTED',r)=0) then
|
||||
StartClassSection;
|
||||
@ -1160,7 +1171,7 @@ begin
|
||||
while Stack.TopType in [bbtStatementRoundBracket,bbtStatementEdgedBracket] do
|
||||
EndBlock;
|
||||
case Stack.TopType of
|
||||
bbtUsesSection,bbtDefinition:
|
||||
bbtUsesSection,bbtDefinition,bbtProperty:
|
||||
EndBlock;
|
||||
bbtIfThen,bbtIfElse,bbtStatement,bbtFor,bbtForDo,bbtCaseColon,bbtCaseLabel:
|
||||
begin
|
||||
@ -1177,15 +1188,11 @@ begin
|
||||
EndProcedureHead;
|
||||
bbtClassSection,bbtClass:
|
||||
begin
|
||||
if (LastAtomStart>0)
|
||||
and (LastAtomStart=Stack.Stack[Stack.Top].StartPos) then
|
||||
begin
|
||||
if Stack.TopType=bbtClassSection then
|
||||
EndBlock;
|
||||
if Stack.TopType=bbtClassSection then
|
||||
EndBlock;
|
||||
EndBlock;
|
||||
if Stack.TopType=bbtDefinition then
|
||||
EndBlock;
|
||||
if Stack.TopType=bbtDefinition then
|
||||
EndBlock;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user