]> git.saurik.com Git - cycript.git/blobdiff - ObjectiveC/Internal.hpp
new operator must return JSObject even for errors.
[cycript.git] / ObjectiveC / Internal.hpp
index deb5e5df07df64ae47657b0e686bd52094bc7e71..fcfec702d7131e1d4bafe74e5ebd9ea6e1e135dd 100644 (file)
 #include "../Internal.hpp"
 
 struct Selector_privateData :
-    CYValue<Selector_privateData, SEL>
+    CYRoot
 {
+    SEL value_;
+
     _finline Selector_privateData(SEL value) :
-        CYValue(value)
+        value_(value)
     {
     }
 };
 
 struct Instance :
-    CYValue<Instance, id>
+    CYPrivateOld<Instance>
 {
     typedef unsigned Flags;
     static const Flags None = 0;
     static const Flags Permanent = 1 << 0;
     static const Flags Uninitialized = 1 << 1;
 
+    id value_;
     Flags flags_;
 
     Instance(id value, Flags flags);
@@ -63,35 +66,70 @@ struct Instance :
 
 namespace cy {
 struct Super :
-    CYValue<Super, id>
+    CYRoot
 {
+    id value_;
     Class class_;
 
     _finline Super(id value, Class _class) :
-        CYValue(value),
+        value_(value),
         class_(_class)
     {
     }
 }; }
 
 struct Messages :
-    CYValue<Messages, Class>
+    CYRoot
 {
-    _finline Messages(Class value) :
-        CYValue(value)
+    virtual Class GetClass() const = 0;
+};
+
+struct Prototype :
+    Messages
+{
+    static constexpr const char *const Cache_ = "p";
+
+    Class value_;
+
+    _finline Prototype(Class value) :
+        value_(value)
     {
     }
 
+    Class GetClass() const override {
+        return value_;
+    }
+
+    JSValueRef GetPrototype(JSContextRef context) const;
+};
+
+struct Constructor :
+    Messages
+{
+    static constexpr const char *const Cache_ = "m";
+
+    Class value_;
+
+    _finline Constructor(Class value) :
+        value_(value)
+    {
+    }
+
+    Class GetClass() const override {
+        return value_;
+    }
+
     JSValueRef GetPrototype(JSContextRef context) const;
 };
 
 struct Interior :
-    CYValue<Interior, id>
+    CYRoot
 {
+    id value_;
     CYProtect owner_;
 
     _finline Interior(id value, JSContextRef context, JSObjectRef owner) :
-        CYValue(value),
+        value_(value),
         owner_(context, owner)
     {
     }