ソースを参照

* 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 -

michael 8 年 前
コミット
f12c8a8adc
1 ファイル変更24 行追加8 行削除
  1. 24 8
      packages/fcl-passrc/src/pparser.pp

+ 24 - 8
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