Przeglądaj źródła

* ignore the name of class con- and destructors (patch by Ondrej Pokorny,
mantis #28801)

git-svn-id: trunk@32223 -

Jonas Maebe 9 lat temu
rodzic
commit
f004227d91
3 zmienionych plików z 35 dodań i 0 usunięć
  1. 1 0
      .gitattributes
  2. 7 0
      compiler/pdecsub.pas
  3. 27 0
      tests/webtbs/tw28801.pp

+ 1 - 0
.gitattributes

@@ -14811,6 +14811,7 @@ tests/webtbs/tw28718d.pp svneol=native#text/plain
 tests/webtbs/tw28748.pp svneol=native#text/plain
 tests/webtbs/tw2876.pp svneol=native#text/plain
 tests/webtbs/tw28766.pp svneol=native#text/pascal
+tests/webtbs/tw28801.pp svneol=native#text/plain
 tests/webtbs/tw2883.pp svneol=native#text/plain
 tests/webtbs/tw2885.pp svneol=native#text/plain
 tests/webtbs/tw28850.pp svneol=native#text/plain

+ 7 - 0
compiler/pdecsub.pas

@@ -973,6 +973,13 @@ implementation
                  Message(parser_e_only_methods_allowed);
 
                repeat
+                 { only 1 class constructor and destructor is allowed in the class and
+                   the check was already done with oo_has_class_constructor or
+                   oo_has_class_destructor -> skip searching
+                   (bug #28801) }
+                 if (potype in [potype_class_constructor,potype_class_destructor]) then
+                   break;
+
                  searchagain:=false;
                  current_tokenpos:=procstartfilepos;
 

+ 27 - 0
tests/webtbs/tw28801.pp

@@ -0,0 +1,27 @@
+program project1;
+
+{$mode delphi}
+
+type
+  TTest = class
+    public
+      destructor Destroy; override;
+      class destructor Destroy;
+  end;
+
+{ TTest }
+
+
+class destructor TTest.Destroy;
+begin
+  exitcode:=0;
+end;
+
+destructor TTest.Destroy;
+begin
+
+end;
+
+begin
+  halt(1);
+end.