mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
cleanup expansion to item list
This commit is contained in:
parent
b9d9db83d1
commit
9eb14e1170
5 changed files with 11 additions and 34 deletions
|
@ -90,7 +90,7 @@ impl HirFileId {
|
|||
})
|
||||
.ok()?;
|
||||
match macro_file.macro_file_kind {
|
||||
MacroFileKind::Items => Some(Parse::to_syntax(mbe::token_tree_to_ast_item_list(&tt))),
|
||||
MacroFileKind::Items => mbe::token_tree_to_items(&tt).ok().map(Parse::to_syntax),
|
||||
MacroFileKind::Expr => mbe::token_tree_to_expr(&tt).ok().map(Parse::to_syntax),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,10 @@ impl RawItems {
|
|||
source_map: ImportSourceMap::default(),
|
||||
};
|
||||
if let Some(node) = db.parse_or_expand(file_id) {
|
||||
if let Some(source_file) = ast::SourceFile::cast(node) {
|
||||
if let Some(source_file) = ast::SourceFile::cast(node.clone()) {
|
||||
collector.process_module(None, source_file);
|
||||
} else if let Some(item_list) = ast::MacroItems::cast(node) {
|
||||
collector.process_module(None, item_list);
|
||||
}
|
||||
}
|
||||
(Arc::new(collector.raw_items), Arc::new(collector.source_map))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue