mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:29:14 +02:00
* 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:
parent
4e5ed5b0e2
commit
254be82c43
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -13739,8 +13739,6 @@ tests/webtbf/tw3000.pp svneol=native#text/plain
|
|||||||
tests/webtbf/tw30022.pp svneol=native#text/plain
|
tests/webtbf/tw30022.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw3047.pp svneol=native#text/plain
|
tests/webtbf/tw3047.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw30494.pp svneol=native#text/pascal
|
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/tw3114.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw3116.pp svneol=native#text/plain
|
tests/webtbf/tw3116.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw3126.pp svneol=native#text/plain
|
tests/webtbf/tw3126.pp svneol=native#text/plain
|
||||||
|
@ -2004,7 +2004,7 @@ type_e_function_reference_kind=04123_E_Subroutine references cannot be declared
|
|||||||
#
|
#
|
||||||
# Symtable
|
# Symtable
|
||||||
#
|
#
|
||||||
# 05097 is the last used one
|
# 05095 is the last used one
|
||||||
#
|
#
|
||||||
% \section{Symbol handling}
|
% \section{Symbol handling}
|
||||||
% This section lists all the messages that concern the handling of symbols.
|
% 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,
|
% 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
|
% because while this hides the identifier from the category, there are often
|
||||||
% many unused categories in scope.
|
% 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}
|
% \end{description}
|
||||||
#
|
#
|
||||||
# Codegenerator
|
# Codegenerator
|
||||||
|
@ -1053,14 +1053,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (potype in [potype_class_constructor,potype_class_destructor]) then
|
if (potype in [potype_class_constructor,potype_class_destructor]) then
|
||||||
begin
|
aprocsym:=cprocsym.create('$'+lower(sp))
|
||||||
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
|
|
||||||
else
|
else
|
||||||
aprocsym:=cprocsym.create(orgsp);
|
aprocsym:=cprocsym.create(orgsp);
|
||||||
symtablestack.top.insert(aprocsym);
|
symtablestack.top.insert(aprocsym);
|
||||||
|
@ -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.
|
|
@ -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.
|
|
Loading…
Reference in New Issue
Block a user