* Handle consts in records

git-svn-id: trunk@31229 -
This commit is contained in:
michael 2015-07-26 08:05:34 +00:00
parent 07c26c1754
commit 66f4d0bc4e

View File

@ -64,6 +64,7 @@ resourcestring
SParserNoConstructorAllowed = 'Constructors or Destructors are not allowed in Interfaces or Record helpers';
SParserNoFieldsAllowed = 'Fields are not allowed in Interfaces';
SParserInvalidRecordVisibility = 'Records can only have public and (strict) private as visibility specifiers';
SErrRecordConstantsNotAllowed = 'Record constants not allowed at this location.';
SErrRecordMethodsNotAllowed = 'Record methods not allowed at this location.';
SErrRecordPropertiesNotAllowed = 'Record properties not allowed at this location.';
SErrRecordVisibilityNotAllowed = 'Record visibilities not allowed at this location.';
@ -3804,6 +3805,7 @@ Var
Proc: TPasProcedure;
ProcType: TProcType;
Prop : TPasProperty;
Cons : TPasConst;
isClass : Boolean;
begin
@ -3813,6 +3815,14 @@ begin
begin
SaveComments;
Case CurToken of
tkConst:
begin
if Not AllowMethods then
ParseExc(SErrRecordConstantsNotAllowed);
ExpectToken(tkIdentifier);
Cons:=ParseConstDecl(ARec);
ARec.members.Add(Cons);
end;
tkClass:
begin
if Not AllowMethods then