X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/7a3459cee18e9e63919801c74175baab3e0ae0f8..cdff65f8e03d25cd3f782b264e15e596d2259857:/ObjectiveC/Library.mm?ds=sidebyside diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 3cf9e8a..742e3ef 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1068,7 +1068,7 @@ NSObject *CYCopyNSObject(CYPool &pool, JSContextRef context, JSValueRef value) { } - (NSString *) cy$toCYON:(bool)objective { - return [[self description] cy$toCYON:objective]; + return [@"#" stringByAppendingString:[[self description] cy$toCYON:true]]; } - (bool) cy$hasProperty:(NSString *)name { @@ -1109,6 +1109,19 @@ NSObject *CYCopyNSObject(CYPool &pool, JSContextRef context, JSValueRef value) { return [[self description] cy$toCYON:objective]; } +@end +/* }}} */ +/* Bridge: NSSet {{{ */ +@implementation NSSet (Cycript) + +- (NSString *) cy$toCYON:(bool)objective { + NSMutableString *json([[[NSMutableString alloc] init] autorelease]); + [json appendString:@"[NSSet setWithArray:"]; + [json appendString:CYCastNSCYON([self allObjects], true)]; + [json appendString:@"]]"]; + return json; +} + @end /* }}} */ /* Bridge: NSString {{{ */ @@ -2963,7 +2976,7 @@ void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry { CYSetProperty(context, cycript, CYJSString("objc_super"), Super); JSObjectRef box(JSObjectMakeFunctionWithCallback(context, CYJSString("box"), &Instance_box_callAsFunction)); - CYSetProperty(context, Instance, CYJSString("box"), box); + CYSetProperty(context, Instance, CYJSString("box"), box, kJSPropertyAttributeDontEnum); #ifdef __APPLE__ CYSetProperty(context, all, CYJSString("choose"), &choose, kJSPropertyAttributeDontEnum);