* enum type declarations assignments can also be of the same enum

type
This commit is contained in:
peter 2001-06-04 11:51:59 +00:00
parent 002c6c3aa4
commit 425d899e9f

View File

@ -367,7 +367,6 @@ implementation
setdefdecl(pt.resulttype) setdefdecl(pt.resulttype)
else else
begin begin
do_resulttypepass(pt);
if (pt.nodetype=rangen) then if (pt.nodetype=rangen) then
begin begin
if (trangenode(pt).left.nodetype=ordconstn) and if (trangenode(pt).left.nodetype=ordconstn) and
@ -423,6 +422,9 @@ implementation
ap.elementtype:=tt2; ap.elementtype:=tt2;
end; end;
var
p : tnode;
enumdupmsg : boolean;
begin begin
tt.reset; tt.reset;
case token of case token of
@ -435,6 +437,7 @@ implementation
consume(_LKLAMMER); consume(_LKLAMMER);
{ allow negativ value_str } { allow negativ value_str }
l:=-1; l:=-1;
enumdupmsg:=false;
aktenumdef:=tenumdef.create; aktenumdef:=tenumdef.create;
repeat repeat
s:=orgpattern; s:=orgpattern;
@ -447,21 +450,31 @@ implementation
consume(_ASSIGNMENT); consume(_ASSIGNMENT);
v:=get_intconst; v:=get_intconst;
{ please leave that a note, allows type save } { please leave that a note, allows type save }
{ declarations in the win32 units ! } { declarations in the win32 units ! }
if v<=l then if (v<=l) and (not enumdupmsg) then
Message(parser_n_duplicate_enum); begin
Message(parser_n_duplicate_enum);
enumdupmsg:=true;
end;
l:=v; l:=v;
end end
else if (m_delphi in aktmodeswitches) and else if (m_delphi in aktmodeswitches) and
(token=_EQUAL) then (token=_EQUAL) then
begin begin
consume(_EQUAL); consume(_EQUAL);
v:=get_intconst; p:=comp_expr(true);
{ please leave that a note, allows type save } if (p.nodetype=ordconstn) then
{ declarations in the win32 units ! } begin
if v<=l then { we expect an integer or an enum of the
Message(parser_n_duplicate_enum); same type }
l:=v; if is_integer(p.resulttype.def) or
is_equal(p.resulttype.def,aktenumdef) then
l:=v
else
Message2(type_e_incompatible_types,p.resulttype.def.typename,s32bittype.def.typename);
end
else
Message(cg_e_illegal_expression)
end end
else else
inc(l); inc(l);
@ -586,7 +599,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.24 2001-06-03 20:16:19 peter Revision 1.25 2001-06-04 11:51:59 peter
* enum type declarations assignments can also be of the same enum
type
Revision 1.24 2001/06/03 20:16:19 peter
* allow int64 in range declaration for new types * allow int64 in range declaration for new types
Revision 1.23 2001/04/13 01:22:13 peter Revision 1.23 2001/04/13 01:22:13 peter