From 3ac950eed75bad4bb44fd7bb62c4e9a690c4e445 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 20 Aug 2011 08:27:22 +0000 Subject: [PATCH] * 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 - --- compiler/pjvm.pas | 2 +- compiler/symcreat.pas | 4 ++-- rtl/java/jrech.inc | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/pjvm.pas b/compiler/pjvm.pas index fd5a344d6d..0d57d175a0 100644 --- a/compiler/pjvm.pas +++ b/compiler/pjvm.pas @@ -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); diff --git a/compiler/symcreat.pas b/compiler/symcreat.pas index 60efb3cfc3..ed40297e4a 100644 --- a/compiler/symcreat.pas +++ b/compiler/symcreat.pas @@ -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;'; diff --git a/rtl/java/jrech.inc b/rtl/java/jrech.inc index f6dc0855d1..13e024ca7d 100644 --- a/rtl/java/jrech.inc +++ b/rtl/java/jrech.inc @@ -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;