|
@@ -991,6 +991,7 @@ unit pdecl;
|
|
oldprocsym : Pprocsym;
|
|
oldprocsym : Pprocsym;
|
|
oldparse_only : boolean;
|
|
oldparse_only : boolean;
|
|
classnamelabel : plabel;
|
|
classnamelabel : plabel;
|
|
|
|
+ storetypeforwardsallowed : boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
{Nowadays aktprocsym may already have a value, so we need to save
|
|
{Nowadays aktprocsym may already have a value, so we need to save
|
|
@@ -1008,6 +1009,10 @@ unit pdecl;
|
|
(symtablestack^.symtabletype<>staticsymtable) then
|
|
(symtablestack^.symtabletype<>staticsymtable) then
|
|
Message(parser_e_no_local_objects);
|
|
Message(parser_e_no_local_objects);
|
|
|
|
|
|
|
|
+ storetypeforwardsallowed:=typecanbeforward;
|
|
|
|
+ if cs_tp_compatible in aktmoduleswitches then
|
|
|
|
+ typecanbeforward:=false;
|
|
|
|
+
|
|
{ distinguish classes and objects }
|
|
{ distinguish classes and objects }
|
|
if token=_OBJECT then
|
|
if token=_OBJECT then
|
|
begin
|
|
begin
|
|
@@ -1345,6 +1350,7 @@ unit pdecl;
|
|
end;
|
|
end;
|
|
testcurobject:=0;
|
|
testcurobject:=0;
|
|
curobjectname:='';
|
|
curobjectname:='';
|
|
|
|
+ typecanbeforward:=storetypeforwardsallowed;
|
|
|
|
|
|
if (cs_smartlink in aktmoduleswitches) then
|
|
if (cs_smartlink in aktmoduleswitches) then
|
|
datasegment^.concat(new(pai_cut,init));
|
|
datasegment^.concat(new(pai_cut,init));
|
|
@@ -1431,12 +1437,16 @@ unit pdecl;
|
|
|
|
|
|
var
|
|
var
|
|
symtable : psymtable;
|
|
symtable : psymtable;
|
|
|
|
+ storetypeforwardsallowed : boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
symtable:=new(psymtable,init(recordsymtable));
|
|
symtable:=new(psymtable,init(recordsymtable));
|
|
symtable^.next:=symtablestack;
|
|
symtable^.next:=symtablestack;
|
|
symtablestack:=symtable;
|
|
symtablestack:=symtable;
|
|
consume(_RECORD);
|
|
consume(_RECORD);
|
|
|
|
+ storetypeforwardsallowed:=typecanbeforward;
|
|
|
|
+ if cs_tp_compatible in aktmoduleswitches then
|
|
|
|
+ typecanbeforward:=false;
|
|
read_var_decs(true,false);
|
|
read_var_decs(true,false);
|
|
|
|
|
|
{ may be scale record size to a size of n*4 ? }
|
|
{ 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));
|
|
inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
|
|
|
|
|
|
consume(_END);
|
|
consume(_END);
|
|
|
|
+ typecanbeforward:=storetypeforwardsallowed;
|
|
symtablestack:=symtable^.next;
|
|
symtablestack:=symtable^.next;
|
|
record_dec:=new(precdef,init(symtable));
|
|
record_dec:=new(precdef,init(symtable));
|
|
end;
|
|
end;
|
|
@@ -1451,9 +1462,26 @@ unit pdecl;
|
|
{ search in symtablestack used, but not defined type }
|
|
{ search in symtablestack used, but not defined type }
|
|
procedure testforward_types(p : psym);{$ifndef FPC}far;{$endif}
|
|
procedure testforward_types(p : psym);{$ifndef FPC}far;{$endif}
|
|
|
|
|
|
|
|
+ var
|
|
|
|
+ recsymtable : psymtable;
|
|
|
|
+
|
|
begin
|
|
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;
|
|
end;
|
|
|
|
|
|
{ reads a type definition and returns a pointer to it }
|
|
{ reads a type definition and returns a pointer to it }
|
|
@@ -2008,7 +2036,13 @@ unit pdecl;
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$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,
|
|
* a lot of stuff fixed regarding rtti and publishing of properties,
|
|
basics should now work
|
|
basics should now work
|
|
|
|
|