Skip to content

Commit 8b4b761

Browse files
committed
fix global double references
1 parent 64956d6 commit 8b4b761

File tree

1 file changed

+6
-6
lines changed
  • crates/code_analysis/src/db_index/reference

1 file changed

+6
-6
lines changed

crates/code_analysis/src/db_index/reference/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod local_reference;
22
mod string_reference;
33

4-
use std::collections::HashMap;
4+
use std::collections::{HashMap, HashSet};
55

66
use emmylua_parser::{LuaSyntaxId, LuaSyntaxKind};
77
use internment::ArcIntern;
@@ -16,7 +16,7 @@ use super::{traits::LuaIndex, LuaDeclId, LuaMemberKey};
1616
#[derive(Debug)]
1717
pub 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

Comments
 (0)