11mod local_reference;
22mod string_reference;
33
4- use std:: collections:: HashMap ;
4+ use std:: collections:: { HashMap , HashSet } ;
55
66use emmylua_parser:: { LuaSyntaxId , LuaSyntaxKind } ;
77use internment:: ArcIntern ;
@@ -16,7 +16,7 @@ use super::{traits::LuaIndex, LuaDeclId, LuaMemberKey};
1616#[ derive( Debug ) ]
1717pub struct LuaReferenceIndex {
1818 local_references : HashMap < FileId , LocalReference > ,
19- index_reference : HashMap < LuaMemberKey , HashMap < FileId , Vec < LuaSyntaxId > > > ,
19+ index_reference : HashMap < LuaMemberKey , HashMap < FileId , HashSet < LuaSyntaxId > > > ,
2020 string_references : HashMap < FileId , StringReference > ,
2121}
2222
@@ -42,8 +42,8 @@ impl LuaReferenceIndex {
4242 . entry ( LuaMemberKey :: Name ( key. clone ( ) ) )
4343 . or_insert_with ( HashMap :: new)
4444 . entry ( file_id)
45- . or_insert_with ( Vec :: new)
46- . push ( LuaSyntaxId :: new ( LuaSyntaxKind :: NameExpr . into ( ) , range) ) ;
45+ . or_insert_with ( HashSet :: new)
46+ . insert ( LuaSyntaxId :: new ( LuaSyntaxKind :: NameExpr . into ( ) , range) ) ;
4747 }
4848
4949 pub fn add_index_reference (
@@ -56,8 +56,8 @@ impl LuaReferenceIndex {
5656 . entry ( key)
5757 . or_insert_with ( HashMap :: new)
5858 . entry ( file_id)
59- . or_insert_with ( Vec :: new)
60- . push ( syntax_id) ;
59+ . or_insert_with ( HashSet :: new)
60+ . insert ( syntax_id) ;
6161 }
6262
6363 pub fn add_string_reference (
0 commit comments