]> git.saurik.com Git - cycript.git/commitdiff
Expose the internal Type of Pointers through type.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 20 Jan 2014 09:58:40 +0000 (01:58 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 20 Jan 2014 09:58:40 +0000 (01:58 -0800)
Execute.cpp

index 7b39bb94622f05f37dbbbf381021749de4537e1d..241ba325ab6199cd7cf9061156cade4e3d3cfa4e 100644 (file)
@@ -1255,6 +1255,11 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe
     }
 } CYCatch(NULL) }
 
+static JSValueRef Pointer_getProperty_type(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry {
+    Pointer *internal(reinterpret_cast<Pointer *>(JSObjectGetPrivate(object)));
+    return CYMakeType(context, internal->type_->type_);
+} CYCatch(NULL) }
+
 static JSValueRef Functor_getProperty_type(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry {
     cy::Functor *internal(reinterpret_cast<cy::Functor *>(JSObjectGetPrivate(object)));
     return CYMakeType(context, &internal->signature_);
@@ -1303,6 +1308,11 @@ static JSStaticFunction Pointer_staticFunctions[4] = {
     {NULL, NULL, 0}
 };
 
+static JSStaticValue Pointer_staticValues[2] = {
+    {"type", &Pointer_getProperty_type, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
+    {NULL, NULL, NULL, 0}
+};
+
 static JSStaticFunction Struct_staticFunctions[2] = {
     {"$cya", &Struct_callAsFunction_$cya, kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
     {NULL, NULL, 0}
@@ -1447,6 +1457,7 @@ void CYInitializeDynamic() {
     definition = kJSClassDefinitionEmpty;
     definition.className = "Pointer";
     definition.staticFunctions = Pointer_staticFunctions;
+    definition.staticValues = Pointer_staticValues;
     definition.getProperty = &Pointer_getProperty;
     definition.setProperty = &Pointer_setProperty;
     definition.finalize = &CYFinalize;