mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 03:39:30 +02:00
* changed the parameter of fpcDeepCopy() from an out-parameter of the
actual recordtype into FpcBaseRecordType so we can also use the deep copy routine in the RTL + added abstract fpcDeepCopy() declaration to FpcBaseRecordType class git-svn-id: branches/jvmbackend@18718 -
This commit is contained in:
parent
469bda2710
commit
3ac950eed7
@ -194,7 +194,7 @@ implementation
|
||||
{ can't use def.typesym, not yet set at this point }
|
||||
if not assigned(def.symtable.realname) then
|
||||
internalerror(2011032803);
|
||||
if str_parse_method_dec('procedure fpcDeepCopy(out result:'+def.symtable.realname^+');',potype_procedure,false,def,pd) then
|
||||
if str_parse_method_dec('procedure fpcDeepCopy(result: FpcBaseRecordType);override;',potype_procedure,false,def,pd) then
|
||||
pd.synthetickind:=tsk_record_deepcopy
|
||||
else
|
||||
internalerror(2011032807);
|
||||
|
@ -382,14 +382,14 @@ implementation
|
||||
not assigned(struct.typesym) then
|
||||
internalerror(2011032811);
|
||||
{ copy all fields }
|
||||
str:='begin ';
|
||||
str:='type _fpc_ptrt = ^'+struct.typesym.realname+'; var res: _fpc_ptrt; begin res:=_fpc_ptrt(result);';
|
||||
for i:=0 to struct.symtable.symlist.count-1 do
|
||||
begin
|
||||
sym:=tsym(struct.symtable.symlist[i]);
|
||||
if (sym.typ=fieldvarsym) then
|
||||
begin
|
||||
fsym:=tfieldvarsym(sym);
|
||||
str:=str+'result.&'+fsym.realname+':=&'+fsym.realname+';';
|
||||
str:=str+'res^.&'+fsym.realname+':=&'+fsym.realname+';';
|
||||
end;
|
||||
end;
|
||||
str:=str+'end;';
|
||||
|
@ -24,5 +24,6 @@ type
|
||||
function clone: JLObject;override;
|
||||
{ create an empty instance of the current type }
|
||||
function newEmpty: FpcBaseRecordType;
|
||||
procedure fpcDeepCopy(result: FpcBaseRecordType);virtual;abstract;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user