Skip to content

Commit a09d503

Browse files
committed
[FIX] stop searching for signature in inheritance if one has been found already
1 parent 343b9e1 commit a09d503

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

server/src/core/symbols/symbol.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,7 @@ impl Symbol {
28122812
) -> (Vec<Rc<RefCell<Symbol>>>, Vec<Diagnostic>) {
28132813
let mut result: Vec<Rc<RefCell<Symbol>>> = vec![];
28142814
let mut visited_symbols: PtrWeakHashSet<Weak<RefCell<Symbol>>> = PtrWeakHashSet::new();
2815-
let mut extend_result = |syms: Vec<Rc<RefCell<Symbol>>>| {
2815+
let mut extend_result = |syms: Vec<Rc<RefCell<Symbol>>>, result: &mut Vec<Rc<RefCell<Symbol>>>, visited_symbols: &mut PtrWeakHashSet<Weak<RefCell<Symbol>>>| {
28162816
syms.iter().for_each(|sym|{
28172817
if !visited_symbols.contains(sym){
28182818
visited_symbols.insert(sym.clone());
@@ -2826,7 +2826,7 @@ impl Symbol {
28262826
if let Some(mod_sym) = mod_sym {
28272827
if !only_fields {
28282828
if all {
2829-
extend_result(vec![mod_sym]);
2829+
extend_result(vec![mod_sym], &mut result, &mut visited_symbols);
28302830
} else {
28312831
return (vec![mod_sym], diagnostics);
28322832
}
@@ -2842,7 +2842,7 @@ impl Symbol {
28422842
}
28432843
if !content_syms.is_empty() {
28442844
if all {
2845-
extend_result(content_syms);
2845+
extend_result(content_syms, &mut result, &mut visited_symbols);
28462846
} else {
28472847
return (content_syms, diagnostics);
28482848
}
@@ -2865,7 +2865,7 @@ impl Symbol {
28652865
let (attributs, att_diagnostic) = model_symbol.borrow()._get_member_symbol_helper(session, name, None, true, only_fields, only_methods, all, false, visited_classes);
28662866
diagnostics.extend(att_diagnostic);
28672867
if all {
2868-
extend_result(attributs);
2868+
extend_result(attributs, &mut result, &mut visited_symbols);
28692869
} else {
28702870
if !attributs.is_empty() {
28712871
return (attributs, diagnostics);
@@ -2883,7 +2883,7 @@ impl Symbol {
28832883
let (attributs, att_diagnostic) = model_symbol.borrow()._get_member_symbol_helper(session, name, None, true, true, only_methods, all, false, visited_classes);
28842884
diagnostics.extend(att_diagnostic);
28852885
if all {
2886-
extend_result(attributs);
2886+
extend_result(attributs, &mut result, &mut visited_symbols);
28872887
} else {
28882888
if !attributs.is_empty() {
28892889
return (attributs, diagnostics);
@@ -2894,7 +2894,7 @@ impl Symbol {
28942894
}
28952895
}
28962896
}
2897-
if self.typ() == SymType::CLASS {
2897+
if self.typ() == SymType::CLASS && result.is_empty() { // if we already have something, do not go up in bases
28982898
for base in self.as_class_sym().bases.iter() {
28992899
let base = match base.upgrade(){
29002900
Some(b) => b,
@@ -2908,7 +2908,7 @@ impl Symbol {
29082908
diagnostics.extend(s_diagnostic);
29092909
if !s.is_empty() {
29102910
if all {
2911-
extend_result(s);
2911+
extend_result(s, &mut result, &mut visited_symbols);
29122912
} else {
29132913
return (s, diagnostics);
29142914
}

0 commit comments

Comments
 (0)