* 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 -
This commit is contained in:
michael 2017-03-24 12:10:22 +00:00
parent 510352e121
commit f12c8a8adc

View File

@ -3425,11 +3425,19 @@ Var
P : TPasProcedure; P : TPasProcedure;
E : TPasExpr; E : TPasExpr;
begin procedure AddModifier;
if Parent is TPasProcedure then begin
P:=TPasProcedure(Parent); if pm in P.Modifiers then
if Assigned(P) then ParseExcSyntaxError;
P.AddModifier(pm); P.AddModifier(pm);
end;
begin
if not (Parent is TPasProcedure) then
exit;
P:=TPasProcedure(Parent);
if pm<>pmPublic then
AddModifier;
Case pm of Case pm of
pmExternal: pmExternal:
begin begin
@ -3470,14 +3478,22 @@ begin
NextToken; NextToken;
{ Should be token Name, { Should be token Name,
if not we're in a class and the public section starts } if not we're in a class and the public section starts }
If (Uppercase(CurTokenString)<>'NAME') then If not CurTokenIsIdentifier('name') then
begin begin
if P.Parent is TPasClassType then
begin
// public section starts
UngetToken; UngetToken;
UngetToken; UngetToken;
exit; exit;
end;
AddModifier;
CheckToken(tkSemicolon);
exit;
end end
else else
begin begin
AddModifier;
NextToken; // Should be export name string. NextToken; // Should be export name string.
if not (CurToken in [tkString,tkIdentifier]) then if not (CurToken in [tkString,tkIdentifier]) then
ParseExcTokenError(TokenInfos[tkString]); ParseExcTokenError(TokenInfos[tkString]);
@ -3671,7 +3687,7 @@ begin
UngetToken; UngetToken;
Repeat Repeat
NextToken; NextToken;
If TokenisCallingConvention(CurTokenString,cc) then If TokenIsCallingConvention(CurTokenString,cc) then
begin begin
Element.CallingConvention:=Cc; Element.CallingConvention:=Cc;
if cc = ccSysCall then if cc = ccSysCall then