Use the new Resolver API for goto def

This commit is contained in:
Florian Diebold 2019-01-29 20:49:31 +01:00
parent 33ff7b56ff
commit afce8e4426
6 changed files with 89 additions and 35 deletions

View file

@ -58,6 +58,10 @@ impl ExprScopes {
scopes
}
pub fn body(&self) -> Arc<Body> {
self.body.clone()
}
pub fn entries(&self, scope: ScopeId) -> &[ScopeEntry] {
&self.scopes[scope].entries
}
@ -220,7 +224,7 @@ impl ScopesWithSyntaxMapping {
.collect()
}
fn scope_for(&self, node: &SyntaxNode) -> Option<ScopeId> {
pub fn scope_for(&self, node: &SyntaxNode) -> Option<ScopeId> {
node.ancestors()
.map(SyntaxNodePtr::new)
.filter_map(|ptr| self.syntax_mapping.syntax_expr(ptr))