}
Instance::~Instance() {
- if ((flags_ & Transient) == 0)
+ if ((flags_ & Permanent) == 0)
[GetValue() release];
}
}
};
-JSObjectRef CYMakeInstance(JSContextRef context, id object, bool transient) {
+JSObjectRef CYMakeInstance(JSContextRef context, id object, bool permanent) {
Instance::Flags flags;
- if (transient)
- flags = Instance::Transient;
+ if (permanent)
+ flags = Instance::Permanent;
else {
flags = Instance::None;
object = [object retain];
if (!CYIsClass(value))
CYThrow("non-Class object cannot be used as Type");
- // XXX: this is a very silly implementation
-
- std::ostringstream type;
- type << "@\"";
- type << class_getName(value);
- type << "\"";
-
- CYPoolTry {
- return CYMakeType(context, type.str().c_str());
- } CYPoolCatch(NULL)
+ sig::Type type;
+ memset(&type, 0, sizeof(type));
+ type.primitive = sig::object_P;
+ type.name = class_getName(value);
+ return CYMakeType(context, &type);
} CYCatch(NULL) return /*XXX*/ NULL; }
static JSValueRef Selector_callAsFunction_toString(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
CYPool &pool(CYGetGlobalPool());
- Object_type = new(pool) Type_privateData("@");
- Selector_type = new(pool) Type_privateData(":");
+ Object_type = new(pool) Type_privateData(sig::object_P);
+ Selector_type = new(pool) Type_privateData(sig::selector_P);
NSArray_ = objc_getClass("NSArray");
NSBlock_ = objc_getClass("NSBlock");