cody: insert call inherited: fixed commas

git-svn-id: trunk@34215 -
This commit is contained in:
mattias 2011-12-16 00:27:13 +00:00
parent 5f133c313c
commit a5cfbd31e2
2 changed files with 12 additions and 10 deletions

View File

@ -98,9 +98,9 @@ begin
crsInsertFileAtCursor,nil,nil,InsertFileAtCursorCommand);
// add call inherited
InsertCallInheritedCommand:=RegisterIDECommand(CmdCatCodeTools, 'AddCallInherited',
InsertCallInheritedCommand:=RegisterIDECommand(CmdCatCodeTools, 'InsertCallInherited',
crsInsertCallInherited,
CleanIDEShortCut,CleanIDEShortCut,nil,@AddCallInherited);
CleanIDEShortCut,CleanIDEShortCut,nil,@InsertCallInherited);
RegisterIDEMenuCommand(SrcEditSubMenuSource, 'SrcEditAddCallInherited',
crsInsertCallInherited, nil, nil, InsertCallInheritedCommand);
RegisterIDEMenuCommand(itmSourceInsertions, 'InsertCallInherited',

View File

@ -109,7 +109,7 @@ type
procedure ExplodeAWithBlockCmd(Sender: TObject);
procedure InsertFileAtCursor(Sender: TObject);
procedure AddCallInherited(Sender: TObject);
procedure InsertCallInherited(Sender: TObject);
function ParseTilCursor(out Tool: TCodeTool; out CleanPos: integer;
out Node: TCodeTreeNode; out ErrorHandled: boolean;
@ -197,7 +197,7 @@ begin
end;
end;
procedure AddCallInherited(Sender: TObject);
procedure InsertCallInherited(Sender: TObject);
procedure ErrorNotInMethod;
begin
@ -231,7 +231,7 @@ begin
try
ProcNode:=CursorNode.GetNodeOfType(ctnProcedure);
if not Tool.NodeIsMethodBody(ProcNode) then begin
debugln(['AddCallInherited not in a method body']);
debugln(['InsertCallInherited not in a method body']);
exit;
end;
// search the declaration (the header of the body may be incomplete)
@ -240,8 +240,10 @@ begin
DeclNode:=ProcNode;
Handled:=true;
NewCode:='inherited '+Tool.ExtractProcHead(DeclNode,
[phpWithoutClassName,phpWithParameterNames,phpWithoutParamTypes]);
//debugln(['AddCallInherited NewCode="',NewCode,'"']);
[phpWithoutClassName,phpWithParameterNames,phpWithoutParamTypes,
phpWithoutSemicolon]);
NewCode:=StringReplace(NewCode,';',',',[rfReplaceAll])+';';
//debugln(['InsertCallInherited NewCode="',NewCode,'"']);
NewLine:=true;
Gap:=gtNone;
if Tool.NodeIsFunction(DeclNode) then begin
@ -269,7 +271,7 @@ begin
end;
NewCode:=GetIndentStr(Indent)+NewCode;
CleanPos:=GetLineStartPosition(Tool.Src,CleanPos);
//debugln(['AddCallInherited Indent=',Indent]);
//debugln(['InsertCallInherited Indent=',Indent]);
end;
NewCode:=CodeToolBoss.SourceChangeCache.BeautifyCodeOptions.BeautifyStatement(
@ -277,11 +279,11 @@ begin
CodeToolBoss.SourceChangeCache.MainScanner:=Tool.Scanner;
if not CodeToolBoss.SourceChangeCache.Replace(Gap,Gap,CleanPos,CleanPos,NewCode)
then begin
debugln(['AddCallInherited CodeToolBoss.SourceChangeCache.Replace failed']);
debugln(['InsertCallInherited CodeToolBoss.SourceChangeCache.Replace failed']);
exit;
end;
if not CodeToolBoss.SourceChangeCache.Apply then begin
debugln(['AddCallInherited CodeToolBoss.SourceChangeCache.Apply failed']);
debugln(['InsertCallInherited CodeToolBoss.SourceChangeCache.Apply failed']);
exit;
end;
except