mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:14:25 +02:00
* support the "overload" modifier for Objective-C methods
* only check whether the message identifier of an Objective-C method matches the one from a method with the same name in a parent class if the parameters match (todo: should be refined to "if the encoded Objective-C selector names match") git-svn-id: trunk@22373 -
This commit is contained in:
parent
0e1b582131
commit
fe90823b01
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10980,6 +10980,7 @@ tests/test/tobjc37.pp svneol=native#text/plain
|
|||||||
tests/test/tobjc38.pp svneol=native#text/plain
|
tests/test/tobjc38.pp svneol=native#text/plain
|
||||||
tests/test/tobjc39.pp svneol=native#text/plain
|
tests/test/tobjc39.pp svneol=native#text/plain
|
||||||
tests/test/tobjc4.pp svneol=native#text/plain
|
tests/test/tobjc4.pp svneol=native#text/plain
|
||||||
|
tests/test/tobjc40.pp svneol=native#text/plain
|
||||||
tests/test/tobjc4a.pp svneol=native#text/plain
|
tests/test/tobjc4a.pp svneol=native#text/plain
|
||||||
tests/test/tobjc5.pp svneol=native#text/plain
|
tests/test/tobjc5.pp svneol=native#text/plain
|
||||||
tests/test/tobjc5a.pp svneol=native#text/plain
|
tests/test/tobjc5a.pp svneol=native#text/plain
|
||||||
|
@ -333,22 +333,29 @@ implementation
|
|||||||
automated header translation tools too complex.
|
automated header translation tools too complex.
|
||||||
|
|
||||||
The same goes for Java. }
|
The same goes for Java. }
|
||||||
if not(oo_is_external in _class.objectoptions) then
|
{$ifndef jvm}
|
||||||
if not is_objccategory(_class) then
|
if hasequalpara then
|
||||||
MessagePos1(pd.fileinfo,parser_e_must_use_override,FullTypeName(tdef(vmtpd.owner.defowner),nil))
|
{$endif}
|
||||||
else
|
begin
|
||||||
MessagePos1(pd.fileinfo,parser_e_must_use_reintroduce_objc,FullTypeName(tdef(vmtpd.owner.defowner),nil))
|
if not(oo_is_external in _class.objectoptions) then
|
||||||
{ there may be a lot of these in auto-translated
|
if not is_objccategory(_class) then
|
||||||
headers, so only calculate the fulltypename if
|
MessagePos1(pd.fileinfo,parser_e_must_use_override,FullTypeName(tdef(vmtpd.owner.defowner),nil))
|
||||||
the hint will be shown }
|
else
|
||||||
else if CheckVerbosity(V_Hint) then
|
MessagePos1(pd.fileinfo,parser_e_must_use_reintroduce_objc,FullTypeName(tdef(vmtpd.owner.defowner),nil))
|
||||||
if not is_objccategory(_class) then
|
{ there may be a lot of these in auto-translated
|
||||||
MessagePos1(pd.fileinfo,parser_h_should_use_override,FullTypeName(tdef(vmtpd.owner.defowner),nil))
|
headers, so only calculate the fulltypename if
|
||||||
else
|
the hint will be shown }
|
||||||
MessagePos1(pd.fileinfo,parser_h_should_use_reintroduce_objc,FullTypeName(tdef(vmtpd.owner.defowner),nil));
|
else if CheckVerbosity(V_Hint) then
|
||||||
|
if not is_objccategory(_class) then
|
||||||
|
MessagePos1(pd.fileinfo,parser_h_should_use_override,FullTypeName(tdef(vmtpd.owner.defowner),nil))
|
||||||
|
else
|
||||||
|
MessagePos1(pd.fileinfo,parser_h_should_use_reintroduce_objc,FullTypeName(tdef(vmtpd.owner.defowner),nil));
|
||||||
|
end;
|
||||||
{ no new entry, but copy the message name if any from
|
{ no new entry, but copy the message name if any from
|
||||||
the procdef in the parent class }
|
the procdef in the parent class }
|
||||||
check_msg_str(vmtpd,pd);
|
if not is_objc_class_or_protocol(_class) or
|
||||||
|
hasequalpara then
|
||||||
|
check_msg_str(vmtpd,pd);
|
||||||
if updatevalues then
|
if updatevalues then
|
||||||
begin
|
begin
|
||||||
{ in case of Java, copy the real name from the parent,
|
{ in case of Java, copy the real name from the parent,
|
||||||
|
@ -2259,7 +2259,7 @@ const
|
|||||||
mutexclpo : []
|
mutexclpo : []
|
||||||
),(
|
),(
|
||||||
idtok:_OVERLOAD;
|
idtok:_OVERLOAD;
|
||||||
pd_flags : [pd_implemen,pd_interface,pd_body,pd_javaclass,pd_intfjava];
|
pd_flags : [pd_implemen,pd_interface,pd_body,pd_javaclass,pd_intfjava,pd_objcclass,pd_objcprot];
|
||||||
handler : @pd_overload;
|
handler : @pd_overload;
|
||||||
pocall : pocall_none;
|
pocall : pocall_none;
|
||||||
pooption : [po_overload];
|
pooption : [po_overload];
|
||||||
|
29
tests/test/tobjc40.pp
Normal file
29
tests/test/tobjc40.pp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{ %target=darwin }
|
||||||
|
{ %opt=norun }
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$modeswitch objectivec1}
|
||||||
|
program Main;
|
||||||
|
|
||||||
|
type
|
||||||
|
NSView = objcclass(NSObject)
|
||||||
|
procedure setNeedsDisplay (flag: boolean); message 'setNeedsDisplay:';
|
||||||
|
end;
|
||||||
|
|
||||||
|
type
|
||||||
|
NSViewUtilities = objccategory (NSView)
|
||||||
|
procedure setNeedsDisplay; message 'setNeedsDisplay'; overload;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSView.setNeedsDisplay (flag: boolean);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSViewUtilities.setNeedsDisplay;
|
||||||
|
begin
|
||||||
|
setNeedsDisplay(true);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user