From f12c8a8adcb295fe57ddac261571148773f12d1b Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 24 Mar 2017 12:10:22 +0000 Subject: [PATCH] * Patch from Mattias Gaertner - fixed procedure modifier public - fixed setting pmPublic when 'public' behind a procedure starts a class visibility section git-svn-id: trunk@35652 - --- packages/fcl-passrc/src/pparser.pp | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/packages/fcl-passrc/src/pparser.pp b/packages/fcl-passrc/src/pparser.pp index 3ca65afb64..d737869786 100644 --- a/packages/fcl-passrc/src/pparser.pp +++ b/packages/fcl-passrc/src/pparser.pp @@ -3425,11 +3425,19 @@ Var P : TPasProcedure; E : TPasExpr; -begin - if Parent is TPasProcedure then - P:=TPasProcedure(Parent); - if Assigned(P) then + procedure AddModifier; + begin + if pm in P.Modifiers then + ParseExcSyntaxError; P.AddModifier(pm); + end; + +begin + if not (Parent is TPasProcedure) then + exit; + P:=TPasProcedure(Parent); + if pm<>pmPublic then + AddModifier; Case pm of pmExternal: begin @@ -3470,14 +3478,22 @@ begin NextToken; { Should be token Name, if not we're in a class and the public section starts } - If (Uppercase(CurTokenString)<>'NAME') then + If not CurTokenIsIdentifier('name') then begin - UngetToken; - UngetToken; + if P.Parent is TPasClassType then + begin + // public section starts + UngetToken; + UngetToken; + exit; + end; + AddModifier; + CheckToken(tkSemicolon); exit; end else begin + AddModifier; NextToken; // Should be export name string. if not (CurToken in [tkString,tkIdentifier]) then ParseExcTokenError(TokenInfos[tkString]); @@ -3671,7 +3687,7 @@ begin UngetToken; Repeat NextToken; - If TokenisCallingConvention(CurTokenString,cc) then + If TokenIsCallingConvention(CurTokenString,cc) then begin Element.CallingConvention:=Cc; if cc = ccSysCall then