mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 01:48:00 +02:00
* when only a symbol name is provided to generate_specialization_phase1 allow a symbol table to be provided as well
git-svn-id: trunk@48000 -
This commit is contained in:
parent
a65d778f73
commit
e4eed4e259
@ -1520,7 +1520,7 @@ implementation
|
||||
symname:=srsym.RealName
|
||||
else
|
||||
symname:='';
|
||||
spezdef:=generate_specialization_phase1(spezcontext,spezdef,symname);
|
||||
spezdef:=generate_specialization_phase1(spezcontext,spezdef,symname,srsym.owner);
|
||||
case spezdef.typ of
|
||||
errordef:
|
||||
begin
|
||||
@ -2994,7 +2994,7 @@ implementation
|
||||
begin
|
||||
{$push}
|
||||
{$warn 5036 off}
|
||||
hdef:=generate_specialization_phase1(spezcontext,nil,nil,orgstoredpattern,dummypos);
|
||||
hdef:=generate_specialization_phase1(spezcontext,nil,nil,orgstoredpattern,nil,dummypos);
|
||||
{$pop}
|
||||
if hdef=generrordef then
|
||||
begin
|
||||
@ -4269,7 +4269,7 @@ implementation
|
||||
end;
|
||||
|
||||
if assigned(parseddef) and assigned(gensym) and assigned(p2) then
|
||||
gendef:=generate_specialization_phase1(spezcontext,gendef,parseddef,gensym.realname,p2.fileinfo)
|
||||
gendef:=generate_specialization_phase1(spezcontext,gendef,parseddef,gensym.realname,gensym.owner,p2.fileinfo)
|
||||
else
|
||||
gendef:=generate_specialization_phase1(spezcontext,gendef);
|
||||
case gendef.typ of
|
||||
|
@ -39,8 +39,8 @@ uses
|
||||
procedure generate_specialization(var tt:tdef;parse_class_parent:boolean;_prettyname:string;parsedtype:tdef;symname:string;parsedpos:tfileposinfo);inline;
|
||||
procedure generate_specialization(var tt:tdef;parse_class_parent:boolean;_prettyname:string);inline;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef):tdef;inline;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;symname:string):tdef;inline;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;parsedtype:tdef;symname:string;parsedpos:tfileposinfo):tdef;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;symname:string;symtable:tsymtable):tdef;inline;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;parsedtype:tdef;symname:string;symtable:tsymtable;parsedpos:tfileposinfo):tdef;
|
||||
function generate_specialization_phase2(context:tspecializationcontext;genericdef:tstoreddef;parse_class_parent:boolean;_prettyname:ansistring):tdef;
|
||||
function check_generic_constraints(genericdef:tstoreddef;paramlist:tfpobjectlist;poslist:tfplist):boolean;
|
||||
function parse_generic_parameters(allowconstraints:boolean):tfphashobjectlist;
|
||||
@ -613,23 +613,23 @@ uses
|
||||
{$push}
|
||||
{$warn 5036 off}
|
||||
begin
|
||||
result:=generate_specialization_phase1(context,genericdef,nil,'',dummypos);
|
||||
result:=generate_specialization_phase1(context,genericdef,nil,'',nil,dummypos);
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;symname:string):tdef;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;symname:string;symtable:tsymtable):tdef;
|
||||
var
|
||||
dummypos : tfileposinfo;
|
||||
{$push}
|
||||
{$warn 5036 off}
|
||||
begin
|
||||
result:=generate_specialization_phase1(context,genericdef,nil,symname,dummypos);
|
||||
result:=generate_specialization_phase1(context,genericdef,nil,symname,symtable,dummypos);
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;parsedtype:tdef;symname:string;parsedpos:tfileposinfo):tdef;
|
||||
function generate_specialization_phase1(out context:tspecializationcontext;genericdef:tdef;parsedtype:tdef;symname:string;symtable:tsymtable;parsedpos:tfileposinfo):tdef;
|
||||
var
|
||||
found,
|
||||
err : boolean;
|
||||
@ -637,6 +637,7 @@ uses
|
||||
gencount : longint;
|
||||
countstr,genname,ugenname : string;
|
||||
tmpstack : tfpobjectlist;
|
||||
symowner : tsymtable;
|
||||
begin
|
||||
context:=nil;
|
||||
result:=nil;
|
||||
@ -741,12 +742,17 @@ uses
|
||||
|
||||
context.genname:=genname;
|
||||
|
||||
if assigned(genericdef) and (genericdef.owner.symtabletype in [objectsymtable,recordsymtable]) then
|
||||
if assigned(genericdef) then
|
||||
symowner:=genericdef.owner
|
||||
else
|
||||
symowner:=symtable;
|
||||
|
||||
if assigned(symowner) and (symowner.symtabletype in [objectsymtable,recordsymtable]) then
|
||||
begin
|
||||
if genericdef.owner.symtabletype = objectsymtable then
|
||||
found:=searchsym_in_class(tobjectdef(genericdef.owner.defowner),tobjectdef(genericdef.owner.defowner),ugenname,context.sym,context.symtable,[])
|
||||
if symowner.symtabletype = objectsymtable then
|
||||
found:=searchsym_in_class(tobjectdef(symowner.defowner),tobjectdef(symowner.defowner),ugenname,context.sym,context.symtable,[])
|
||||
else
|
||||
found:=searchsym_in_record(tabstractrecorddef(genericdef.owner.defowner),ugenname,context.sym,context.symtable);
|
||||
found:=searchsym_in_record(tabstractrecorddef(symowner.defowner),ugenname,context.sym,context.symtable);
|
||||
if not found then
|
||||
found:=searchsym(ugenname,context.sym,context.symtable);
|
||||
end
|
||||
@ -1350,7 +1356,7 @@ uses
|
||||
context : tspecializationcontext;
|
||||
genericdef : tstoreddef;
|
||||
begin
|
||||
genericdef:=tstoreddef(generate_specialization_phase1(context,tt,parsedtype,symname,parsedpos));
|
||||
genericdef:=tstoreddef(generate_specialization_phase1(context,tt,parsedtype,symname,nil,parsedpos));
|
||||
if genericdef<>generrordef then
|
||||
genericdef:=tstoreddef(generate_specialization_phase2(context,genericdef,parse_class_parent,_prettyname));
|
||||
tt:=genericdef;
|
||||
|
Loading…
Reference in New Issue
Block a user