* forward def are not put in record or objects

+ added check for forwards also in record and objects
  * dummy parasymtable for unit initialization removed from
  symtable stack
This commit is contained in:
pierre 1998-09-09 11:50:52 +00:00
parent 718de16a58
commit 06104cdb46
3 changed files with 60 additions and 13 deletions

View File

@ -991,6 +991,7 @@ unit pdecl;
oldprocsym : Pprocsym;
oldparse_only : boolean;
classnamelabel : plabel;
storetypeforwardsallowed : boolean;
begin
{Nowadays aktprocsym may already have a value, so we need to save
@ -1008,6 +1009,10 @@ unit pdecl;
(symtablestack^.symtabletype<>staticsymtable) then
Message(parser_e_no_local_objects);
storetypeforwardsallowed:=typecanbeforward;
if cs_tp_compatible in aktmoduleswitches then
typecanbeforward:=false;
{ distinguish classes and objects }
if token=_OBJECT then
begin
@ -1345,6 +1350,7 @@ unit pdecl;
end;
testcurobject:=0;
curobjectname:='';
typecanbeforward:=storetypeforwardsallowed;
if (cs_smartlink in aktmoduleswitches) then
datasegment^.concat(new(pai_cut,init));
@ -1431,12 +1437,16 @@ unit pdecl;
var
symtable : psymtable;
storetypeforwardsallowed : boolean;
begin
symtable:=new(psymtable,init(recordsymtable));
symtable^.next:=symtablestack;
symtablestack:=symtable;
consume(_RECORD);
storetypeforwardsallowed:=typecanbeforward;
if cs_tp_compatible in aktmoduleswitches then
typecanbeforward:=false;
read_var_decs(true,false);
{ may be scale record size to a size of n*4 ? }
@ -1444,6 +1454,7 @@ unit pdecl;
inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
consume(_END);
typecanbeforward:=storetypeforwardsallowed;
symtablestack:=symtable^.next;
record_dec:=new(precdef,init(symtable));
end;
@ -1451,9 +1462,26 @@ unit pdecl;
{ search in symtablestack used, but not defined type }
procedure testforward_types(p : psym);{$ifndef FPC}far;{$endif}
var
recsymtable : psymtable;
begin
if (p^.typ=typesym) and ((p^.properties and sp_forwarddef)<>0) then
Message(sym_e_type_id_not_defined);
if (p^.typ=typesym) then
if ((p^.properties and sp_forwarddef)<>0) then
Message(sym_e_type_id_not_defined)
else if (ptypesym(p)^.definition^.deftype=recorddef) or
(ptypesym(p)^.definition^.deftype=objectdef) then
begin
if (ptypesym(p)^.definition^.deftype=recorddef) then
recsymtable:=precdef(ptypesym(p)^.definition)^.symtable
else
recsymtable:=pobjectdef(ptypesym(p)^.definition)^.publicsyms;
{$ifdef tp}
recsymtable^.foreach(testforward_types);
{$else}
recsymtable^.foreach(@testforward_types);
{$endif}
end;
end;
{ reads a type definition and returns a pointer to it }
@ -2008,7 +2036,13 @@ unit pdecl;
end.
{
$Log$
Revision 1.52 1998-09-07 23:10:22 florian
Revision 1.53 1998-09-09 11:50:52 pierre
* forward def are not put in record or objects
+ added check for forwards also in record and objects
* dummy parasymtable for unit initialization removed from
symtable stack
Revision 1.52 1998/09/07 23:10:22 florian
* a lot of stuff fixed regarding rtti and publishing of properties,
basics should now work

View File

@ -137,7 +137,7 @@ unit pexpr;
statement_syssym:=genzeronode(continuen);
pd:=voiddef;
end;
in_typeof_x : begin
in_typeof_x : begin
consume(LKLAMMER);
in_args:=true;
p1:=comp_expr(true);
@ -1855,7 +1855,13 @@ unit pexpr;
end.
{
$Log$
Revision 1.48 1998-09-07 22:25:53 peter
Revision 1.49 1998-09-09 11:50:53 pierre
* forward def are not put in record or objects
+ added check for forwards also in record and objects
* dummy parasymtable for unit initialization removed from
symtable stack
Revision 1.48 1998/09/07 22:25:53 peter
* fixed str(boolean,string) which was allowed
* fixed write(' ':<int expression>) only constants where allowed :(

View File

@ -493,6 +493,7 @@ unit pmodules;
names : Tstringcontainer;
p : psymtable;
unitst : punitsymtable;
storedebuglist : paasmoutput;
pu : pused_unit;
i : longint;
s1,s2 : ^string; {Saves stack space}
@ -600,14 +601,8 @@ unit pmodules;
{ ... parse the declarations }
read_interface_declarations;
{ Parse the implementation section }
consume(_IMPLEMENTATION);
current_module^.in_implementation:=true;
parse_only:=false;
{$ifdef GDB}
{ add all used definitions even for implementation}
{ add all used definitions}
if (cs_debuginfo in aktmoduleswitches) then
begin
{ all types }
@ -617,6 +612,12 @@ unit pmodules;
end;
{$endif GDB}
{ Parse the implementation section }
consume(_IMPLEMENTATION);
current_module^.in_implementation:=true;
parse_only:=false;
{ generates static symbol table }
p:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
@ -915,7 +916,13 @@ unit pmodules;
end.
{
$Log$
Revision 1.46 1998-09-03 11:24:01 peter
Revision 1.47 1998-09-09 11:50:55 pierre
* forward def are not put in record or objects
+ added check for forwards also in record and objects
* dummy parasymtable for unit initialization removed from
symtable stack
Revision 1.46 1998/09/03 11:24:01 peter
* moved more inputfile things from tscannerfile to tinputfile
* changed ifdef Sourceline to cs_asm_source