mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:29:26 +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 }
|
{ can't use def.typesym, not yet set at this point }
|
||||||
if not assigned(def.symtable.realname) then
|
if not assigned(def.symtable.realname) then
|
||||||
internalerror(2011032803);
|
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
|
pd.synthetickind:=tsk_record_deepcopy
|
||||||
else
|
else
|
||||||
internalerror(2011032807);
|
internalerror(2011032807);
|
||||||
|
@ -382,14 +382,14 @@ implementation
|
|||||||
not assigned(struct.typesym) then
|
not assigned(struct.typesym) then
|
||||||
internalerror(2011032811);
|
internalerror(2011032811);
|
||||||
{ copy all fields }
|
{ 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
|
for i:=0 to struct.symtable.symlist.count-1 do
|
||||||
begin
|
begin
|
||||||
sym:=tsym(struct.symtable.symlist[i]);
|
sym:=tsym(struct.symtable.symlist[i]);
|
||||||
if (sym.typ=fieldvarsym) then
|
if (sym.typ=fieldvarsym) then
|
||||||
begin
|
begin
|
||||||
fsym:=tfieldvarsym(sym);
|
fsym:=tfieldvarsym(sym);
|
||||||
str:=str+'result.&'+fsym.realname+':=&'+fsym.realname+';';
|
str:=str+'res^.&'+fsym.realname+':=&'+fsym.realname+';';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
str:=str+'end;';
|
str:=str+'end;';
|
||||||
|
@ -24,5 +24,6 @@ type
|
|||||||
function clone: JLObject;override;
|
function clone: JLObject;override;
|
||||||
{ create an empty instance of the current type }
|
{ create an empty instance of the current type }
|
||||||
function newEmpty: FpcBaseRecordType;
|
function newEmpty: FpcBaseRecordType;
|
||||||
|
procedure fpcDeepCopy(result: FpcBaseRecordType);virtual;abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user