/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2013 Jay Freeman (saurik)
+ * Copyright (C) 2009-2014 Jay Freeman (saurik)
*/
-/* GNU General Public License, Version 3 {{{ */
+/* GNU Affero General Public License, Version 3 {{{ */
/*
- * Cycript is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * Cycript is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Cycript. If not, see <http://www.gnu.org/licenses/>.
+ * GNU Affero General Public License for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
/* }}} */
CYTypedIdentifier *Decode_(CYPool &pool, struct sig::Type *type) {
switch (type->primitive) {
+ case sig::unknown_P: return $ CYTypedIdentifier($ CYTypeError());
+
case sig::function_P: {
_assert(type->data.signature.count != 0);
CYTypedParameter *parameter(NULL);
case sig::selector_P: return $ CYTypedIdentifier($ CYTypeVariable("SEL"));
case sig::block_P: {
- _assert(type->data.signature.count != 0);
- CYTypedParameter *parameter(NULL);
- for (size_t i(type->data.signature.count - 1); i != 0; --i)
- parameter = $ CYTypedParameter(Decode(pool, type->data.signature.elements[i].type), parameter);
- return Decode(pool, type->data.signature.elements[0].type)->Modify($ CYTypeBlockWith(parameter));
+ if (type->data.signature.count == 0)
+ return $ CYTypedIdentifier($ CYTypeVariable("NSBlock"), $ CYTypePointerTo());
+ else {
+ CYTypedParameter *parameter(NULL);
+ for (size_t i(type->data.signature.count - 1); i != 0; --i)
+ parameter = $ CYTypedParameter(Decode(pool, type->data.signature.elements[i].type), parameter);
+ return Decode(pool, type->data.signature.elements[0].type)->Modify($ CYTypeBlockWith(parameter));
+ }
} break;
case sig::object_P: {