mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-24 17:09:34 +01:00
* add NULL handling for customvariants, patch by Ludo, Mantis #20697
git-svn-id: trunk@19660 -
This commit is contained in:
parent
a52fe3162d
commit
b070a0bbbc
@ -1237,6 +1237,29 @@ end;
|
|||||||
function DoVarCmpComplex(const Left, Right: TVarData; const OpCode: TVarOp): ShortInt;
|
function DoVarCmpComplex(const Left, Right: TVarData; const OpCode: TVarOp): ShortInt;
|
||||||
var Handler: TCustomVariantType;
|
var Handler: TCustomVariantType;
|
||||||
CmpRes: boolean;
|
CmpRes: boolean;
|
||||||
|
begin
|
||||||
|
if (Left.vType=varnull) or (Right.vType=varnull) then
|
||||||
|
// don't bother custom variant handlers with conversion to NULL
|
||||||
|
begin
|
||||||
|
if OpCode in [opCmpEq,opCmpNe] then
|
||||||
|
begin
|
||||||
|
if (Left.vType=Right.vType) xor (OpCode=opCmpNe) then
|
||||||
|
result:=0
|
||||||
|
else
|
||||||
|
result:=-1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if Left.vType=varnull then
|
||||||
|
begin
|
||||||
|
if Right.vType=varnull then
|
||||||
|
Result := 0
|
||||||
|
else
|
||||||
|
Result := -1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
if FindCustomVariantType(Left.vType, Handler) then
|
if FindCustomVariantType(Left.vType, Handler) then
|
||||||
CmpRes := Handler.CompareOp(Left, Right, OpCode)
|
CmpRes := Handler.CompareOp(Left, Right, OpCode)
|
||||||
@ -1270,6 +1293,7 @@ begin
|
|||||||
Result:=-1;
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function DoVarCmp(const vl, vr : TVarData; const OpCode : TVarOp) : ShortInt;
|
function DoVarCmp(const vl, vr : TVarData; const OpCode : TVarOp) : ShortInt;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user