Просмотр исходного кода

* revert r34712: the behavior with the class constructors is indeed Delphi compatible. However only one class constructor/destructor per class is allowed no matter how it's named.

git-svn-id: trunk@34713 -
svenbarth 8 лет назад
Родитель
Сommit
254be82c43
5 измененных файлов с 2 добавлено и 57 удалено
  1. 0 2
      .gitattributes
  2. 1 7
      compiler/msg/errore.msg
  3. 1 8
      compiler/pdecsub.pas
  4. 0 20
      tests/webtbf/tw30729a.pp
  5. 0 20
      tests/webtbf/tw30729b.pp

+ 0 - 2
.gitattributes

@@ -13739,8 +13739,6 @@ tests/webtbf/tw3000.pp svneol=native#text/plain
 tests/webtbf/tw30022.pp svneol=native#text/plain
 tests/webtbf/tw3047.pp svneol=native#text/plain
 tests/webtbf/tw30494.pp svneol=native#text/pascal
-tests/webtbf/tw30729a.pp svneol=native#text/pascal
-tests/webtbf/tw30729b.pp svneol=native#text/pascal
 tests/webtbf/tw3114.pp svneol=native#text/plain
 tests/webtbf/tw3116.pp svneol=native#text/plain
 tests/webtbf/tw3126.pp svneol=native#text/plain

+ 1 - 7
compiler/msg/errore.msg

@@ -2004,7 +2004,7 @@ type_e_function_reference_kind=04123_E_Subroutine references cannot be declared
 #
 # Symtable
 #
-# 05097 is the last used one
+# 05095 is the last used one
 #
 % \section{Symbol handling}
 % This section lists all the messages that concern the handling of symbols.
@@ -2313,12 +2313,6 @@ sym_w_duplicate_id=05095_W_Duplicate identifier "$1"
 % same scope as the current identifier. This is a warning instead of an error,
 % because while this hides the identifier from the category, there are often
 % many unused categories in scope.
-sym_e_class_constructor_must_be_create=05096_E_Class constructor must be named "Create"
-% The name of a class constructor must be "Create" (case insensitive of course)
-% as there can be only one per class anyway.
-sym_e_class_destructor_must_be_destroy=05097_E_Class destructor must be named "Destroy"
-% The name of a class destructor must be "Destroy" (case insensitive of cours)
-% as there can be only one per class anyway.
 % \end{description}
 #
 # Codegenerator

+ 1 - 8
compiler/pdecsub.pas

@@ -1053,14 +1053,7 @@ implementation
                   end
                 else
                 if (potype in [potype_class_constructor,potype_class_destructor]) then
-                  begin
-                    sp:=lower(sp);
-                    if (potype=potype_class_constructor) and (sp<>'create') then
-                      message(sym_e_class_constructor_must_be_create);
-                    if (potype=potype_class_destructor) and (sp<>'destroy') then
-                      message(sym_e_class_destructor_must_be_destroy);
-                    aprocsym:=cprocsym.create('$'+sp)
-                  end
+                  aprocsym:=cprocsym.create('$'+lower(sp))
                 else
                   aprocsym:=cprocsym.create(orgsp);
                 symtablestack.top.insert(aprocsym);

+ 0 - 20
tests/webtbf/tw30729a.pp

@@ -1,20 +0,0 @@
-{ %FAIL }
-
-{ class constructors *must* be named "Create" }
-
-program tw30729a;
-
-{$mode objfpc}
-
-type
-  TTest = class
-    class constructor Create2;
-  end;
-
-class constructor TTest.Create2;
-begin
-end;
-
-begin
-
-end.

+ 0 - 20
tests/webtbf/tw30729b.pp

@@ -1,20 +0,0 @@
-{ %FAIL }
-
-{ class destructors *must* be named "Destroy" }
-
-program tw30729b;
-
-{$mode objfpc}
-
-type
-  TTest = class
-    class destructor Destroy2;
-  end;
-
-class destructor TTest.Destroy2;
-begin
-end;
-
-begin
-
-end.