mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Improve types for node_expr / node_pat
This commit is contained in:
parent
71f7d82e45
commit
2dfb5e6ac0
3 changed files with 11 additions and 15 deletions
|
@ -5,7 +5,7 @@ use rustc_hash::FxHashMap;
|
|||
|
||||
use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
|
||||
use ra_db::{LocalSyntaxPtr, Cancelable};
|
||||
use ra_syntax::{SyntaxNodeRef, ast::{self, AstNode, LoopBodyOwner, ArgListOwner, NameOwner}};
|
||||
use ra_syntax::ast::{self, AstNode, LoopBodyOwner, ArgListOwner, NameOwner};
|
||||
|
||||
use crate::{Path, type_ref::{Mutability, TypeRef}, Name, HirDatabase, DefId, Def, name::AsName};
|
||||
|
||||
|
@ -77,9 +77,9 @@ impl BodySyntaxMapping {
|
|||
pub fn syntax_expr(&self, ptr: LocalSyntaxPtr) -> Option<ExprId> {
|
||||
self.expr_syntax_mapping.get(&ptr).cloned()
|
||||
}
|
||||
pub fn node_expr(&self, node: SyntaxNodeRef) -> Option<ExprId> {
|
||||
pub fn node_expr(&self, node: ast::Expr) -> Option<ExprId> {
|
||||
self.expr_syntax_mapping
|
||||
.get(&LocalSyntaxPtr::new(node))
|
||||
.get(&LocalSyntaxPtr::new(node.syntax()))
|
||||
.cloned()
|
||||
}
|
||||
pub fn pat_syntax(&self, pat: PatId) -> Option<LocalSyntaxPtr> {
|
||||
|
@ -88,9 +88,9 @@ impl BodySyntaxMapping {
|
|||
pub fn syntax_pat(&self, ptr: LocalSyntaxPtr) -> Option<PatId> {
|
||||
self.pat_syntax_mapping.get(&ptr).cloned()
|
||||
}
|
||||
pub fn node_pat(&self, node: SyntaxNodeRef) -> Option<PatId> {
|
||||
pub fn node_pat(&self, node: ast::Pat) -> Option<PatId> {
|
||||
self.pat_syntax_mapping
|
||||
.get(&LocalSyntaxPtr::new(node))
|
||||
.get(&LocalSyntaxPtr::new(node.syntax()))
|
||||
.cloned()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue