瀏覽代碼

compiler: allow to hide parent function identifier inside them (by a nested function with the same name or by a local variable). Fixes mantis #0024129.

git-svn-id: trunk@25420 -
paul 12 年之前
父節點
當前提交
1b81afcd42
共有 3 個文件被更改,包括 36 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 8 0
      compiler/pdecsub.pas
  3. 27 0
      tests/webtbs/tw24129.pp

+ 1 - 0
.gitattributes

@@ -13488,6 +13488,7 @@ tests/webtbs/tw2397.pp svneol=native#text/plain
 tests/webtbs/tw24007.pp svneol=native#text/plain
 tests/webtbs/tw24071.pp svneol=native#text/pascal
 tests/webtbs/tw2409.pp svneol=native#text/plain
+tests/webtbs/tw24129.pp svneol=native#text/pascal
 tests/webtbs/tw24131.pp svneol=native#text/plain
 tests/webtbs/tw24197.pp svneol=native#text/plain
 tests/webtbs/tw2421.pp svneol=native#text/plain

+ 8 - 0
compiler/pdecsub.pas

@@ -907,6 +907,14 @@ implementation
                         HideSym(srsym);
                         searchagain:=true;
                       end
+                     else
+                     if (m_delphi in current_settings.modeswitches) and
+                        (srsym.typ=absolutevarsym) and
+                        ([vo_is_funcret,vo_is_result]*tabstractvarsym(srsym).varoptions=[vo_is_funcret]) then
+                       begin
+                         HideSym(srsym);
+                         searchagain:=true;
+                       end
                      else
                       begin
                         {  we use a different error message for tp7 so it looks more compatible }

+ 27 - 0
tests/webtbs/tw24129.pp

@@ -0,0 +1,27 @@
+{%norun}
+program tw24129;
+
+{$mode delphi}
+procedure Test;
+
+  function Next: integer;
+    function Next: integer;
+      function Next: integer;
+      var
+        Next: integer;
+      begin
+
+      end;
+    begin
+
+    end;
+  begin
+
+  end;
+
+begin
+
+end;
+
+begin
+end.