mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 00:30:33 +02:00
+ first changes to make self a hidden parameter
This commit is contained in:
parent
6de2818658
commit
9e0e8340f7
@ -59,6 +59,7 @@
|
|||||||
|
|
||||||
{$ifdef powerpc}
|
{$ifdef powerpc}
|
||||||
{$define callparatemp}
|
{$define callparatemp}
|
||||||
|
{$define vs_hidden_self}
|
||||||
{$endif powerpc}
|
{$endif powerpc}
|
||||||
|
|
||||||
{ FPU Emulator support }
|
{ FPU Emulator support }
|
||||||
@ -73,7 +74,10 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.17 2003-04-24 22:29:57 florian
|
Revision 1.18 2003-04-30 09:42:42 florian
|
||||||
|
+ first changes to make self a hidden parameter
|
||||||
|
|
||||||
|
Revision 1.17 2003/04/24 22:29:57 florian
|
||||||
* fixed a lot of PowerPC related stuff
|
* fixed a lot of PowerPC related stuff
|
||||||
|
|
||||||
Revision 1.16 2003/04/23 13:47:41 peter
|
Revision 1.16 2003/04/23 13:47:41 peter
|
||||||
|
@ -111,7 +111,7 @@ implementation
|
|||||||
{ Generate result variable accessing function result }
|
{ Generate result variable accessing function result }
|
||||||
vs:=tvarsym.create('$result',pd.rettype);
|
vs:=tvarsym.create('$result',pd.rettype);
|
||||||
include(vs.varoptions,vo_is_funcret);
|
include(vs.varoptions,vo_is_funcret);
|
||||||
{ Store the this symbol as fucnretsym for procedures }
|
{ Store the this symbol as funcretsym for procedures }
|
||||||
if pd.deftype=procdef then
|
if pd.deftype=procdef then
|
||||||
tprocdef(pd).funcretsym:=vs;
|
tprocdef(pd).funcretsym:=vs;
|
||||||
|
|
||||||
@ -125,6 +125,49 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure insert_self_and_vmt_para(pd:tabstractprocdef);
|
||||||
|
var
|
||||||
|
storepos : tfileposinfo;
|
||||||
|
vs : tvarsym;
|
||||||
|
tt : ttype;
|
||||||
|
begin
|
||||||
|
if (pd.deftype=procvardef) and
|
||||||
|
pd.is_methodpointer then
|
||||||
|
begin
|
||||||
|
internalerror(200304301);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (pd is tprocdef) and
|
||||||
|
assigned(tprocdef(pd)._class) then
|
||||||
|
begin
|
||||||
|
storepos:=akttokenpos;
|
||||||
|
if pd.deftype=procdef then
|
||||||
|
akttokenpos:=tprocdef(pd).fileinfo;
|
||||||
|
|
||||||
|
{ Generate result variable accessing function result }
|
||||||
|
tt.setdef(tprocdef(pd)._class);
|
||||||
|
{ for unknwon reasons this doesn't work:
|
||||||
|
tt.setdef(tprocdef(pd)._class.typedef);
|
||||||
|
}
|
||||||
|
vs:=tvarsym.create('$self',tt);
|
||||||
|
include(vs.varoptions,vo_is_funcret);
|
||||||
|
{ Store the this symbol as funcretsym for procedures }
|
||||||
|
if pd.deftype=procdef then
|
||||||
|
tprocdef(pd).funcretsym:=vs;
|
||||||
|
|
||||||
|
{ Handle self of objects like a var parameter }
|
||||||
|
if is_object(tprocdef(pd)._class) then
|
||||||
|
vs.varspez:=vs_var;
|
||||||
|
|
||||||
|
pd.parast.insert(vs);
|
||||||
|
{ Also insert a hidden parameter as first }
|
||||||
|
pd.insertpara(vs.vartype,vs,vs_hidden,nil);
|
||||||
|
|
||||||
|
akttokenpos:=storepos;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure insert_funcret_local(pd:tprocdef);
|
procedure insert_funcret_local(pd:tprocdef);
|
||||||
var
|
var
|
||||||
@ -1731,6 +1774,10 @@ const
|
|||||||
begin
|
begin
|
||||||
{ insert hidden high parameters }
|
{ insert hidden high parameters }
|
||||||
insert_hidden_para(pd);
|
insert_hidden_para(pd);
|
||||||
|
{ insert hidden self parameter }
|
||||||
|
{$ifdef vs_hidden_self}
|
||||||
|
insert_self_and_vmt_para(pd);
|
||||||
|
{$endif vs_hidden_self}
|
||||||
{ insert funcret parameter if required }
|
{ insert funcret parameter if required }
|
||||||
insert_funcret_para(pd);
|
insert_funcret_para(pd);
|
||||||
|
|
||||||
@ -2123,7 +2170,10 @@ const
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.119 2003-04-27 11:21:33 peter
|
Revision 1.120 2003-04-30 09:42:42 florian
|
||||||
|
+ first changes to make self a hidden parameter
|
||||||
|
|
||||||
|
Revision 1.119 2003/04/27 11:21:33 peter
|
||||||
* aktprocdef renamed to current_procdef
|
* aktprocdef renamed to current_procdef
|
||||||
* procinfo renamed to current_procinfo
|
* procinfo renamed to current_procinfo
|
||||||
* procinfo will now be stored in current_module so it can be
|
* procinfo will now be stored in current_module so it can be
|
||||||
|
Loading…
Reference in New Issue
Block a user