mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 13:29:27 +02:00

- add an option to skip varspez during parameters comparison - skip varspez comparison when searching a property reader candidate if $VARPROPSETTER is ON git-svn-id: trunk@15020 -
44 lines
648 B
ObjectPascal
44 lines
648 B
ObjectPascal
program tvarpropsetter1;
|
|
|
|
{$ifdef fpc}
|
|
{$mode delphi}
|
|
{$endif}
|
|
|
|
{$VARPROPSETTER ON}
|
|
|
|
type
|
|
TSomeClass = class
|
|
private
|
|
FTest: Integer;
|
|
function GetTest: Integer;
|
|
procedure SetTest(var AValue: Integer);
|
|
public
|
|
property Test: Integer read GetTest write SetTest;
|
|
end;
|
|
|
|
{ TSomeClass }
|
|
|
|
function TSomeClass.GetTest: Integer;
|
|
begin
|
|
Result := FTest;
|
|
end;
|
|
|
|
procedure TSomeClass.SetTest(var AValue: Integer);
|
|
begin
|
|
FTest := AValue;
|
|
AValue := 10;
|
|
end;
|
|
|
|
var
|
|
Cl: TSomeClass;
|
|
D: Integer;
|
|
begin
|
|
Cl := TSomeClass.Create;
|
|
D := 5;
|
|
Cl.Test := D;
|
|
if Cl.Test <> 5 then
|
|
halt(1);
|
|
if D <> 10 then
|
|
halt(2);
|
|
Cl.Free;
|
|
end. |