* refcount fixed, it is now correctly using the same temp

This commit is contained in:
peter 2004-03-29 14:28:15 +00:00
parent 4c61aa26c4
commit dc67ea9d52

View File

@ -48,19 +48,21 @@ begin
end;
begin
writeln('All reference counts should be 1 for the following...');
onestring := 'one';
twostring := 'two';
ARecordWithStrings.one := onestring + twostring;
twostring := onestring + twostring;
RefCount(ARecordWithStrings.one,1);
{ Here we allocate a temp so refcount will be 2 }
ARecordWithStrings := FunctionResultIsRecord(ARecordWithStrings);
twostring := onestring + twostring;
RefCount(ARecordWithStrings.one,2);
{ Temp is reused, refcount should stay 2 }
ARecordWithStrings := FunctionResultIsRecord(ARecordWithStrings);
twostring := onestring + twostring;
RefCount(ARecordWithStrings.one,3);
RefCount(ARecordWithStrings.one,2);
{ Temp is reused, refcount should stay 2 }
ARecordWithStrings := FunctionResultIsRecord(ARecordWithStrings);
twostring := onestring + twostring;
RefCount(ARecordWithStrings.one,4);
ARecordWithStrings := FunctionResultIsRecord(ARecordWithStrings);
twostring := onestring + twostring;
RefCount(ARecordWithStrings.one,5);
end.
RefCount(ARecordWithStrings.one,2);
end.