mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 06:48:31 +02:00
* integrate the functionality to create an address-only procvardef from a
procdef into tprocdef.getcopyas() git-svn-id: branches/hlcgllvm@28474 -
This commit is contained in:
parent
6f01bb56d6
commit
63a3ff3c7f
@ -1992,6 +1992,7 @@ implementation
|
|||||||
function ttypeconvnode.typecheck_proc_to_procvar : tnode;
|
function ttypeconvnode.typecheck_proc_to_procvar : tnode;
|
||||||
var
|
var
|
||||||
pd : tabstractprocdef;
|
pd : tabstractprocdef;
|
||||||
|
copytype : tproccopytyp;
|
||||||
begin
|
begin
|
||||||
result:=nil;
|
result:=nil;
|
||||||
pd:=tabstractprocdef(left.resultdef);
|
pd:=tabstractprocdef(left.resultdef);
|
||||||
@ -2005,15 +2006,17 @@ implementation
|
|||||||
resultdef:=totypedef
|
resultdef:=totypedef
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
resultdef:=pd.getcopyas(procvardef,pc_normal);
|
|
||||||
{ only need the address of the method? this is needed
|
{ only need the address of the method? this is needed
|
||||||
for @tobject.create. In this case there will be a loadn without
|
for @tobject.create. In this case there will be a loadn without
|
||||||
a methodpointer. }
|
a methodpointer. }
|
||||||
if (left.nodetype=loadn) and
|
if (left.nodetype=loadn) and
|
||||||
not assigned(tloadnode(left).left) and
|
not assigned(tloadnode(left).left) and
|
||||||
(not(m_nested_procvars in current_settings.modeswitches) or
|
(not(m_nested_procvars in current_settings.modeswitches) or
|
||||||
not is_nested_pd(tprocvardef(resultdef))) then
|
not is_nested_pd(tabstractprocdef(tloadnode(left).resultdef))) then
|
||||||
include(tprocvardef(resultdef).procoptions,po_addressonly);
|
copytype:=pc_address_only
|
||||||
|
else
|
||||||
|
copytype:=pc_normal;
|
||||||
|
resultdef:=pd.getcopyas(procvardef,copytype);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -546,7 +546,10 @@ interface
|
|||||||
tproccopytyp = (pc_normal,
|
tproccopytyp = (pc_normal,
|
||||||
{ always creates a top-level function, removes all
|
{ always creates a top-level function, removes all
|
||||||
special parameters (self, vmt, parentfp, ...) }
|
special parameters (self, vmt, parentfp, ...) }
|
||||||
pc_bareproc
|
pc_bareproc,
|
||||||
|
{ creates a procvardef describing only the code pointer
|
||||||
|
of a method/netsted function/... }
|
||||||
|
pc_address_only
|
||||||
);
|
);
|
||||||
|
|
||||||
tabstractprocdef = class(tstoreddef)
|
tabstractprocdef = class(tstoreddef)
|
||||||
@ -4554,6 +4557,9 @@ implementation
|
|||||||
tabstractprocdef(result).procoptions:=tabstractprocdef(result).procoptions*[po_explicitparaloc,po_hascallingconvention,po_varargs,po_iocheck,po_has_importname,po_has_importdll];
|
tabstractprocdef(result).procoptions:=tabstractprocdef(result).procoptions*[po_explicitparaloc,po_hascallingconvention,po_varargs,po_iocheck,po_has_importname,po_has_importdll];
|
||||||
if newtyp=procvardef then
|
if newtyp=procvardef then
|
||||||
tabstractprocdef(result).procoptions:=tabstractprocdef(result).procoptions-[po_has_importname,po_has_importdll];
|
tabstractprocdef(result).procoptions:=tabstractprocdef(result).procoptions-[po_has_importname,po_has_importdll];
|
||||||
|
if copytyp=pc_address_only then
|
||||||
|
include(tabstractprocdef(result).procoptions,po_addressonly);
|
||||||
|
|
||||||
tabstractprocdef(result).callerargareasize:=callerargareasize;
|
tabstractprocdef(result).callerargareasize:=callerargareasize;
|
||||||
tabstractprocdef(result).calleeargareasize:=calleeargareasize;
|
tabstractprocdef(result).calleeargareasize:=calleeargareasize;
|
||||||
tabstractprocdef(result).maxparacount:=maxparacount;
|
tabstractprocdef(result).maxparacount:=maxparacount;
|
||||||
|
Loading…
Reference in New Issue
Block a user