private JSType lookupTypeByName(
     String name, Node n, DeclaredTypeRegistry registry, ImmutableList<String> outerTypeParameters)
     throws UnknownTypeException {
   String tvar = UniqueNameGenerator.findGeneratedName(name, outerTypeParameters);
   if (tvar != null) {
     return JSType.fromTypeVar(tvar);
   }
   Declaration decl = registry.getDeclaration(QualifiedName.fromQualifiedString(name), true);
   if (decl == null) {
     unknownTypeNames.put(n, name);
     throw new UnknownTypeException("Unhandled type: " + name);
   }
   // It's either a typedef, an enum, a type variable or a nominal type
   if (decl.getTypedef() != null) {
     return getTypedefType(decl.getTypedef(), registry);
   }
   if (decl.getEnum() != null) {
     return getEnumPropType(decl.getEnum(), registry);
   }
   if (decl.isTypeVar()) {
     howmanyTypeVars++;
     return decl.getTypeOfSimpleDecl();
   }
   if (decl.getNominal() != null) {
     return getNominalTypeHelper(decl.getNominal(), n, registry, outerTypeParameters);
   }
   return JSType.UNKNOWN;
 }