[fpc-pascal] += property bug?

Sven Barth pascaldragon at googlemail.com
Sun Aug 11 19:41:48 CEST 2019


Am 11.08.2019 um 18:33 schrieb Ryan Joseph:
> Is this a bug? It should resolve to:
>
> d.setter(d.getter + 10)
>
> but it doesn’t seem to be working.
>
> ========================================
>
> {$mode objfpc}
> {$modeswitch advancedrecords}
>
> program test;
>
> type
>    TData = record
>      x: integer;
>    end;
>
> type
>    TVec2Helper = record helper for TData
>      function Getter: integer;
>      procedure Setter(newValue: integer);
>      property Get: integer read Getter write Setter;
>    end;
>
> function TVec2Helper.Getter: integer;
> begin
>    result := x;
> end;
>
> procedure TVec2Helper.Setter(newValue: integer);
> begin
>    x := newValue;
> end;
>
> var
>    d: TData;
> begin
>    d.get += 10;	// ERROR: Variable identifier expected
> end.
This is forbidden by design.

Regards,
Sven


More information about the fpc-pascal mailing list