]> git.saurik.com Git - cycript.git/blobdiff - sig/copy.cpp
Use class extension syntax as part of Object CYON.
[cycript.git] / sig / copy.cpp
index d00a869c06725317cf8d7e9c405a2442adf36152..63b72fe25ed4e7dfd8bb2d60be881906e73cd7d1 100644 (file)
@@ -1,5 +1,5 @@
-/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2015  Jay Freeman (saurik)
+/* Cycript - The Truly Universal Scripting Language
+ * Copyright (C) 2009-2016  Jay Freeman (saurik)
 */
 
 /* GNU Affero General Public License, Version 3 {{{ */
@@ -57,6 +57,7 @@ String *String::Copy(CYPool &pool, const char *rename) const {
     return new(pool) String();
 }
 
+#ifdef CY_OBJECTIVEC
 Meta *Meta::Copy(CYPool &pool, const char *rename) const {
     return new(pool) Meta();
 }
@@ -64,6 +65,7 @@ Meta *Meta::Copy(CYPool &pool, const char *rename) const {
 Selector *Selector::Copy(CYPool &pool, const char *rename) const {
     return new(pool) Selector();
 }
+#endif
 
 Bits *Bits::Copy(CYPool &pool, const char *rename) const {
     return new(pool) Bits(size);
@@ -77,12 +79,18 @@ Array *Array::Copy(CYPool &pool, const char *rename) const {
     return new(pool) Array(*type.Copy(pool), size);
 }
 
+#ifdef CY_OBJECTIVEC
 Object *Object::Copy(CYPool &pool, const char *rename) const {
     return new(pool) Object(pool.strdup(name));
 }
+#endif
 
 Aggregate *Aggregate::Copy(CYPool &pool, const char *rename) const {
-    Aggregate *copy(new(pool) Aggregate(overlap, rename ?: pool.strdup(name)));
+    if (rename == NULL)
+        rename = pool.strdup(name);
+    else if (rename[0] == '\0')
+        rename = NULL;
+    Aggregate *copy(new(pool) Aggregate(overlap, rename));
     sig::Copy(pool, copy->signature, signature);
     return copy;
 }
@@ -93,11 +101,13 @@ Function *Function::Copy(CYPool &pool, const char *rename) const {
     return copy;
 }
 
+#ifdef CY_OBJECTIVEC
 Block *Block::Copy(CYPool &pool, const char *rename) const {
     Block *copy(new(pool) Block());
     sig::Copy(pool, copy->signature, signature);
     return copy;
 }
+#endif
 
 void Copy(CYPool &pool, ffi_type &lhs, ffi_type &rhs) {
     lhs.size = rhs.size;