mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 19:29:18 +02:00
Small improvements for generate_specializations.
pgenutil.pas, generate_specializations: * use splite_generic_name * use the genericparas list instead of iterating the complete symlist pgenutil.pas, split_generic_name: * leave the loop instead of providing an internal error if the right part is not a number git-svn-id: trunk@25580 -
This commit is contained in:
parent
e8edbd29c0
commit
32beb30129
@ -545,19 +545,10 @@ uses
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{ search for a potential suffix }
|
|
||||||
for i:=length(genname) downto 1 do
|
|
||||||
if genname[i]='$' then
|
|
||||||
begin
|
begin
|
||||||
{ if the part right of the $ is a number we assume that the left
|
split_generic_name(genname,ugenname,gencount);
|
||||||
part is the name of the generic, otherwise we assume that the
|
if genname<>ugenname then
|
||||||
complete name is the name of the generic }
|
genname:=ugenname;
|
||||||
countstr:=copy(genname,i+1,length(genname)-i);
|
|
||||||
gencount:=0;
|
|
||||||
val(countstr,gencount,errval);
|
|
||||||
if errval=0 then
|
|
||||||
genname:=copy(genname,1,i-1);
|
|
||||||
break;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ search a generic with the given count of params }
|
{ search a generic with the given count of params }
|
||||||
@ -630,18 +621,17 @@ uses
|
|||||||
generictypelist:=tfpobjectlist.create(false);
|
generictypelist:=tfpobjectlist.create(false);
|
||||||
|
|
||||||
{ build the list containing the types for the generic params }
|
{ build the list containing the types for the generic params }
|
||||||
gencount:=0;
|
if not assigned(genericdef.genericparas) then
|
||||||
for i:=0 to st.SymList.Count-1 do
|
internalerror(2013092601);
|
||||||
|
if genericdeflist.count<>genericdef.genericparas.count then
|
||||||
|
internalerror(2013092603);
|
||||||
|
for i:=0 to genericdef.genericparas.Count-1 do
|
||||||
begin
|
begin
|
||||||
srsym:=tsym(st.SymList[i]);
|
srsym:=tsym(genericdef.genericparas[i]);
|
||||||
if sp_generic_para in srsym.symoptions then
|
if not (sp_generic_para in srsym.symoptions) then
|
||||||
begin
|
internalerror(2013092602);
|
||||||
if gencount=genericdeflist.Count then
|
generictype:=ttypesym.create(srsym.realname,tdef(genericdeflist[i]));
|
||||||
internalerror(2011042702);
|
|
||||||
generictype:=ttypesym.create(srsym.realname,tdef(genericdeflist[gencount]));
|
|
||||||
generictypelist.add(generictype);
|
generictypelist.add(generictype);
|
||||||
inc(gencount);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Special case if we are referencing the current defined object }
|
{ Special case if we are referencing the current defined object }
|
||||||
@ -1118,7 +1108,7 @@ uses
|
|||||||
countstr:=copy(name,i+1,length(name)-i);
|
countstr:=copy(name,i+1,length(name)-i);
|
||||||
val(countstr,count,code);
|
val(countstr,count,code);
|
||||||
if code<>0 then
|
if code<>0 then
|
||||||
internalerror(2013091605);
|
break;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
nongeneric:=name;
|
nongeneric:=name;
|
||||||
|
Loading…
Reference in New Issue
Block a user