mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:49:09 +02:00
* factor() might return a typenode with a errordef, so check for that and don't add the typesymbol to the parameter list in that case; fixes the access violation of tw17181.pp
git-svn-id: trunk@34472 -
This commit is contained in:
parent
9e6077bee2
commit
627e30f47f
@ -345,30 +345,37 @@ uses
|
|||||||
parampos^:=tmpparampos;
|
parampos^:=tmpparampos;
|
||||||
poslist.add(parampos);
|
poslist.add(parampos);
|
||||||
end;
|
end;
|
||||||
genericdeflist.Add(typeparam.resultdef);
|
if typeparam.resultdef.typ<>errordef then
|
||||||
if not assigned(typeparam.resultdef.typesym) then
|
begin
|
||||||
message(type_e_generics_cannot_reference_itself)
|
if not assigned(typeparam.resultdef.typesym) then
|
||||||
|
message(type_e_generics_cannot_reference_itself)
|
||||||
|
else if (typeparam.resultdef.typ<>errordef) then
|
||||||
|
begin
|
||||||
|
genericdeflist.Add(typeparam.resultdef);
|
||||||
|
{ we use the full name of the type to uniquely identify it }
|
||||||
|
if (symtablestack.top.symtabletype=parasymtable) and
|
||||||
|
(symtablestack.top.defowner.typ=procdef) and
|
||||||
|
(typeparam.resultdef.owner=symtablestack.top) then
|
||||||
|
begin
|
||||||
|
{ special handling for specializations inside generic function declarations }
|
||||||
|
namepart:=tdef(symtablestack.top.defowner).unique_id_str;
|
||||||
|
namepart:='genproc'+namepart+'_'+tdef(symtablestack.top.defowner).fullownerhierarchyname+'_'+tprocdef(symtablestack.top.defowner).procsym.realname+'_'+typeparam.resultdef.typename;
|
||||||
|
prettynamepart:=tdef(symtablestack.top.defowner).fullownerhierarchyname+tprocdef(symtablestack.top.defowner).procsym.prettyname;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
namepart:=typeparam.resultdef.fulltypename;
|
||||||
|
prettynamepart:=typeparam.resultdef.fullownerhierarchyname;
|
||||||
|
end;
|
||||||
|
specializename:=specializename+'$'+namepart;
|
||||||
|
if not first then
|
||||||
|
prettyname:=prettyname+',';
|
||||||
|
prettyname:=prettyname+prettynamepart+typeparam.resultdef.typesym.prettyname;
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ we use the full name of the type to uniquely identify it }
|
result:=false;
|
||||||
if (symtablestack.top.symtabletype=parasymtable) and
|
|
||||||
(symtablestack.top.defowner.typ=procdef) and
|
|
||||||
(typeparam.resultdef.owner=symtablestack.top) then
|
|
||||||
begin
|
|
||||||
{ special handling for specializations inside generic function declarations }
|
|
||||||
namepart:=tdef(symtablestack.top.defowner).unique_id_str;
|
|
||||||
namepart:='genproc'+namepart+'_'+tdef(symtablestack.top.defowner).fullownerhierarchyname+'_'+tprocdef(symtablestack.top.defowner).procsym.realname+'_'+typeparam.resultdef.typename;
|
|
||||||
prettynamepart:=tdef(symtablestack.top.defowner).fullownerhierarchyname+tprocdef(symtablestack.top.defowner).procsym.prettyname;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
namepart:=typeparam.resultdef.fulltypename;
|
|
||||||
prettynamepart:=typeparam.resultdef.fullownerhierarchyname;
|
|
||||||
end;
|
|
||||||
specializename:=specializename+'$'+namepart;
|
|
||||||
if not first then
|
|
||||||
prettyname:=prettyname+',';
|
|
||||||
prettyname:=prettyname+prettynamepart+typeparam.resultdef.typesym.prettyname;
|
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user