* 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 -
This commit is contained in:
svenbarth 2016-10-13 20:11:35 +00:00
parent 4e5ed5b0e2
commit 254be82c43
5 changed files with 2 additions and 57 deletions

2
.gitattributes vendored
View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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.

View File

@ -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.