mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Type aliases to scope
This commit is contained in:
parent
f2772e29ae
commit
2161a1689d
3 changed files with 7 additions and 2 deletions
|
@ -26,6 +26,7 @@ impl ModuleScope {
|
||||||
ast::ModuleItem::ConstDef(item) => Entry::new(item),
|
ast::ModuleItem::ConstDef(item) => Entry::new(item),
|
||||||
ast::ModuleItem::StaticDef(item) => Entry::new(item),
|
ast::ModuleItem::StaticDef(item) => Entry::new(item),
|
||||||
ast::ModuleItem::TraitDef(item) => Entry::new(item),
|
ast::ModuleItem::TraitDef(item) => Entry::new(item),
|
||||||
|
ast::ModuleItem::TypeDef(item) => Entry::new(item),
|
||||||
ast::ModuleItem::Module(item) => Entry::new(item),
|
ast::ModuleItem::Module(item) => Entry::new(item),
|
||||||
ast::ModuleItem::UseItem(item) => {
|
ast::ModuleItem::UseItem(item) => {
|
||||||
if let Some(tree) = item.use_tree() {
|
if let Some(tree) = item.use_tree() {
|
||||||
|
@ -104,6 +105,7 @@ mod tests {
|
||||||
y::z,
|
y::z,
|
||||||
t,
|
t,
|
||||||
};
|
};
|
||||||
", &["Foo", "Bar", "baz", "quux", "z", "t"])
|
type T = ();
|
||||||
|
", &["Foo", "Bar", "baz", "quux", "z", "t", "T"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -947,6 +947,7 @@ pub enum ModuleItem<'a> {
|
||||||
EnumDef(EnumDef<'a>),
|
EnumDef(EnumDef<'a>),
|
||||||
FnDef(FnDef<'a>),
|
FnDef(FnDef<'a>),
|
||||||
TraitDef(TraitDef<'a>),
|
TraitDef(TraitDef<'a>),
|
||||||
|
TypeDef(TypeDef<'a>),
|
||||||
ImplItem(ImplItem<'a>),
|
ImplItem(ImplItem<'a>),
|
||||||
UseItem(UseItem<'a>),
|
UseItem(UseItem<'a>),
|
||||||
ExternCrateItem(ExternCrateItem<'a>),
|
ExternCrateItem(ExternCrateItem<'a>),
|
||||||
|
@ -962,6 +963,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
|
||||||
ENUM_DEF => Some(ModuleItem::EnumDef(EnumDef { syntax })),
|
ENUM_DEF => Some(ModuleItem::EnumDef(EnumDef { syntax })),
|
||||||
FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })),
|
FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })),
|
||||||
TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })),
|
TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })),
|
||||||
|
TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })),
|
||||||
IMPL_ITEM => Some(ModuleItem::ImplItem(ImplItem { syntax })),
|
IMPL_ITEM => Some(ModuleItem::ImplItem(ImplItem { syntax })),
|
||||||
USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })),
|
USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })),
|
||||||
EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })),
|
EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })),
|
||||||
|
@ -977,6 +979,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
|
||||||
ModuleItem::EnumDef(inner) => inner.syntax(),
|
ModuleItem::EnumDef(inner) => inner.syntax(),
|
||||||
ModuleItem::FnDef(inner) => inner.syntax(),
|
ModuleItem::FnDef(inner) => inner.syntax(),
|
||||||
ModuleItem::TraitDef(inner) => inner.syntax(),
|
ModuleItem::TraitDef(inner) => inner.syntax(),
|
||||||
|
ModuleItem::TypeDef(inner) => inner.syntax(),
|
||||||
ModuleItem::ImplItem(inner) => inner.syntax(),
|
ModuleItem::ImplItem(inner) => inner.syntax(),
|
||||||
ModuleItem::UseItem(inner) => inner.syntax(),
|
ModuleItem::UseItem(inner) => inner.syntax(),
|
||||||
ModuleItem::ExternCrateItem(inner) => inner.syntax(),
|
ModuleItem::ExternCrateItem(inner) => inner.syntax(),
|
||||||
|
|
|
@ -332,7 +332,7 @@ Grammar(
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
"ModuleItem": (
|
"ModuleItem": (
|
||||||
enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "ImplItem",
|
enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplItem",
|
||||||
"UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
|
"UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue