mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:29:21 +02:00
* Allow assign of pointer to TValue. Patch by Lipinast Lekrisov
This commit is contained in:
parent
bb2d12457c
commit
1c816990c3
@ -282,6 +282,7 @@ type
|
|||||||
class operator := (AValue: QWord): TValue; inline;
|
class operator := (AValue: QWord): TValue; inline;
|
||||||
class operator := (AValue: TObject): TValue; inline;
|
class operator := (AValue: TObject): TValue; inline;
|
||||||
class operator := (AValue: TClass): TValue; inline;
|
class operator := (AValue: TClass): TValue; inline;
|
||||||
|
class operator := (AValue: Pointer): TValue; inline;
|
||||||
class operator := (AValue: Boolean): TValue; inline;
|
class operator := (AValue: Boolean): TValue; inline;
|
||||||
class operator := (AValue: IUnknown): TValue; inline;
|
class operator := (AValue: IUnknown): TValue; inline;
|
||||||
class operator := (AValue: TVarRec): TValue; inline;
|
class operator := (AValue: TVarRec): TValue; inline;
|
||||||
@ -2386,7 +2387,6 @@ begin
|
|||||||
Make(@AValue, System.TypeInfo(AValue), Result);
|
Make(@AValue, System.TypeInfo(AValue), Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
class operator TValue.:=(const AValue: WideString): TValue;
|
class operator TValue.:=(const AValue: WideString): TValue;
|
||||||
begin
|
begin
|
||||||
Make(@AValue, System.TypeInfo(AValue), Result);
|
Make(@AValue, System.TypeInfo(AValue), Result);
|
||||||
@ -2472,6 +2472,11 @@ begin
|
|||||||
Make(@AValue, System.TypeInfo(AValue), Result);
|
Make(@AValue, System.TypeInfo(AValue), Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class operator TValue.:=(AValue: Pointer): TValue;
|
||||||
|
begin
|
||||||
|
Make(@AValue, System.TypeInfo(AValue), Result);
|
||||||
|
end;
|
||||||
|
|
||||||
class operator TValue.:=(AValue: Boolean): TValue;
|
class operator TValue.:=(AValue: Boolean): TValue;
|
||||||
begin
|
begin
|
||||||
Make(@AValue, System.TypeInfo(AValue), Result);
|
Make(@AValue, System.TypeInfo(AValue), Result);
|
||||||
|
@ -17,6 +17,7 @@ Type
|
|||||||
procedure TestReferenceRawDataEmpty;
|
procedure TestReferenceRawDataEmpty;
|
||||||
procedure TestIsManaged;
|
procedure TestIsManaged;
|
||||||
procedure TestCasts;
|
procedure TestCasts;
|
||||||
|
procedure TestAssignPointer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TTestValueSimple = Class(TTestCase)
|
TTestValueSimple = Class(TTestCase)
|
||||||
@ -1959,7 +1960,14 @@ begin
|
|||||||
.{$ifdef fpc}specialize{$endif} Cast<AnsiString>
|
.{$ifdef fpc}specialize{$endif} Cast<AnsiString>
|
||||||
.{$ifdef fpc}specialize{$endif} AsType<AnsiString>, 'TValue.From<shortring>.Cast<AnsiString> failed');
|
.{$ifdef fpc}specialize{$endif} AsType<AnsiString>, 'TValue.From<shortring>.Cast<AnsiString> failed');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestValueGeneral.TestAssignPointer;
|
||||||
|
var
|
||||||
|
V : TValue;
|
||||||
|
begin
|
||||||
|
V:=Pointer(Nil);
|
||||||
|
AssertSame('Correct type info', TypeInfo(Pointer),V.TypeInfo);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestValueGeneral.TestReferenceRawData;
|
procedure TTestValueGeneral.TestReferenceRawData;
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user