|
@@ -1592,7 +1592,7 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- function handle_specialize_inline_specialization(var srsym:tsym;out srsymtable:tsymtable;out spezcontext:tspecializationcontext):boolean;
|
|
|
|
|
|
+ function handle_specialize_inline_specialization(var srsym:tsym;enforce_unit:boolean;out srsymtable:tsymtable;out spezcontext:tspecializationcontext):boolean;
|
|
var
|
|
var
|
|
spezdef : tdef;
|
|
spezdef : tdef;
|
|
symname : tsymstr;
|
|
symname : tsymstr;
|
|
@@ -1617,7 +1617,7 @@ implementation
|
|
symname:=srsym.RealName
|
|
symname:=srsym.RealName
|
|
else
|
|
else
|
|
symname:='';
|
|
symname:='';
|
|
- spezdef:=generate_specialization_phase1(spezcontext,spezdef,symname,srsym.owner);
|
|
|
|
|
|
+ spezdef:=generate_specialization_phase1(spezcontext,spezdef,enforce_unit,symname,srsym.owner);
|
|
case spezdef.typ of
|
|
case spezdef.typ of
|
|
errordef:
|
|
errordef:
|
|
begin
|
|
begin
|
|
@@ -1721,7 +1721,7 @@ implementation
|
|
if isspecialize then
|
|
if isspecialize then
|
|
begin
|
|
begin
|
|
consume(_ID);
|
|
consume(_ID);
|
|
- if not handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) then
|
|
|
|
|
|
+ if not handle_specialize_inline_specialization(srsym,false,srsymtable,spezcontext) then
|
|
begin
|
|
begin
|
|
result.free;
|
|
result.free;
|
|
result:=cerrornode.create;
|
|
result:=cerrornode.create;
|
|
@@ -1764,7 +1764,7 @@ implementation
|
|
if isspecialize and assigned(srsym) then
|
|
if isspecialize and assigned(srsym) then
|
|
begin
|
|
begin
|
|
consume(_ID);
|
|
consume(_ID);
|
|
- if handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) then
|
|
|
|
|
|
+ if handle_specialize_inline_specialization(srsym,false,srsymtable,spezcontext) then
|
|
erroroutresult:=false;
|
|
erroroutresult:=false;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -1777,7 +1777,7 @@ implementation
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,savedfilepos)
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,savedfilepos)
|
|
else
|
|
else
|
|
- result:=cspecializenode.create(result,getaddr,srsym);
|
|
|
|
|
|
+ result:=cspecializenode.create(result,getaddr,srsym,false);
|
|
erroroutresult:=false;
|
|
erroroutresult:=false;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -2522,7 +2522,7 @@ implementation
|
|
begin
|
|
begin
|
|
searchsym_in_record(structh,pattern,srsym,srsymtable);
|
|
searchsym_in_record(structh,pattern,srsym,srsymtable);
|
|
consume(_ID);
|
|
consume(_ID);
|
|
- if handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) then
|
|
|
|
|
|
+ if handle_specialize_inline_specialization(srsym,false,srsymtable,spezcontext) then
|
|
erroroutp1:=false;
|
|
erroroutp1:=false;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
@@ -2537,7 +2537,7 @@ implementation
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,old_current_filepos)
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,old_current_filepos)
|
|
else
|
|
else
|
|
- p1:=cspecializenode.create(p1,getaddr,srsym);
|
|
|
|
|
|
+ p1:=cspecializenode.create(p1,getaddr,srsym,false);
|
|
erroroutp1:=false;
|
|
erroroutp1:=false;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -2698,7 +2698,7 @@ implementation
|
|
begin
|
|
begin
|
|
searchsym_in_class(tobjectdef(structh),tobjectdef(structh),pattern,srsym,srsymtable,[ssf_search_helper]);
|
|
searchsym_in_class(tobjectdef(structh),tobjectdef(structh),pattern,srsym,srsymtable,[ssf_search_helper]);
|
|
consume(_ID);
|
|
consume(_ID);
|
|
- if handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) then
|
|
|
|
|
|
+ if handle_specialize_inline_specialization(srsym,false,srsymtable,spezcontext) then
|
|
erroroutp1:=false;
|
|
erroroutp1:=false;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
@@ -2713,7 +2713,7 @@ implementation
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,old_current_filepos)
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,old_current_filepos)
|
|
else
|
|
else
|
|
- p1:=cspecializenode.create(p1,getaddr,srsym);
|
|
|
|
|
|
+ p1:=cspecializenode.create(p1,getaddr,srsym,false);
|
|
erroroutp1:=false;
|
|
erroroutp1:=false;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -2752,7 +2752,7 @@ implementation
|
|
begin
|
|
begin
|
|
searchsym_in_class(tobjectdef(structh),tobjectdef(structh),pattern,srsym,srsymtable,[ssf_search_helper]);
|
|
searchsym_in_class(tobjectdef(structh),tobjectdef(structh),pattern,srsym,srsymtable,[ssf_search_helper]);
|
|
consume(_ID);
|
|
consume(_ID);
|
|
- if handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) then
|
|
|
|
|
|
+ if handle_specialize_inline_specialization(srsym,false,srsymtable,spezcontext) then
|
|
erroroutp1:=false;
|
|
erroroutp1:=false;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
@@ -2767,7 +2767,7 @@ implementation
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
not (token in [_LT,_LSHARPBRACKET]) then
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,old_current_filepos)
|
|
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg,old_current_filepos)
|
|
else
|
|
else
|
|
- p1:=cspecializenode.create(p1,getaddr,srsym);
|
|
|
|
|
|
+ p1:=cspecializenode.create(p1,getaddr,srsym,false);
|
|
erroroutp1:=false;
|
|
erroroutp1:=false;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -3052,7 +3052,7 @@ implementation
|
|
begin
|
|
begin
|
|
if block_type in [bt_type,bt_const_type,bt_var_type] then
|
|
if block_type in [bt_type,bt_const_type,bt_var_type] then
|
|
begin
|
|
begin
|
|
- if not handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) or (srsym.typ=procsym) then
|
|
|
|
|
|
+ if not handle_specialize_inline_specialization(srsym,unit_found,srsymtable,spezcontext) or (srsym.typ=procsym) then
|
|
begin
|
|
begin
|
|
spezcontext.free;
|
|
spezcontext.free;
|
|
result:=cerrornode.create;
|
|
result:=cerrornode.create;
|
|
@@ -3071,7 +3071,7 @@ implementation
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- result:=cspecializenode.create(nil,getaddr,srsym)
|
|
|
|
|
|
+ result:=cspecializenode.create(nil,getaddr,srsym,unit_found)
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
@@ -3108,7 +3108,7 @@ implementation
|
|
(sp_generic_dummy in srsym.symoptions) and
|
|
(sp_generic_dummy in srsym.symoptions) and
|
|
(token in [_LT,_LSHARPBRACKET]) then
|
|
(token in [_LT,_LSHARPBRACKET]) then
|
|
begin
|
|
begin
|
|
- result:=cspecializenode.create(nil,getaddr,srsym)
|
|
|
|
|
|
+ result:=cspecializenode.create(nil,getaddr,srsym,unit_found)
|
|
end
|
|
end
|
|
{ check if it's a method/class method }
|
|
{ check if it's a method/class method }
|
|
else if is_member_read(srsym,srsymtable,result,hdef) then
|
|
else if is_member_read(srsym,srsymtable,result,hdef) then
|
|
@@ -3380,9 +3380,11 @@ implementation
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
|
|
+ if not unit_found then
|
|
|
|
+ srsymtable:=nil;
|
|
{$push}
|
|
{$push}
|
|
{$warn 5036 off}
|
|
{$warn 5036 off}
|
|
- hdef:=generate_specialization_phase1(spezcontext,nil,nil,orgstoredpattern,nil,dummypos);
|
|
|
|
|
|
+ hdef:=generate_specialization_phase1(spezcontext,nil,unit_found,nil,orgstoredpattern,srsymtable,dummypos);
|
|
{$pop}
|
|
{$pop}
|
|
if hdef=generrordef then
|
|
if hdef=generrordef then
|
|
begin
|
|
begin
|
|
@@ -3818,7 +3820,7 @@ implementation
|
|
searchsym_in_class(hclassdef,current_structdef,hs,srsym,srsymtable,[ssf_search_helper]);
|
|
searchsym_in_class(hclassdef,current_structdef,hs,srsym,srsymtable,[ssf_search_helper]);
|
|
if isspecialize and assigned(srsym) then
|
|
if isspecialize and assigned(srsym) then
|
|
begin
|
|
begin
|
|
- if not handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) then
|
|
|
|
|
|
+ if not handle_specialize_inline_specialization(srsym,false,srsymtable,spezcontext) then
|
|
srsym:=nil;
|
|
srsym:=nil;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -4406,7 +4408,8 @@ implementation
|
|
function generate_inline_specialization(gendef:tdef;n:tnode;filepos:tfileposinfo;parseddef:tdef;gensym:tsym;p2:tnode):tnode;
|
|
function generate_inline_specialization(gendef:tdef;n:tnode;filepos:tfileposinfo;parseddef:tdef;gensym:tsym;p2:tnode):tnode;
|
|
var
|
|
var
|
|
again,
|
|
again,
|
|
- getaddr : boolean;
|
|
|
|
|
|
+ getaddr,
|
|
|
|
+ unitspecific : boolean;
|
|
pload : tnode;
|
|
pload : tnode;
|
|
spezcontext : tspecializationcontext;
|
|
spezcontext : tspecializationcontext;
|
|
structdef,
|
|
structdef,
|
|
@@ -4418,6 +4421,7 @@ implementation
|
|
getaddr:=tspecializenode(n).getaddr;
|
|
getaddr:=tspecializenode(n).getaddr;
|
|
pload:=tspecializenode(n).left;
|
|
pload:=tspecializenode(n).left;
|
|
inheriteddef:=tabstractrecorddef(tspecializenode(n).inheriteddef);
|
|
inheriteddef:=tabstractrecorddef(tspecializenode(n).inheriteddef);
|
|
|
|
+ unitspecific:=tspecializenode(n).unit_specific;
|
|
tspecializenode(n).left:=nil;
|
|
tspecializenode(n).left:=nil;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -4425,12 +4429,13 @@ implementation
|
|
getaddr:=false;
|
|
getaddr:=false;
|
|
pload:=nil;
|
|
pload:=nil;
|
|
inheriteddef:=nil;
|
|
inheriteddef:=nil;
|
|
|
|
+ unitspecific:=false;
|
|
end;
|
|
end;
|
|
|
|
|
|
if assigned(parseddef) and assigned(gensym) and assigned(p2) then
|
|
if assigned(parseddef) and assigned(gensym) and assigned(p2) then
|
|
- gendef:=generate_specialization_phase1(spezcontext,gendef,parseddef,gensym.realname,gensym.owner,p2.fileinfo)
|
|
|
|
|
|
+ gendef:=generate_specialization_phase1(spezcontext,gendef,unitspecific,parseddef,gensym.realname,gensym.owner,p2.fileinfo)
|
|
else
|
|
else
|
|
- gendef:=generate_specialization_phase1(spezcontext,gendef);
|
|
|
|
|
|
+ gendef:=generate_specialization_phase1(spezcontext,gendef,unitspecific);
|
|
case gendef.typ of
|
|
case gendef.typ of
|
|
errordef:
|
|
errordef:
|
|
begin
|
|
begin
|