mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 01:50:38 +01:00
* fixed handling of "type x = y" for objcclass/objcprotocol
* don't allow "type x = type y" for objcclass/objcprotocol for now
(would require generating new rtti for the new name)
git-svn-id: branches/objc@13641 -
This commit is contained in:
parent
1f1396596e
commit
ab3294dce2
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8222,6 +8222,7 @@ tests/test/tobjc11.pp svneol=native#text/plain
|
||||
tests/test/tobjc12.pp svneol=native#text/plain
|
||||
tests/test/tobjc13.pp svneol=native#text/plain
|
||||
tests/test/tobjc14.pp svneol=native#text/plain
|
||||
tests/test/tobjc15.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
|
||||
|
||||
@ -366,7 +366,7 @@ scan_w_multiple_main_name_overrides=02086_W_Overriding name of "main" procedure
|
||||
#
|
||||
# Parser
|
||||
#
|
||||
# 03262 is the last used one
|
||||
# 03263 is the last used one
|
||||
#
|
||||
% \section{Parser messages}
|
||||
% This section lists all parser messages. The parser takes care of the
|
||||
@ -1229,7 +1229,10 @@ parser_e_objc_message_name_changed=03262_E_Message name "$1" in inherited class
|
||||
% An overriding Objective-C method cannot have a different message name than an inherited method. The reason
|
||||
% is that these message names uniquely define the message to the Objective-C runtime, which means that
|
||||
% giving them a different message name breaks the ``override'' semantics.
|
||||
% \end{description}
|
||||
parser_e_no_objc_unique=03263_E_It is not yet possible to make unique copies of Objective-C types
|
||||
% Duplicating an Objective-C type using \var{type x = type y;} is not yet supported. You may be able to
|
||||
% obtain the desired effect using \var{type x = objcclass(y) end;} instead.
|
||||
%\end{description}
|
||||
|
||||
#
|
||||
# Type Checking
|
||||
|
||||
@ -350,6 +350,7 @@ const
|
||||
parser_e_must_use_override_objc=03260;
|
||||
parser_h_should_use_override_objc=03261;
|
||||
parser_e_objc_message_name_changed=03262;
|
||||
parser_e_no_objc_unique=03263;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -802,9 +803,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 52739;
|
||||
MsgTxtSize = 52813;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
24,87,263,90,65,51,108,22,202,62,
|
||||
24,87,264,90,65,51,108,22,202,62,
|
||||
47,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -443,10 +443,13 @@ implementation
|
||||
istyperenaming:=true;
|
||||
if isunique then
|
||||
begin
|
||||
if is_objc_class_or_protocol(hdef) then
|
||||
Message(parser_e_no_objc_unique);
|
||||
|
||||
hdef:=tstoreddef(hdef).getcopy;
|
||||
|
||||
{ fix name, it is used e.g. for tables }
|
||||
if is_class_or_interface_or_dispinterface_or_objc(hdef) then
|
||||
if is_class_or_interface_or_dispinterface(hdef) then
|
||||
with tobjectdef(hdef) do
|
||||
begin
|
||||
stringdispose(objname);
|
||||
@ -525,7 +528,7 @@ implementation
|
||||
{ In case of an objcclass, verify that all methods have a message
|
||||
name set. We only check this now, because message names can be set
|
||||
during the protocol (interface) mapping. At the same time, set the
|
||||
mangled names.
|
||||
mangled names (these depend on the "external" name of the class).
|
||||
}
|
||||
if is_objc_class_or_protocol(hdef) then
|
||||
tobjectdef(hdef).check_and_finish_messages;
|
||||
|
||||
@ -4390,7 +4390,15 @@ implementation
|
||||
depends on the (possibly external) class name, which is defined
|
||||
at the very end. }
|
||||
if (po_msgstr in pd.procoptions) then
|
||||
pd.setmangledname(pd.objcmangledname)
|
||||
begin
|
||||
{ Mangled name is already set in case this is a copy of
|
||||
another type. }
|
||||
if not(po_has_mangledname in pd.procoptions) then
|
||||
pd.setmangledname(pd.objcmangledname)
|
||||
else
|
||||
{ all checks already done }
|
||||
exit;
|
||||
end
|
||||
else
|
||||
MessagePos(pd.fileinfo,parser_e_objc_requires_msgstr);
|
||||
if not(oo_is_external in pd._class.objectoptions) then
|
||||
|
||||
17
tests/test/tobjc15.pp
Normal file
17
tests/test/tobjc15.pp
Normal file
@ -0,0 +1,17 @@
|
||||
{ %target=darwin }
|
||||
{ %cpu=powerpc,i386 }
|
||||
|
||||
{$mode objfpc}
|
||||
{$modeswitch objectivec1}
|
||||
|
||||
type
|
||||
ttest = NSObject;
|
||||
|
||||
var
|
||||
a: ttest;
|
||||
begin
|
||||
a:=ttest(ttest.alloc).init;
|
||||
if a._class<>NSObject.classClass then
|
||||
halt(1);
|
||||
a.release;
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user