codetools: h2p: auto renaming names with pascal keywords

git-svn-id: trunk@14679 -
This commit is contained in:
mattias 2008-03-28 13:17:50 +00:00
parent a202dc6d57
commit d27123529d

View File

@ -2171,9 +2171,16 @@ function TH2PasTool.CreateH2PNode(var PascalName: string; const CName: string;
const PascalCode: string;
ParentNode: TH2PNode; IsGlobal: boolean; InsertAsPreLast: boolean): TH2PNode;
begin
if (PascalName<>'') and IsGlobal and (PascalDesc<>ctnNone)
and IsValidIdent(PascalName) then
PascalName:=CreateUniquePascalName(PascalName);
if (PascalName<>'') and (PascalDesc<>ctnNone) and IsValidIdent(PascalName)
then begin
if WordIsKeyWord.DoItCaseInsensitive(PChar(PascalName)) then begin
// C name is keyword => auto rename
PascalName:=PascalName+'_';
end;
if IsGlobal then
PascalName:=CreateUniquePascalName(PascalName);
end;
Result:=TH2PNode.Create;
Result.PascalName:=PascalName;
Result.CName:=CName;