diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2009-05-17 13:42:50 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2009-05-17 13:42:50 +0000 |
commit | 2cf647a2f4b191d62c52fac44f8cdf5eb415cdf4 (patch) | |
tree | f3d6dea68ac4b0eeefbe33374b98331daef761c7 /compiler/pdecl.pas | |
parent | a2ab589e4e8b2e0bfec7517caa16673f939120eb (diff) | |
download | fpc-2cf647a2f4b191d62c52fac44f8cdf5eb415cdf4.tar.gz |
* initial Objective-C 1.0 support:
o support for declaring external Objective-C classes (see
rtl/inc/objcbase.pas), including derived classes
o support for converting methods of objcclasses into selectors
(see tests/test/tobjc1.pp)
o support for loading from/storing to fields of objcclasses
o support for calling Objective-C methods using regular
Object Pascal syntax (see tests/test/tobjc1.pp)
o some things that are known to be not yet working:
o automatic conversion from ID to objcclasses and back
o declaring and implementing new objcclasses/methods in Pascal code
o debug information (objcclasses are currently plain pointers
as far as the debugger knows)
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/objc@13162 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/pdecl.pas')
-rw-r--r-- | compiler/pdecl.pas | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 5e6c4e767c..a125e722ee 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -278,6 +278,22 @@ implementation procedure types_dec; + procedure finish_objc_class(od: tobjectdef); + begin + { Objective-C classes can be external -> all messages inside are + external (defined at the class level instead of per method, so + that you cannot define some methods as external and some not) + } + if (token = _ID) and + (idtoken = _EXTERNAL) then + begin + consume(_EXTERNAL); + consume(_SEMICOLON); + od.make_all_methods_external; + end; + end; + + function parse_generic_parameters:TFPObjectList; var generictype : ttypesym; @@ -361,7 +377,8 @@ implementation begin if ((token=_CLASS) or (token=_INTERFACE) or - (token=_DISPINTERFACE)) and + (token=_DISPINTERFACE) or + (token=_OBJCCLASS)) and (assigned(ttypesym(sym).typedef)) and is_class_or_interface_or_dispinterface(ttypesym(sym).typedef) and (oo_is_forward in tobjectdef(ttypesym(sym).typedef).objectoptions) then @@ -376,6 +393,8 @@ implementation objecttype:=odt_interfacecorba; _DISPINTERFACE : objecttype:=odt_dispinterface; + _OBJCCLASS : + objecttype:=odt_objcclass; else internalerror(200811072); end; @@ -473,7 +492,8 @@ implementation { Build VMT indexes, skip for type renaming and forward classes } if (hdef.typesym=newtype) and not(oo_is_forward in tobjectdef(hdef).objectoptions) and - not(df_generic in hdef.defoptions) then + not(df_generic in hdef.defoptions) and + not is_objcclass(hdef) then begin vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef)); vmtbuilder.generate_vmt; @@ -481,6 +501,9 @@ implementation end; try_consume_hintdirective(newtype.symoptions); consume(_SEMICOLON); + + if is_objcclass(hdef) then + finish_objc_class(tobjectdef(hdef)); end; recorddef : begin |