From 2c90d92b2e380bc2fce41beaf32ea3beb111cabd Mon Sep 17 00:00:00 2001 From: skalogryz Date: Fri, 13 Aug 2010 13:40:40 +0000 Subject: [PATCH] chelper: fix enum writting as const for all in once mode git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1282 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/chelper/ctopasconvert.pas | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/chelper/ctopasconvert.pas b/components/chelper/ctopasconvert.pas index 96dfceb03..b8bc83895 100644 --- a/components/chelper/ctopasconvert.pas +++ b/components/chelper/ctopasconvert.pas @@ -451,6 +451,15 @@ begin cnv.wr.Section:=lastsec; if lastsec<>'' then cnv.wr.IncIdent; + //hack, based on knowledge of how enums writting works + if (ent is TEnumType) or ((ent is TTypeDef) and (TTypeDef(ent).origintype is TEnumType)) then + begin + if cfg.EnumsAsConst and (cnv.wr.Section='type') then begin + cnv.wr.DecIdent; + cnv.wr.Section:=''; + end; + end; + cnv.WriteCtoPas(ent, p.Comments, t); lastsec:=cnv.wr.Section;