+@end
+
+static const char *CYBlockEncoding(NSBlock *self);
+static bool CYBlockSignature(CYPool &pool, NSBlock *self, sig::Signature &signature);
+
+@implementation NSBlock (Cycript)
+
+- (NSString *) cy$toCYON:(bool)objective inSet:(std::set<void *> &)objects {
+ CYLocalPool pool;
+
+ sig::Block type;
+ if (!CYBlockSignature(pool, self, type.signature))
+ return [super cy$toCYON:objective inSet:objects];
+ _oassert(objects.insert(self).second);
+
+ CYType *typed((new(pool) CYTypeExpression(CYDecodeType(pool, &type)))->typed_);
+ CYTypeModifier *&modifier(CYGetLast(typed->modifier_));
+ CYTypeBlockWith *with(dynamic_cast<CYTypeBlockWith *>(modifier));
+ _assert(with != NULL);
+ CYObjCBlock *block(new(pool) CYObjCBlock(typed, with->parameters_, NULL));
+ modifier = NULL;
+
+ std::ostringstream str;
+ CYOptions options;
+ CYOutput out(*str.rdbuf(), options);
+ block->Output(out, CYNoFlags);
+
+ std::string value(str.str());
+ return CYCastNSString(NULL, CYUTF8String(value.c_str(), value.size()));
+}
+