* don't automatically set the parent class of objcclasses without a

designated parent to NSObject, because you can have multiple root classes
    (e.g., NSProxy is also an Objective-C root class in Cocoa). Instead,
    give a hint when an Objective-C class is declared without any parent
    (because it can very well be a mistake, given that Pascal classes all
    do automatically inherit form TObject).

git-svn-id: branches/objc@13177 -
This commit is contained in:
Jonas Maebe 2009-05-19 20:19:11 +00:00
parent 5691da116f
commit ba2c2cd449
4 changed files with 17 additions and 13 deletions

1
.gitattributes vendored
View File

@ -7917,6 +7917,7 @@ tests/test/tmsg4.pp svneol=native#text/plain
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/tobject1.pp svneol=native#text/plain
tests/test/tobject2.pp svneol=native#text/plain
tests/test/tobject3.pp svneol=native#text/plain

View File

@ -299,8 +299,7 @@ implementation
if current_objectdef<>interface_iunknown then
childof:=interface_iunknown;
odt_objcclass:
if current_objectdef<>objcclass_nsobject then
childof:=objcclass_nsobject;
CGMessage(parser_h_no_objc_parent);
end;
end;

View File

@ -667,7 +667,6 @@ interface
objc_superclasstype,
objc_idtype,
objc_seltype : tpointerdef;
objcclass_nsobject : tobjectdef;
const
{$ifdef i386}
@ -3715,12 +3714,6 @@ implementation
else
ImplementedInterfaces:=nil;
writing_class_record_dbginfo:=false;
{ make NSObject immediately known in the same unit }
if (childof=nil) and
(objecttype=odt_objcclass) and
(objrealname^='NSObject') then
objcclass_nsobject:=self;
end;
@ -3797,10 +3790,6 @@ implementation
(objecttype=odt_interfacecom) and
(objname^='IUNKNOWN') then
interface_iunknown:=self;
if (childof=nil) and
(objecttype=odt_objcclass) and
(objrealname^='NSObject') then
objcclass_nsobject:=self;
writing_class_record_dbginfo:=false;
end;

15
tests/test/tobjc3.pp Normal file
View File

@ -0,0 +1,15 @@
{ %fail }
{ %opt=-vh -Seh }
{ %target=darwin }
{ %cpu=powerpc,i386 }
{$modeswitch objectivec1}
type
{ should produce a hint that ta does not automatically derive from any
other class }
ta = objcclass
end; external;
begin
end.