| 185 | } |
| 186 | |
| 187 | void GDScriptCache::remove_script(const String &p_path) { |
| 188 | if (singleton == nullptr) { |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | MutexLock lock(singleton->mutex); |
| 193 | |
| 194 | if (singleton->cleared) { |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | if (HashMap<String, Vector<ObjectID>>::Iterator E = singleton->abandoned_parser_map.find(p_path)) { |
| 199 | for (ObjectID parser_ref_id : E->value) { |
| 200 | Ref<GDScriptParserRef> parser_ref = { ObjectDB::get_instance(parser_ref_id) }; |
| 201 | if (parser_ref.is_valid()) { |
| 202 | parser_ref->clear(); |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | singleton->abandoned_parser_map.erase(p_path); |
| 208 | |
| 209 | if (singleton->parser_map.has(p_path)) { |
| 210 | singleton->parser_map[p_path]->clear(); |
| 211 | } |
| 212 | |
| 213 | remove_parser(p_path); |
| 214 | |
| 215 | singleton->dependencies.erase(p_path); |
| 216 | singleton->shallow_gdscript_cache.erase(p_path); |
| 217 | singleton->full_gdscript_cache.erase(p_path); |
| 218 | } |
| 219 | |
| 220 | Ref<GDScriptParserRef> GDScriptCache::get_parser(const String &p_path, GDScriptParserRef::Status p_status, Error &r_error, const String &p_owner) { |
| 221 | MutexLock lock(singleton->mutex); |