Browse Source

* only check for _PROPERTY as a regular token, so that
{$modeswitch properties-} also affects global properties
(mantis #25861)

git-svn-id: trunk@27758 -

Jonas Maebe 11 years ago
parent
commit
362ff5ad01
3 changed files with 17 additions and 8 deletions
  1. 1 0
      .gitattributes
  2. 8 8
      compiler/psub.pas
  3. 8 0
      tests/webtbf/tw25861.pp

+ 1 - 0
.gitattributes

@@ -12734,6 +12734,7 @@ tests/webtbf/tw2562.pp svneol=native#text/plain
 tests/webtbf/tw25622.pp svneol=native#text/plain
 tests/webtbf/tw25622a.pp svneol=native#text/plain
 tests/webtbf/tw25788.pp svneol=native#text/pascal
+tests/webtbf/tw25861.pp svneol=native#text/plain
 tests/webtbf/tw25862.pp svneol=native#text/plain
 tests/webtbf/tw25915.pp svneol=native#text/pascal
 tests/webtbf/tw25951.pp svneol=native#text/pascal

+ 8 - 8
compiler/psub.pas

@@ -2210,7 +2210,14 @@ implementation
                         Message(parser_w_unsupported_feature);
                         consume(_BEGIN);
                      end;
-                end
+                end;
+              _PROPERTY:
+                begin
+                  if (m_fpc in current_settings.modeswitches) then
+                    property_dec
+                  else
+                    break;
+                end;
               else
                 begin
                   case idtoken of
@@ -2233,13 +2240,6 @@ implementation
                         else
                           break;
                       end;
-                    _PROPERTY:
-                      begin
-                        if (m_fpc in current_settings.modeswitches) then
-                          property_dec
-                        else
-                          break;
-                      end;
                     else
                       break;
                   end;

+ 8 - 0
tests/webtbf/tw25861.pp

@@ -0,0 +1,8 @@
+{ %fail }
+
+{$MODE OBJFPC} {$MODESWITCH PROPERTIES-}
+program test;
+function GetBar(): Cardinal; begin Result := 0; end;
+property Bar: Cardinal read GetBar;
+begin Writeln(Bar); end.
+