mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 14:19:31 +02:00
* fixed check for forbidding constructors/destructors in objcclasses + tests
git-svn-id: branches/objc@13179 -
This commit is contained in:
parent
27b3689f60
commit
27afdbf94a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -7918,6 +7918,8 @@ tests/test/tmt1.pp svneol=native#text/plain
|
||||
tests/test/tobjc1.pp svneol=native#text/plain
|
||||
tests/test/tobjc2.pp svneol=native#text/plain
|
||||
tests/test/tobjc3.pp svneol=native#text/plain
|
||||
tests/test/tobjc4.pp svneol=native#text/plain
|
||||
tests/test/tobjc4a.pp svneol=native#text/plain
|
||||
tests/test/tobject1.pp svneol=native#text/plain
|
||||
tests/test/tobject2.pp svneol=native#text/plain
|
||||
tests/test/tobject3.pp svneol=native#text/plain
|
||||
|
@ -1181,7 +1181,7 @@ parser_e_objc_requires_msgstr=03251_E_Objective-C messages require their Objecti
|
||||
% While bindings to other languages automatically generate such names based on the identifier you use (by replacing
|
||||
% all underscores with colons), this is unsafe since nothing prevents an Objective-C method name to contain actual
|
||||
% colons.
|
||||
parser_e_objc_no_constructor_destructor=03252_E_Objective-C does not have formal constructors or destructors. Use initXXX and the dealloc instance methods.
|
||||
parser_e_objc_no_constructor_destructor=03252_E_Objective-C does not have formal constructors nor destructors. Use the alloc, initXXX and dealloc messages.
|
||||
% The Objective-C language does not have any constructors or destructors. While there are some messages with a similar
|
||||
% purpose (such as \var{init} and \var{dealloc}), these cannot be identified using automatic parsers and do not
|
||||
% guarantee anything like Pascal constructors/destructors (e.g., you have to take care of only calling ``designated''
|
||||
|
@ -390,8 +390,8 @@ const msgtxt : array[0..000215,1..240] of char=(
|
||||
'ass $3 ($4)'#000+
|
||||
'03251_E_Objective-C messages require their Objec','tive-C selector name'+
|
||||
' to be specified using the "message" directive.'#000+
|
||||
'03252_E_Objective-C does not have formal constructors or destructors. '+
|
||||
'Use initXXX and the dealloc instance methods.'#000+
|
||||
'03252_E_Objective-C does not have formal constructors nor destructors.'+
|
||||
' Use the alloc, initXXX and dealloc messages.'#000+
|
||||
'03253_E_Message name is too long (max. 255 characters)'#000+
|
||||
'0','3254_E_Objective-C message symbol name for "$1" is too long'#000+
|
||||
'03255_H_Defining a new Objective-C root class. To derive from another '+
|
||||
|
@ -584,6 +584,10 @@ implementation
|
||||
if is_interface(current_objectdef) then
|
||||
Message(parser_e_no_con_des_in_interfaces);
|
||||
|
||||
{ Objective-C does not know the concept of a constructor }
|
||||
if is_objcclass(current_objectdef) then
|
||||
Message(parser_e_objc_no_constructor_destructor);
|
||||
|
||||
oldparse_only:=parse_only;
|
||||
parse_only:=true;
|
||||
pd:=constructor_head;
|
||||
@ -617,6 +621,10 @@ implementation
|
||||
if (current_objectdef.symtable.currentvisibility<>vis_public) then
|
||||
Message(parser_w_destructor_should_be_public);
|
||||
|
||||
{ Objective-C does not know the concept of a destructor }
|
||||
if is_objcclass(current_objectdef) then
|
||||
Message(parser_e_objc_no_constructor_destructor);
|
||||
|
||||
oldparse_only:=parse_only;
|
||||
parse_only:=true;
|
||||
pd:=destructor_head;
|
||||
|
@ -1028,9 +1028,6 @@ implementation
|
||||
|
||||
_CONSTRUCTOR :
|
||||
begin
|
||||
{ Objective-C does not know the concept of a constructor }
|
||||
if is_objcclass(aclass) then
|
||||
Message(parser_e_objc_no_constructor_destructor);
|
||||
consume(_CONSTRUCTOR);
|
||||
parse_proc_head(aclass,potype_constructor,pd);
|
||||
if assigned(pd) and
|
||||
@ -1051,9 +1048,6 @@ implementation
|
||||
|
||||
_DESTRUCTOR :
|
||||
begin
|
||||
{ Objective-C does not know the concept of a destructor }
|
||||
if is_objcclass(aclass) then
|
||||
Message(parser_e_objc_no_constructor_destructor);
|
||||
consume(_DESTRUCTOR);
|
||||
parse_proc_head(aclass,potype_destructor,pd);
|
||||
if assigned(pd) then
|
||||
|
14
tests/test/tobjc4.pp
Normal file
14
tests/test/tobjc4.pp
Normal file
@ -0,0 +1,14 @@
|
||||
{ %fail }
|
||||
{ %target=darwin }
|
||||
{ %cpu=powerpc,i386 }
|
||||
|
||||
{$modeswitch objectivec1}
|
||||
|
||||
type
|
||||
ta = objcclass
|
||||
{ no constructors in Objective-C }
|
||||
constructor create;
|
||||
end; external;
|
||||
|
||||
begin
|
||||
end.
|
14
tests/test/tobjc4a.pp
Normal file
14
tests/test/tobjc4a.pp
Normal file
@ -0,0 +1,14 @@
|
||||
{ %fail }
|
||||
{ %target=darwin }
|
||||
{ %cpu=powerpc,i386 }
|
||||
|
||||
{$modeswitch objectivec1}
|
||||
|
||||
type
|
||||
ta = objcclass
|
||||
{ no destructors in Objective-C }
|
||||
destructor done;
|
||||
end; external;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user