Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r--crates/hir/src/lib.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index ee7270f295..a528b2bc2d 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1458,14 +1458,7 @@ impl Const {
}
pub fn value(self, db: &dyn HirDatabase) -> Option<ast::Expr> {
- let loc = self.id.lookup(db.upcast());
- let item_tree = loc.id.item_tree(db.upcast());
- let ast_id = item_tree[loc.id.value].ast_id;
- let ast_id_map = db.ast_id_map(loc.id.file_id());
- let ast_ptr = ast_id_map.get(ast_id);
- let syntax_node = db.parse_or_expand(loc.id.file_id())?;
- let ast_node = ast_ptr.to_node(&syntax_node);
- ast_node.body()
+ self.source(db)?.value.body()
}
pub fn ty(self, db: &dyn HirDatabase) -> Type {