From f44c4af73bed20d98ec00794724d503e4e216822 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 3 Jan 2003 23:50:41 +0000 Subject: [PATCH] * also allow = in fpc mode to assign enums --- compiler/ptype.pas | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 8505ee8498..3cc16de5b2 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -472,10 +472,15 @@ implementation defpos:=akttokenpos; consume(_ID); { only allow assigning of specific numbers under fpc mode } - if (m_fpc in aktmodeswitches) and - (token=_ASSIGNMENT) then + if not(m_tp7 in aktmodeswitches) and + ( + { in fpc mode also allow := to be compatible + with previous 1.0.x versions } + ((m_fpc in aktmodeswitches) and + try_to_consume(_ASSIGNMENT)) or + try_to_consume(_EQUAL) + ) then begin - consume(_ASSIGNMENT); p:=comp_expr(true); if (p.nodetype=ordconstn) then begin @@ -500,25 +505,6 @@ implementation end; l:=v; end - else if (m_delphi in aktmodeswitches) and - (token=_EQUAL) then - begin - consume(_EQUAL); - p:=comp_expr(true); - if (p.nodetype=ordconstn) then - begin - { we expect an integer or an enum of the - same type } - if is_integer(p.resulttype.def) or - equal_defs(p.resulttype.def,aktenumdef) then - l:=tordconstnode(p).value - else - Message2(type_e_incompatible_types,p.resulttype.def.typename,s32bittype.def.typename); - end - else - Message(cg_e_illegal_expression); - p.free; - end else inc(l); storepos:=akttokenpos; @@ -643,7 +629,10 @@ implementation end. { $Log$ - Revision 1.48 2003-01-02 19:49:00 peter + Revision 1.49 2003-01-03 23:50:41 peter + * also allow = in fpc mode to assign enums + + Revision 1.48 2003/01/02 19:49:00 peter * update self parameter only for methodpointer and methods Revision 1.47 2002/12/21 13:07:34 peter