[fpc-pascal] Compiler treatment of dotted reference in class property
Howard Page-Clark
hdpc at talktalk.net
Mon Feb 3 11:14:36 CET 2020
FPC 3.0.4 compiles this code excerpt without a murmur:
== code ==
{$mode objfpc}{$H+}
type
TSheetInfo = record
name: String;
tab: String;
title: String;
kind: TSheetKind; // an enumeration
color: TColor;
end;
TBaseSheet = class(TTabSheet)
protected
FSheetInfo: TSheetInfo;
...
public
constructor Create(aComponent: TComponent; aSheetInfo: TSheetInfo);
virtual; reintroduce;
...
property SheetKind: TSheetKind read FSheetInfo.kind; // <<
end;
TEntryGrid = class(TCustomStringGrid)
private
FParentSheet: TBaseSheet;
...
public
constructor Create(AOwner: TComponent; aParentSheet: TBaseSheet);
reintroduce;
...
property SheetKind: TSheetKind read FParentSheet.FSheetInfo.kind; // <<
end;
== code end ==
However, more recent FPCs (and trunk) reject this at the properties
(marked above <<) with the error "Record or object type expected".
Is there a modeswitch or other wheeze that will get recent FPCs to
accept dotted notation when specifying property read and write fields?
More information about the fpc-pascal
mailing list