X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/fb486b846b9e31c15344c3bd6314b8fdd54aad0b..bf998c10baabbd95f2d59d29f9edea0eb107b156:/Decode.cpp?ds=sidebyside
diff --git a/Decode.cpp b/Decode.cpp
index bdef46b..e7ea5f9 100644
--- a/Decode.cpp
+++ b/Decode.cpp
@@ -1,21 +1,21 @@
/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2013 Jay Freeman (saurik)
+ * Copyright (C) 2009-2015 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 .
+ * 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 .
**/
/* }}} */
@@ -88,8 +88,16 @@ CYTypedIdentifier *Decode_(CYPool &pool, struct sig::Type *type) {
case sig::void_P: return $ CYTypedIdentifier($ CYTypeVoid());
case sig::struct_P: {
- _assert(type->name != NULL);
- return $ CYTypedIdentifier($ CYTypeVariable(type->name));
+ CYTypeStructField *fields(NULL);
+ for (size_t i(type->data.signature.count); i != 0; --i) {
+ sig::Element &element(type->data.signature.elements[i - 1]);
+ CYTypedIdentifier *typed(Decode(pool, element.type));
+ if (element.name != NULL)
+ typed->identifier_ = $I(element.name);
+ fields = $ CYTypeStructField(typed, fields);
+ }
+ CYIdentifier *name(type->name == NULL ? NULL : $I(type->name));
+ return $ CYTypedIdentifier($ CYTypeStruct(name, fields));
} break;
}