// Is this type exported or a builtin? private static bool isExportedOrBuiltinType(reflect.Type t) { while (t.Kind() == reflect.Ptr) { t = t.Elem(); } // PkgPath will be non-empty even for an exported type, // so we need to check the type name as well. // PkgPath will be non-empty even for an exported type, // so we need to check the type name as well. return(token.IsExported(t.Name()) || t.PkgPath() == ""); }