Browse Source

* always interpret a function name on the RHS as a recursive function
call in MacPas mode, like in TP/Delphi (mantis #22344)

git-svn-id: trunk@21817 -

Jonas Maebe 13 years ago
parent
commit
1b3b097f3a
3 changed files with 26 additions and 4 deletions
  1. 1 0
      .gitattributes
  2. 1 4
      compiler/pexpr.pas
  3. 24 0
      tests/webtbs/tw22344.pp

+ 1 - 0
.gitattributes

@@ -12672,6 +12672,7 @@ tests/webtbs/tw22326.pp svneol=native#text/plain
 tests/webtbs/tw22329.pp svneol=native#text/pascal
 tests/webtbs/tw22329.pp svneol=native#text/pascal
 tests/webtbs/tw2233.pp svneol=native#text/plain
 tests/webtbs/tw2233.pp svneol=native#text/plain
 tests/webtbs/tw22331.pp svneol=native#text/plain
 tests/webtbs/tw22331.pp svneol=native#text/plain
+tests/webtbs/tw22344.pp svneol=native#text/plain
 tests/webtbs/tw2242.pp svneol=native#text/plain
 tests/webtbs/tw2242.pp svneol=native#text/plain
 tests/webtbs/tw2250.pp svneol=native#text/plain
 tests/webtbs/tw2250.pp svneol=native#text/plain
 tests/webtbs/tw2259.pp svneol=native#text/plain
 tests/webtbs/tw2259.pp svneol=native#text/plain

+ 1 - 4
compiler/pexpr.pas

@@ -2199,10 +2199,7 @@ implementation
               (
               (
                (token=_LKLAMMER) or
                (token=_LKLAMMER) or
                (
                (
-                (
-                 (m_tp7 in current_settings.modeswitches) or
-                 (m_delphi in current_settings.modeswitches)
-                ) and
+                (([m_tp7,m_delphi,m_mac] * current_settings.modeswitches) <> []) and
                 (afterassignment or in_args)
                 (afterassignment or in_args)
                )
                )
               ) then
               ) then

+ 24 - 0
tests/webtbs/tw22344.pp

@@ -0,0 +1,24 @@
+program showbug ;
+
+{$mode macpas}
+
+var
+  glob: integer;
+
+function countchars: INTEGER ;
+begin
+  countchars:=255;
+  if glob=5 then
+    countchars := 0
+  else
+    begin
+      inc(glob);
+      countchars := 1 + countchars
+    end
+  end;
+
+begin
+  if countchars<>5 then
+    halt(1);
+end .
+