clean up. disable method type verification for debugging

db4
Joe Groff 2008-09-08 22:09:05 -07:00
parent 3958798934
commit 593f25fde4
2 changed files with 14 additions and 17 deletions

View File

@ -102,15 +102,6 @@ MACRO: (send) ( selector super? -- quot )
: objc-meta-class ( string -- class )
\ objc_getMetaClass (objc-class) ;
USE: prettyprint
: (.) ( foo bar -- foo )
. dup . ;
: method-arg-type ( method i -- type )
method_copyArgumentType
[ ascii alien>string parse-objc-type ] keep
(free) ;
SYMBOL: objc>alien-types
H{
@ -164,6 +155,11 @@ H{
: parse-objc-type ( string -- ctype ) 0 swap (parse-objc-type) ;
: method-arg-type ( method i -- type )
method_copyArgumentType
[ ascii alien>string parse-objc-type ] keep
(free) ;
: method-arg-types ( method -- args )
dup method_getNumberOfArguments
[ method-arg-type ] with map ;

View File

@ -43,16 +43,17 @@ IN: cocoa.subclassing
: types= ( a b -- ? )
[ ascii alien>string ] bi@ = ;
: (verify-method-type) ( class sel types -- )
[ class_getInstanceMethod method_getTypeEncoding ]
dip types=
[ "Objective-C method types cannot be changed once defined" throw ]
unless ;
: verify-method-type ( class sel imp types -- class sel imp types )
4 ndup nip (verify-method-type) ;
! : (verify-method-type) ( class sel types -- )
! [ class_getInstanceMethod method_getTypeEncoding ]
! dip types=
! [ "Objective-C method types cannot be changed once defined" throw ]
! unless ;
! : verify-method-type ( class sel imp types -- class sel imp types )
! 4 ndup nip (verify-method-type) ;
: (redefine-objc-method) ( class method -- )
init-method verify-method-type drop
init-method ! verify-method-type
drop
[ class_getInstanceMethod ] dip method_setImplementation drop ;
: redefine-objc-methods ( imeth name -- )