@@ -343,6 +343,14 @@ pub struct Backend {
343343 /// classmap contains a phar-based path (detected by a `!` separator,
344344 /// e.g. `/path/to/phpstan.phar!src/Type/Type.php`).
345345 pub ( crate ) phar_archives : Arc < RwLock < HashMap < PathBuf , phar:: PharArchive > > > ,
346+ /// Set of file URIs that have been fully parsed at least once.
347+ ///
348+ /// Used as a lightweight "has this file been parsed?" check by
349+ /// consumers that need to skip redundant re-parsing (e.g.
350+ /// `find_or_load_function`, `resolve_constant_definition`,
351+ /// `find_implementors`). Populated in `update_ast_inner` and
352+ /// `parse_and_cache_content_versioned`.
353+ pub ( crate ) parsed_uris : Arc < RwLock < HashSet < String > > > ,
346354 /// Set of file URIs currently being parsed by another thread.
347355 ///
348356 /// Used by [`parse_and_cache_file`](Self::parse_and_cache_file) to avoid
@@ -655,6 +663,7 @@ impl Backend {
655663 class_not_found_cache : Arc :: new ( RwLock :: new ( HashSet :: new ( ) ) ) ,
656664 classmap : Arc :: new ( RwLock :: new ( HashMap :: new ( ) ) ) ,
657665 phar_archives : Arc :: new ( RwLock :: new ( HashMap :: new ( ) ) ) ,
666+ parsed_uris : Arc :: new ( RwLock :: new ( HashSet :: new ( ) ) ) ,
658667 parse_inflight : Arc :: new ( Mutex :: new ( HashSet :: new ( ) ) ) ,
659668 stub_index : RwLock :: new ( stubs:: build_stub_class_index ( ) ) ,
660669 stub_function_index : RwLock :: new ( stubs:: build_stub_function_index ( ) ) ,
@@ -732,6 +741,7 @@ impl Backend {
732741 class_not_found_cache : Arc :: new ( RwLock :: new ( HashSet :: new ( ) ) ) ,
733742 classmap : Arc :: new ( RwLock :: new ( HashMap :: new ( ) ) ) ,
734743 phar_archives : Arc :: new ( RwLock :: new ( HashMap :: new ( ) ) ) ,
744+ parsed_uris : Arc :: new ( RwLock :: new ( HashSet :: new ( ) ) ) ,
735745 parse_inflight : Arc :: new ( Mutex :: new ( HashSet :: new ( ) ) ) ,
736746 stub_index : RwLock :: new ( HashMap :: new ( ) ) ,
737747 stub_function_index : RwLock :: new ( HashMap :: new ( ) ) ,
@@ -1081,6 +1091,7 @@ impl Backend {
10811091 fqn_index : Arc :: clone ( & self . fqn_index ) ,
10821092 classmap : Arc :: clone ( & self . classmap ) ,
10831093 phar_archives : Arc :: clone ( & self . phar_archives ) ,
1094+ parsed_uris : Arc :: clone ( & self . parsed_uris ) ,
10841095 parse_inflight : Arc :: clone ( & self . parse_inflight ) ,
10851096 class_not_found_cache : Arc :: clone ( & self . class_not_found_cache ) ,
10861097 stub_index : RwLock :: new ( self . stub_index . read ( ) . clone ( ) ) ,
0 commit comments