clean up. disable method type verification for debugging
parent
3958798934
commit
593f25fde4
|
@ -102,15 +102,6 @@ MACRO: (send) ( selector super? -- quot )
|
||||||
: objc-meta-class ( string -- class )
|
: objc-meta-class ( string -- class )
|
||||||
\ objc_getMetaClass (objc-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
|
SYMBOL: objc>alien-types
|
||||||
|
|
||||||
H{
|
H{
|
||||||
|
@ -164,6 +155,11 @@ H{
|
||||||
|
|
||||||
: parse-objc-type ( string -- ctype ) 0 swap (parse-objc-type) ;
|
: 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 )
|
: method-arg-types ( method -- args )
|
||||||
dup method_getNumberOfArguments
|
dup method_getNumberOfArguments
|
||||||
[ method-arg-type ] with map ;
|
[ method-arg-type ] with map ;
|
||||||
|
|
|
@ -43,16 +43,17 @@ IN: cocoa.subclassing
|
||||||
: types= ( a b -- ? )
|
: types= ( a b -- ? )
|
||||||
[ ascii alien>string ] bi@ = ;
|
[ ascii alien>string ] bi@ = ;
|
||||||
|
|
||||||
: (verify-method-type) ( class sel types -- )
|
! : (verify-method-type) ( class sel types -- )
|
||||||
[ class_getInstanceMethod method_getTypeEncoding ]
|
! [ class_getInstanceMethod method_getTypeEncoding ]
|
||||||
dip types=
|
! dip types=
|
||||||
[ "Objective-C method types cannot be changed once defined" throw ]
|
! [ "Objective-C method types cannot be changed once defined" throw ]
|
||||||
unless ;
|
! unless ;
|
||||||
: verify-method-type ( class sel imp types -- class sel imp types )
|
! : verify-method-type ( class sel imp types -- class sel imp types )
|
||||||
4 ndup nip (verify-method-type) ;
|
! 4 ndup nip (verify-method-type) ;
|
||||||
|
|
||||||
: (redefine-objc-method) ( class method -- )
|
: (redefine-objc-method) ( class method -- )
|
||||||
init-method verify-method-type drop
|
init-method ! verify-method-type
|
||||||
|
drop
|
||||||
[ class_getInstanceMethod ] dip method_setImplementation drop ;
|
[ class_getInstanceMethod ] dip method_setImplementation drop ;
|
||||||
|
|
||||||
: redefine-objc-methods ( imeth name -- )
|
: redefine-objc-methods ( imeth name -- )
|
||||||
|
|
Loading…
Reference in New Issue