X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/API/ObjcRuntimeExtras.h diff --git a/API/ObjcRuntimeExtras.h b/API/ObjcRuntimeExtras.h index 48c1120..c85bc92 100644 --- a/API/ObjcRuntimeExtras.h +++ b/API/ObjcRuntimeExtras.h @@ -192,9 +192,19 @@ typename DelegateType::ResultType parseObjCType(const char*& position) } if (*position == '"') { - const char* begin = ++position; - position = index(position, '"'); - return DelegateType::typeOfClass(begin, position++); + const char* begin = position + 1; + const char* protocolPosition = strchr(begin, '<'); + const char* endOfType = strchr(begin, '"'); + position = endOfType + 1; + + // There's no protocol involved in this type, so just handle the class name. + if (!protocolPosition || protocolPosition > endOfType) + return DelegateType::typeOfClass(begin, endOfType); + // We skipped the class name and went straight to the protocol, so this is an id type. + if (begin == protocolPosition) + return DelegateType::typeId(); + // We have a class name with a protocol. For now, ignore the protocol. + return DelegateType::typeOfClass(begin, protocolPosition); } return DelegateType::typeId();