* fix type parsing in records

This commit is contained in:
peter 2003-10-02 15:12:07 +00:00
parent fcde2c3ffa
commit 3b771392a1

View File

@ -133,6 +133,7 @@ implementation
pt : tnode; pt : tnode;
vs,vs2 : tvarsym; vs,vs2 : tvarsym;
srsym : tsym; srsym : tsym;
oldsymtablestack,
srsymtable : tsymtable; srsymtable : tsymtable;
unionsymtable : trecordsymtable; unionsymtable : trecordsymtable;
offset : longint; offset : longint;
@ -179,6 +180,16 @@ implementation
{ this is needed for Delphi mode at least { this is needed for Delphi mode at least
but should be OK for all modes !! (PM) } but should be OK for all modes !! (PM) }
ignore_equal:=true; ignore_equal:=true;
if is_record or is_object then
begin
{ for records, don't search the recordsymtable for
the symbols of the types }
oldsymtablestack:=symtablestack;
symtablestack:=symtablestack.next;
read_type(tt,'');
symtablestack:=oldsymtablestack;
end
else
read_type(tt,''); read_type(tt,'');
{ types that use init/final are not allowed in variant parts, but { types that use init/final are not allowed in variant parts, but
classes are allowed } classes are allowed }
@ -495,7 +506,12 @@ implementation
{ may be only a type: } { may be only a type: }
if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then
begin begin
{ for records, don't search the recordsymtable for
the symbols of the types }
oldsymtablestack:=symtablestack;
symtablestack:=symtablestack.next;
read_type(casetype,''); read_type(casetype,'');
symtablestack:=oldsymtablestack;
end end
else else
begin begin
@ -503,7 +519,10 @@ implementation
consume(_COLON); consume(_COLON);
{ for records, don't search the recordsymtable for { for records, don't search the recordsymtable for
the symbols of the types } the symbols of the types }
oldsymtablestack:=symtablestack;
symtablestack:=symtablestack.next;
read_type(casetype,''); read_type(casetype,'');
symtablestack:=oldsymtablestack;
vs:=tvarsym.create(sorg,vs_value,casetype); vs:=tvarsym.create(sorg,vs_value,casetype);
tabstractrecordsymtable(symtablestack).insertfield(vs,true); tabstractrecordsymtable(symtablestack).insertfield(vs,true);
end; end;
@ -598,7 +617,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.52 2003-10-01 19:05:33 peter Revision 1.53 2003-10-02 15:12:07 peter
* fix type parsing in records
Revision 1.52 2003/10/01 19:05:33 peter
* searchsym_type to search for type definitions. It ignores * searchsym_type to search for type definitions. It ignores
records,objects and parameters records,objects and parameters