Skip to content

Commit f04cd34

Browse files
committed
moved PassByRef to Spring.pas
1 parent a4dd7e5 commit f04cd34

File tree

2 files changed

+43
-39
lines changed

2 files changed

+43
-39
lines changed

Source/Base/Spring.Reflection.pas

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,6 @@ THasFlagsFilter = class(TSpecification<TRttiParameter>)
665665

666666
{$REGION 'Routines'}
667667

668-
function PassByRef(TypeInfo: PTypeInfo; CC: TCallConv;
669-
IsConst: Boolean = False): Boolean;
670668
procedure PassArg(Par: TRttiParameter; const ArgSrc: TValue;
671669
var ArgDest: TValue; CC: TCallConv);
672670

@@ -688,43 +686,6 @@ implementation
688686

689687
{$REGION 'Routines'}
690688

691-
function PassByRef(TypeInfo: PTypeInfo; CC: TCallConv; IsConst: Boolean = False): Boolean;
692-
begin
693-
if TypeInfo = nil then
694-
Exit(False);
695-
case TypeInfo^.Kind of
696-
tkArray:
697-
Result := GetTypeData(TypeInfo)^.ArrayData.Size > SizeOf(Pointer);
698-
{$IF Defined(CPUX86)}
699-
tkRecord:
700-
if (CC in [ccCdecl, ccStdCall, ccSafeCall]) and not IsConst then
701-
Result := False
702-
else
703-
Result := GetTypeData(TypeInfo)^.RecSize > SizeOf(Pointer);
704-
tkVariant:
705-
Result := IsConst or not (CC in [ccCdecl, ccStdCall, ccSafeCall]);
706-
{$ELSEIF Defined(CPUX64)}
707-
tkRecord:
708-
Result := not (GetTypeData(TypeInfo)^.RecSize in [1,2,4,8]);
709-
tkMethod,
710-
tkVariant:
711-
Result := True;
712-
{$ELSEIF Defined(CPUARM)}
713-
tkRecord:
714-
Result := (CC = ccReg) or (CC = ccPascal);
715-
tkMethod,
716-
tkVariant:
717-
Result := True;
718-
{$IFEND}
719-
{$IFNDEF NEXTGEN}
720-
tkString:
721-
Result := GetTypeData(TypeInfo)^.MaxLength > SizeOf(Pointer);
722-
{$ENDIF}
723-
else
724-
Result := False;
725-
end;
726-
end;
727-
728689
procedure PassArg(Par: TRttiParameter; const ArgSrc: TValue;
729690
var ArgDest: TValue; CC: TCallConv);
730691
begin

Source/Base/Spring.pas

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,6 +3149,8 @@ function _LookupVtableInfo(intf: TDefaultGenericInterface; info: TypInfo.PTypeIn
31493149
function RegisterExpectedMemoryLeak(P: Pointer): Boolean;
31503150
{$ENDIF}
31513151

3152+
function PassByRef(TypeInfo: PTypeInfo; CC: TCallConv; IsConst: Boolean = False): Boolean;
3153+
31523154
{$ENDREGION}
31533155

31543156

@@ -4462,6 +4464,47 @@ function RegisterExpectedMemoryLeak(P: Pointer): Boolean;
44624464
end;
44634465
{$ENDIF}
44644466

4467+
function PassByRef(TypeInfo: PTypeInfo; CC: TCallConv; IsConst: Boolean = False): Boolean;
4468+
begin
4469+
if TypeInfo = nil then
4470+
Exit(False);
4471+
case TypeInfo^.Kind of
4472+
tkArray:
4473+
Result := GetTypeData(TypeInfo)^.ArrayData.Size > SizeOf(Pointer);
4474+
{$IF Defined(CPUX86)}
4475+
tkRecord:
4476+
if (CC in [ccCdecl, ccStdCall, ccSafeCall]) and not IsConst then
4477+
Result := False
4478+
else
4479+
Result := GetTypeData(TypeInfo)^.RecSize > SizeOf(Pointer);
4480+
tkVariant:
4481+
Result := IsConst or not (CC in [ccCdecl, ccStdCall, ccSafeCall]);
4482+
{$ELSEIF Defined(CPUX64)}
4483+
tkRecord:
4484+
Result := not (GetTypeData(TypeInfo)^.RecSize in [1,2,4,8]);
4485+
tkMethod,
4486+
tkVariant:
4487+
Result := True;
4488+
{$ELSEIF Defined(CPUARM)}
4489+
tkRecord:
4490+
Result := (CC = ccReg) or (CC = ccPascal);
4491+
tkMethod,
4492+
tkVariant:
4493+
Result := True;
4494+
{$IFEND}
4495+
{$IFNDEF NEXTGEN}
4496+
tkString:
4497+
Result := GetTypeData(TypeInfo)^.MaxLength > SizeOf(Pointer);
4498+
{$ENDIF}
4499+
{$IF declared(tkMRecord)}
4500+
tkMRecord:
4501+
Result := True;
4502+
{$IFEND}
4503+
else
4504+
Result := False;
4505+
end;
4506+
end;
4507+
44654508
{$ENDREGION}
44664509

44674510

0 commit comments

Comments
 (0)