mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 20:59:42 +02:00
fcl-passrc: fixed allow advanced record visibility in local records
git-svn-id: trunk@43286 -
This commit is contained in:
parent
ddcb2d80af
commit
e54796472a
@ -6715,8 +6715,10 @@ Var
|
||||
OldCount, i: Integer;
|
||||
CurEl: TPasElement;
|
||||
LastToken: TToken;
|
||||
AllowVisibility: Boolean;
|
||||
begin
|
||||
if AllowMethods then
|
||||
AllowVisibility:=msAdvancedRecords in CurrentModeswitches;
|
||||
if AllowVisibility then
|
||||
v:=visPublic
|
||||
else
|
||||
v:=visDefault;
|
||||
@ -6806,7 +6808,7 @@ begin
|
||||
tkGeneric,tkSelf, // Counts as field name
|
||||
tkIdentifier :
|
||||
begin
|
||||
If AllowMethods and CheckVisibility(CurTokenString,v) then
|
||||
If AllowVisibility and CheckVisibility(CurTokenString,v) then
|
||||
begin
|
||||
if not (v in [visPrivate,visPublic,visStrictPrivate]) then
|
||||
ParseExc(nParserInvalidRecordVisibility,SParserInvalidRecordVisibility);
|
||||
@ -6877,11 +6879,9 @@ begin
|
||||
try
|
||||
Result.PackMode:=PackMode;
|
||||
NextToken;
|
||||
allowAdvanced:=(msAdvancedRecords in Scanner.CurrentModeSwitches);
|
||||
// not allowed in anonymous procedures
|
||||
if (Parent is TProcedureBody) then
|
||||
if TProcedureBody(Parent).Parent is TPasAnonymousProcedure then
|
||||
allowAdvanced:=False;
|
||||
allowAdvanced:=(msAdvancedRecords in Scanner.CurrentModeSwitches)
|
||||
and not (Parent is TProcedureBody)
|
||||
and (Result.Name<>'');
|
||||
ParseRecordMembers(Result,tkEnd,allowAdvanced);
|
||||
Engine.FinishScope(stTypeDef,Result);
|
||||
ok:=true;
|
||||
|
@ -2637,7 +2637,8 @@ end;
|
||||
|
||||
procedure TTestRecordTypeParser.TestAdvRecordInAnonFunction;
|
||||
|
||||
// Src from bug report 36179, modified to put record in anonymous function - not allowed !
|
||||
// Src from bug report 36179, modified to put record in anonymous function
|
||||
// Delphi 10.3.2 allows this
|
||||
|
||||
Const
|
||||
Src =
|
||||
@ -2659,7 +2660,7 @@ Const
|
||||
|
||||
begin
|
||||
Source.Text:=Src;
|
||||
AssertException('Advanced records not allowed in anonymous function',EParserError,@ParseModule);
|
||||
ParseModule; // We're just interested in that it parses.
|
||||
end;
|
||||
|
||||
procedure TTestRecordTypeParser.TestAdvRecordClassOperator;
|
||||
|
Loading…
Reference in New Issue
Block a user