internal Type findType(int qname)
{
if (qname == 0xFFFF || qname == -1) return null;
// lookup type with typeRef index
FTypeRef reference = fpod.typeRef(qname);
// if generic instance, then this type must be used in a method
// signature, not type meta-data (b/c I can't subclass generic types),
// so it's safe that my pod has been loaded and is now registered (in
// case the generic type is parameterized via types in my pod)
if (reference.isGenericInstance())
return TypeParser.load(reference.signature, true, this);
// otherwise I need to handle if I am loading my own pod, because
// I might not yet be added to the system namespace if I'm just
// loading my own hollow types
string podName = reference.podName;
string typeName = reference.typeName;
Pod pod = podName == m_name ? this : doFind(podName, true, null);
Type type = pod.type(typeName, false);
if (type != null)
{
if (reference.isNullable()) type = type.toNullable();
return type;
}
// handle generic parameter types (for sys pod only)
if (m_name == "sys")
{
type = Sys.genericParamType(typeName);
if (type != null)
{
if (reference.isNullable()) type = type.toNullable();
return type;
}
}
// lost cause
throw UnknownTypeErr.make(podName + "::" + typeName).val;
}