* better error message for unresolved forward types

This commit is contained in:
peter 1998-10-02 17:05:58 +00:00
parent e2badc5910
commit c5039c8527
3 changed files with 32 additions and 22 deletions

View File

@ -192,7 +192,7 @@ type tmsgconst=(
sym_e_forward_not_resolved,
sym_f_id_already_typed,
sym_e_error_in_type_def,
sym_e_type_id_not_defined,
sym_e_forward_type_not_resolved,
sym_e_only_static_in_static,
sym_e_invalid_call_tvarsymmangledname,
sym_f_type_must_be_rec_or_class,

View File

@ -196,10 +196,10 @@ const msgtxt : array[0..00088,1..240] of char=(+
'F_Internal Error in SymTableStack()'#000+
'E_Duplicate identifier $1'#000+
'E_Unknown identifier $1'#000+
'E_Forward declaration not solved: $1'#000+
'E_Forward declaration not solved $1'#000+
'F_Identifier type already defined as type'#000+
'E_Error in type defeni','tion'#000+
'E_Type identifier not defined'#000+
'E_Error in type definit','ion'#000+
'E_Forward type not resolved $1'#000+
'E_Only static variables can be used in static methods or outside metho'+
'ds'#000+
'E_Invalid call to tvarsym.mangledname()'#000+

View File

@ -1462,31 +1462,38 @@ unit pdecl;
record_dec:=new(precdef,init(symtable));
end;
{ search in symtablestack used, but not defined type }
procedure testforward_types(p : psym);{$ifndef FPC}far;{$endif}
var
recsymtable : psymtable;
recsymtable : psymtable;
oldaktfilepos : tfileposinfo;
begin
if (p^.typ=typesym) then
if not(p^.typ=typesym) then
exit;
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;
oldaktfilepos:=aktfilepos;
aktfilepos:=p^.fileinfo;
Message1(sym_e_forward_type_not_resolved,p^.name);
aktfilepos:=oldaktfilepos;
end
else
if (ptypesym(p)^.definition^.deftype in [recorddef,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 }
function read_type(const name : stringid) : pdef;
@ -2041,7 +2048,10 @@ unit pdecl;
end.
{
$Log$
Revision 1.61 1998-10-02 09:23:24 peter
Revision 1.62 1998-10-02 17:06:02 peter
* better error message for unresolved forward types
Revision 1.61 1998/10/02 09:23:24 peter
* fixed error msg with type l=<var>
* block_type bt_const is now set in read_const_dec