diff options
author | maciej <maciej@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-06 11:36:51 +0000 |
---|---|---|
committer | maciej <maciej@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-05-06 11:36:51 +0000 |
commit | 4b5b005d897f1f65081034e68c1f708270356da0 (patch) | |
tree | 778d5e949615e36a4b4b7c53dcfafded9f1d6b8a | |
parent | ece447e045b614a2359e23b659c33249e4418bda (diff) | |
download | fpc-maciej.tar.gz |
* Rename for management operators (proposed by Florian): AddRef -> Copy and Copy -> Clonemaciej
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/maciej@33657 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | smart_pointers/compiler/htypechk.pas | 4 | ||||
-rw-r--r-- | smart_pointers/compiler/pdecsub.pas | 8 | ||||
-rw-r--r-- | smart_pointers/compiler/symconst.pas | 4 | ||||
-rw-r--r-- | smart_pointers/compiler/symtable.pas | 6 | ||||
-rw-r--r-- | smart_pointers/compiler/tokens.pas | 8 | ||||
-rw-r--r-- | smart_pointers/rtl/inc/rtti.inc | 14 | ||||
-rw-r--r-- | smart_pointers/tests/test/toperator96.pp | 12 |
7 files changed, 28 insertions, 28 deletions
diff --git a/smart_pointers/compiler/htypechk.pas b/smart_pointers/compiler/htypechk.pas index 3cd4237db8..7375ce33be 100644 --- a/smart_pointers/compiler/htypechk.pas +++ b/smart_pointers/compiler/htypechk.pas @@ -141,8 +141,8 @@ interface tok2op: array[1..tok2ops] of ttok2oprec = ( (tok:_OP_INITIALIZE; managementoperator: mop_initialize), (tok:_OP_FINALIZE ; managementoperator: mop_finalize), - (tok:_OP_ADDREF ; managementoperator: mop_addref), - (tok:_OP_COPY ; managementoperator: mop_copy) + (tok:_OP_COPY ; managementoperator: mop_copy), + (tok:_OP_CLONE ; managementoperator: mop_clone) ); { true, if we are parsing stuff which allows array constructors } diff --git a/smart_pointers/compiler/pdecsub.pas b/smart_pointers/compiler/pdecsub.pas index e111c45cd3..a28dc24a97 100644 --- a/smart_pointers/compiler/pdecsub.pas +++ b/smart_pointers/compiler/pdecsub.pas @@ -595,7 +595,7 @@ implementation _DEC:optoken:=_OP_DEC; _INITIALIZE:optoken:=_OP_INITIALIZE; _FINALIZE:optoken:=_OP_FINALIZE; - _ADDREF:optoken:=_OP_ADDREF; + _CLONE:optoken:=_OP_CLONE; _COPY:optoken:=_OP_COPY; else if (m_delphi in current_settings.modeswitches) then @@ -1411,10 +1411,10 @@ implementation end; { operators without result } - if optoken in [_OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY] then + if optoken in [_OP_INITIALIZE, _OP_FINALIZE, _OP_COPY, _OP_CLONE] then begin { single var parameter to point the record } - if (optoken in [_OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF]) and + if (optoken in [_OP_INITIALIZE, _OP_FINALIZE, _OP_COPY]) and ( (pd.parast.SymList.Count <> 1) or (tparavarsym(pd.parast.SymList[0]).vardef<>pd.struct) or @@ -1422,7 +1422,7 @@ implementation ) then Message(parser_e_overload_impossible) { constref (source) and var (dest) parameter to point the records } - else if (optoken = _OP_COPY) and + else if (optoken = _OP_CLONE) and ( (pd.parast.SymList.Count <> 2) or (tparavarsym(pd.parast.SymList[0]).vardef<>pd.struct) or diff --git a/smart_pointers/compiler/symconst.pas b/smart_pointers/compiler/symconst.pas index a8b43e2203..d2402fd0a1 100644 --- a/smart_pointers/compiler/symconst.pas +++ b/smart_pointers/compiler/symconst.pas @@ -575,8 +575,8 @@ type tmanagementoperator=(mop_none, mop_initialize, mop_finalize, - mop_addref, - mop_copy + mop_copy, + mop_clone ); tmanagementoperators=set of tmanagementoperator; diff --git a/smart_pointers/compiler/symtable.pas b/smart_pointers/compiler/symtable.pas index 5f35c17d46..6ce2769868 100644 --- a/smart_pointers/compiler/symtable.pas +++ b/smart_pointers/compiler/symtable.pas @@ -431,8 +431,8 @@ interface { _OP_ENUMERATOR } 'enumerator', { _OP_INITIALIZE } 'initialize', { _OP_FINALIZE } 'finalize', - { _OP_ADDREF } 'addref', { _OP_COPY } 'copy', + { _OP_CLONE } 'clone', { _OP_INC } 'inc', { _OP_DEC } 'dec'); @@ -440,8 +440,8 @@ interface { mop_none } NOTOKEN, { mop_initialize } _OP_INITIALIZE, { mop_finalize } _OP_FINALIZE, - { mop_addref } _OP_ADDREF, - { mop_copy } _OP_COPY + { mop_copy } _OP_COPY, + { mop_clone } _OP_CLONE ); diff --git a/smart_pointers/compiler/tokens.pas b/smart_pointers/compiler/tokens.pas index 0dac5963d5..9f74fa013c 100644 --- a/smart_pointers/compiler/tokens.pas +++ b/smart_pointers/compiler/tokens.pas @@ -58,7 +58,7 @@ type _OP_ENUMERATOR, _OP_INITIALIZE, _OP_FINALIZE, - _OP_ADDREF, + _OP_CLONE, _OP_COPY, _OP_INC, _OP_DEC, @@ -158,6 +158,7 @@ type _BREAK, _CDECL, _CLASS, + _CLONE, _CONST, _EQUAL, _FAR16, @@ -169,7 +170,6 @@ type _UNTIL, _WHILE, _WRITE, - _ADDREF, _DISPID, _DIVIDE, _DOWNTO, @@ -389,8 +389,8 @@ const (str:'enumerator' ;special:true ;keyword:[m_none];op:NOTOKEN), (str:'initialize' ;special:true ;keyword:[m_none];op:NOTOKEN), (str:'finalize' ;special:true ;keyword:[m_none];op:NOTOKEN), - (str:'addref' ;special:true ;keyword:[m_none];op:NOTOKEN), (str:'copy' ;special:true ;keyword:[m_none];op:NOTOKEN), + (str:'clone' ;special:true ;keyword:[m_none];op:NOTOKEN), (str:'inc' ;special:true ;keyword:[m_none];op:NOTOKEN), (str:'dec' ;special:true ;keyword:[m_none];op:NOTOKEN), { Special chars } @@ -489,6 +489,7 @@ const (str:'BREAK' ;special:false;keyword:[m_none];op:NOTOKEN), (str:'CDECL' ;special:false;keyword:[m_none];op:NOTOKEN), (str:'CLASS' ;special:false;keyword:[m_class];op:NOTOKEN), + (str:'CLONE' ;special:false;keyword:[m_none];op:NOTOKEN), (str:'CONST' ;special:false;keyword:alllanguagemodes;op:NOTOKEN), (str:'EQUAL' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name } (str:'FAR16' ;special:false;keyword:[m_none];op:NOTOKEN), @@ -500,7 +501,6 @@ const (str:'UNTIL' ;special:false;keyword:alllanguagemodes;op:NOTOKEN), (str:'WHILE' ;special:false;keyword:alllanguagemodes;op:NOTOKEN), (str:'WRITE' ;special:false;keyword:[m_none];op:NOTOKEN), - (str:'ADDREF' ;special:false;keyword:[m_none];op:NOTOKEN), (str:'DISPID' ;special:false;keyword:[m_none];op:NOTOKEN), (str:'DIVIDE' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name } (str:'DOWNTO' ;special:false;keyword:alllanguagemodes;op:NOTOKEN), diff --git a/smart_pointers/rtl/inc/rtti.inc b/smart_pointers/rtl/inc/rtti.inc index 07e430b112..ebce516924 100644 --- a/smart_pointers/rtl/inc/rtti.inc +++ b/smart_pointers/rtl/inc/rtti.inc @@ -54,7 +54,7 @@ type {$if FPC_FULLVERSION>30100} TRTTIRecVarOp=procedure(ARec: Pointer); - TRTTIRecCopyOp=procedure(ASrc, ADest: Pointer); + TRTTIRecCloneOp=procedure(ASrc, ADest: Pointer); PRTTIRecordOpVMT=^TRTTIRecordOpVMT; TRTTIRecordOpVMT= @@ -64,8 +64,8 @@ type record Initialize: TRTTIRecVarOp; Finalize: TRTTIRecVarOp; - AddRef: TRTTIRecVarOp; - Copy: TRTTIRecCopyOp; + Copy: TRTTIRecVarOp; + Clone: TRTTIRecCloneOp; end; PRecordInfoInit=^TRecordInfoInit; @@ -314,8 +314,8 @@ begin begin recordrtti(data,typeinfo,@int_addref); {$if FPC_FULLVERSION>30100} - if Assigned(recordop) and Assigned(recordop^.AddRef) then - recordop^.AddRef(Data); + if Assigned(recordop) and Assigned(recordop^.Copy) then + recordop^.Copy(Data); {$endif FPC_FULLVERSION>30100} end; {$ifdef FPC_HAS_FEATURE_DYNARRAYS} @@ -395,8 +395,8 @@ begin begin Temp:=aligntoptr(typeInfo+2+PByte(typeInfo)[1]); {$if FPC_FULLVERSION>30100} - if Assigned(recordop) and Assigned(recordop^.Copy) then - recordop^.Copy(Src,Dest) + if Assigned(recordop) and Assigned(recordop^.Clone) then + recordop^.Clone(Src,Dest) else begin Result:=Size; diff --git a/smart_pointers/tests/test/toperator96.pp b/smart_pointers/tests/test/toperator96.pp index 0137a73570..8e9d86567e 100644 --- a/smart_pointers/tests/test/toperator96.pp +++ b/smart_pointers/tests/test/toperator96.pp @@ -9,8 +9,8 @@ type private class operator Initialize(var aFoo: TFoo); class operator Finalize(var aFoo: TFoo); - class operator AddRef(var aFoo: TFoo); - class operator Copy(constref aSrc: TFoo; var aDst: TFoo); + class operator Copy(var aFoo: TFoo); + class operator Clone(constref aSrc: TFoo; var aDst: TFoo); public CopyState: TCopyState; Ref: Boolean; @@ -52,19 +52,19 @@ begin aFoo.F := 4; end; -class operator TFoo.AddRef(var aFoo: TFoo); +class operator TFoo.Copy(var aFoo: TFoo); begin - WriteLn('TFoo.AddRef'); + WriteLn('TFoo.Copy'); aFoo.F := 3; aFoo.Test := aFoo.Test + 1; aFoo.Ref := True; end; -class operator TFoo.Copy(constref aSrc: TFoo; var aDst: TFoo); +class operator TFoo.Clone(constref aSrc: TFoo; var aDst: TFoo); var LSrc: PFoo; begin - WriteLn('TFoo.Copy'); + WriteLn('TFoo.Clone'); LSrc := @aSrc; LSrc.CopyState := csSource; aDst.CopyState := csDest; |