Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/semantics.rs')
| -rw-r--r-- | crates/hir/src/semantics.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 281e6c65dc..27ba42ce1a 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -143,6 +143,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { self.imp.parse(file_id) } + pub fn parse_or_expand(&self, file_id: HirFileId) -> Option<SyntaxNode> { + self.imp.parse_or_expand(file_id) + } + pub fn expand(&self, macro_call: &ast::MacroCall) -> Option<SyntaxNode> { self.imp.expand(macro_call) } @@ -416,6 +420,12 @@ impl<'db> SemanticsImpl<'db> { tree } + fn parse_or_expand(&self, file_id: HirFileId) -> Option<SyntaxNode> { + let node = self.db.parse_or_expand(file_id)?; + self.cache(node.clone(), file_id); + Some(node) + } + fn expand(&self, macro_call: &ast::MacroCall) -> Option<SyntaxNode> { let sa = self.analyze(macro_call.syntax()); let file_id = sa.expand(self.db, InFile::new(sa.file_id, macro_call))?; |