mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 03:59:28 +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;
|
||||
var
|
||||
pd : tabstractprocdef;
|
||||
copytype : tproccopytyp;
|
||||
begin
|
||||
result:=nil;
|
||||
pd:=tabstractprocdef(left.resultdef);
|
||||
@ -2005,15 +2006,17 @@ implementation
|
||||
resultdef:=totypedef
|
||||
else
|
||||
begin
|
||||
resultdef:=pd.getcopyas(procvardef,pc_normal);
|
||||
{ only need the address of the method? this is needed
|
||||
for @tobject.create. In this case there will be a loadn without
|
||||
a methodpointer. }
|
||||
if (left.nodetype=loadn) and
|
||||
not assigned(tloadnode(left).left) and
|
||||
(not(m_nested_procvars in current_settings.modeswitches) or
|
||||
not is_nested_pd(tprocvardef(resultdef))) then
|
||||
include(tprocvardef(resultdef).procoptions,po_addressonly);
|
||||
not is_nested_pd(tabstractprocdef(tloadnode(left).resultdef))) then
|
||||
copytype:=pc_address_only
|
||||
else
|
||||
copytype:=pc_normal;
|
||||
resultdef:=pd.getcopyas(procvardef,copytype);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -546,7 +546,10 @@ interface
|
||||
tproccopytyp = (pc_normal,
|
||||
{ always creates a top-level function, removes all
|
||||
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)
|
||||
@ -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];
|
||||
if newtyp=procvardef then
|
||||
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).calleeargareasize:=calleeargareasize;
|
||||
tabstractprocdef(result).maxparacount:=maxparacount;
|
||||
|
Loading…
Reference in New Issue
Block a user