FpDebug: fixed evaluating signed/unsigned mixed AND

git-svn-id: trunk@64387 -
This commit is contained in:
martin 2021-01-14 21:14:05 +00:00
parent 78d7603454
commit 3f5954b07e
3 changed files with 20 additions and 7 deletions

View File

@ -272,6 +272,7 @@ type
FValue: QWord;
protected
function GetAsCardinal: QWord; override;
function GetAsInteger: Int64; override;
procedure SetAsCardinal(AValue: QWord); override;
function GetFieldFlags: TFpValueFieldFlags; override;
end;
@ -2155,6 +2156,11 @@ begin
FValue := Result;
end;
function TFpValueDwarfCardinal.GetAsInteger: Int64;
begin
Result := Int64(GetAsCardinal);
end;
function TFpValueDwarfCardinal.GetFieldFlags: TFpValueFieldFlags;
begin
Result := inherited GetFieldFlags;

View File

@ -3090,13 +3090,12 @@ begin
{$PUSH}{$R-}{$Q-}
case tmp1.Kind of
skInteger: if tmp2.Kind in [skInteger, skCardinal] then
Result := TFpValueConstNumber.Create(tmp1.AsInteger AND tmp2.AsInteger, True);
skCardinal: if tmp2.Kind = skInteger then
Result := TFpValueConstNumber.Create(tmp1.AsInteger AND tmp2.AsInteger, True)
else
if tmp2.Kind = skCardinal then
Result := TFpValueConstNumber.Create(tmp1.AsInteger AND tmp2.AsInteger, False);
skInteger: if tmp2.Kind = skInteger then
Result := TFpValueConstNumber.Create(tmp1.AsInteger AND tmp2.AsInteger, True)
else
Result := TFpValueConstNumber.Create(tmp1.AsCardinal AND tmp2.AsCardinal, False);
skCardinal: if tmp2.Kind in [skInteger, skCardinal] then
Result := TFpValueConstNumber.Create(tmp1.AsCardinal AND tmp2.AsCardinal, False);
skBoolean: if tmp2.Kind = skBoolean then
Result := TFpValueConstBool.Create(tmp1.AsBool AND tmp2.AsBool);
end;

View File

@ -2103,6 +2103,14 @@ procedure TTestWatches.TestWatchesExpression;
.skipIf((ALoc in [tlConst]) or (ALoc2 in [tlConst]));
t.Add(AName, p+'Word'+e +' and '+ p+'LongWord'+e, weInteger((100+n) and (1000+n)) );
t.Add(AName, p+'Word'+e +' and Byte('+ p+'Char'+e+')', weInteger((100+n) and Byte(AChr1)) );
t.Add(AName, p+'Word'+e +' and '+ IntToStr(1002+n), weInteger((100+n) and (1002+n)) );
t.Add(AName, p+'Word'+e +' and ShortInt('+ p+'Char'+e+')', weInteger((100+n) and Byte(AChr1)) );
t.Add(AName, p+'ShortInt'+e +' and '+ p+'SmallInt'+e, weInteger((50+n) and (500+n)) );
t.Add(AName, p+'ShortInt'+e +' and '+ p+'Word'+e, weInteger((50+n) and (1000+n)) );
t.Add(AName, p+'ShortInt'+e +' and '+ IntToStr(1002+n), weInteger((50+n) and (1002+n)) );
for i := 0 to t.Count-1 do
t.Tests[i].IgnTypeName();