RTL enhancements

This commit is contained in:
Michael Schimmel
2025-09-19 15:05:20 +02:00
parent abbce15362
commit c31985935c
6 changed files with 439 additions and 264 deletions
+1 -19
View File
@@ -16,17 +16,10 @@ type
private
type
IVal = interface
{$ifdef DEBUG}
function GetTypeHandle: Pointer;
{$endif}
end;
TVal<T> = class(TInterfacedObject, IVal)
TVal<T> = class(TInterfacedObject)
Value: T;
{$ifdef DEBUG}
TypeHandle: Pointer;
function GetTypeHandle: Pointer;
{$endif}
constructor Create(const AValue: T);
end;
@@ -176,13 +169,6 @@ begin
{$endif}
end;
{$ifdef DEBUG}
function TDataValue.TVal<T>.GetTypeHandle: Pointer;
begin
Result := TypeHandle;
end;
{$endif}
function TDataValue.AsLazy: ILazy;
begin
Assert(FKind = Ord(vkLazy));
@@ -409,11 +395,7 @@ begin
Ord(vkGeneric):
// Getting meaningful type information for vkGeneric is not easily possible
// without storing additional RTTI, as the specific type of T in TVal<T> is lost.
{$ifdef DEBUG}
Result := '<' + String(PTypeInfo(TDataValue.IVal(FInterface).GetTypeHandle).Name) + '>';
{$else}
Result := '<generic>';
{$endif}
Ord(vkLazy): Result := Format('<lazy[%s]>', [AsLazy.Kind.ToString]);
else
Result := '[Unknown DataValue]';