mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-02-19 18:16:35 +01:00
codetools: ComplteBlock: fixed nested proc begin
This commit is contained in:
parent
478a8037e7
commit
c8d7a04afa
@ -7124,7 +7124,10 @@ var
|
||||
case CursorBlock.Typ of
|
||||
btBegin,btAsm:
|
||||
begin
|
||||
if Stack.Top=0 then
|
||||
if (Stack.Top=0)
|
||||
and (StartNode.Desc=ctnBeginBlock)
|
||||
and ((StartNode.Parent=nil)
|
||||
or (StartNode.Parent.Desc in AllSourceTypes+[ctnInterface,ctnImplementation])) then
|
||||
NewCode:='end.'
|
||||
else
|
||||
NewCode:='end'+NewCode;
|
||||
|
||||
@ -40,6 +40,8 @@ type
|
||||
procedure TestCompleteBlock_ProgamBeginMissingEnd;
|
||||
procedure TestCompleteBlockClassStart;
|
||||
procedure TestCompleteBlockBegin;
|
||||
procedure TestCompleteBlockProcBegin; // todo
|
||||
procedure TestCompleteBlock_NestedProcBegin;
|
||||
procedure TestCompleteBlockRepeatMissingUntil;
|
||||
procedure TestCompleteBlockRepeatUntil;
|
||||
procedure TestCompleteBlockCase;
|
||||
@ -280,16 +282,46 @@ begin
|
||||
+' end;'+LineEnding
|
||||
+' writeln;'+LineEnding
|
||||
+'end.');
|
||||
{ Todo: Not implemented yet
|
||||
CompleteBlock('procedure a;'+LineEnding
|
||||
+'begin|'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end.',
|
||||
'procedure a;'+LineEnding
|
||||
+'begin|'+LineEnding
|
||||
+'end;'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end.');}
|
||||
end;
|
||||
|
||||
procedure TTestCodetoolsCompleteBlock.TestCompleteBlockProcBegin;
|
||||
begin
|
||||
exit; // todo
|
||||
|
||||
CompleteBlock(
|
||||
'program '+DefUnitName+';'+LineEnding
|
||||
+'procedure a;'+LineEnding
|
||||
+'begin|'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end.',
|
||||
'program '+DefUnitName+';'+LineEnding
|
||||
+'procedure a;'+LineEnding
|
||||
+'begin|'+LineEnding
|
||||
+'end;'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end.');
|
||||
end;
|
||||
|
||||
procedure TTestCodetoolsCompleteBlock.TestCompleteBlock_NestedProcBegin;
|
||||
begin
|
||||
CompleteBlock(
|
||||
'program '+DefUnitName+';'+LineEnding
|
||||
+'procedure a;'+LineEnding
|
||||
+' procedure Sub;'+LineEnding
|
||||
+' begin|'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end;'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end.',
|
||||
'program '+DefUnitName+';'+LineEnding
|
||||
+'procedure a;'+LineEnding
|
||||
+' procedure Sub;'+LineEnding
|
||||
+' begin|'+LineEnding
|
||||
+' end;'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end;'+LineEnding
|
||||
+'begin'+LineEnding
|
||||
+'end.');
|
||||
end;
|
||||
|
||||
procedure TTestCodetoolsCompleteBlock.TestCompleteBlockRepeatMissingUntil;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user