2019-09-30 08:58:53 +00:00
|
|
|
//! FIXME: write short doc here
|
|
|
|
|
2019-09-14 14:26:03 +00:00
|
|
|
use hir::{AssocItem, FieldSource, HasSource, ModuleSource};
|
2019-04-09 11:43:11 +00:00
|
|
|
use ra_db::{FileId, SourceDatabase};
|
2019-01-11 10:28:59 +00:00
|
|
|
use ra_syntax::{
|
2019-07-04 20:05:17 +00:00
|
|
|
ast::{self, DocCommentsOwner},
|
2019-10-05 14:03:03 +00:00
|
|
|
match_ast, AstNode, AstPtr, SmolStr,
|
2019-07-04 20:05:17 +00:00
|
|
|
SyntaxKind::{self, NAME},
|
2019-07-19 09:56:47 +00:00
|
|
|
SyntaxNode, TextRange,
|
2019-01-11 10:28:59 +00:00
|
|
|
};
|
2019-01-11 10:01:35 +00:00
|
|
|
|
2019-06-09 19:28:53 +00:00
|
|
|
use super::short_label::ShortLabel;
|
2019-07-04 20:05:17 +00:00
|
|
|
use crate::{db::RootDatabase, FileSymbol};
|
2019-01-11 11:00:54 +00:00
|
|
|
|
|
|
|
/// `NavigationTarget` represents and element in the editor's UI which you can
|
|
|
|
/// click on to navigate to a particular piece of code.
|
|
|
|
///
|
|
|
|
/// Typically, a `NavigationTarget` corresponds to some element in the source
|
|
|
|
/// code, like a function or a struct, but this is not strictly required.
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct NavigationTarget {
|
|
|
|
file_id: FileId,
|
|
|
|
name: SmolStr,
|
|
|
|
kind: SyntaxKind,
|
2019-01-11 15:17:20 +00:00
|
|
|
full_range: TextRange,
|
2019-01-11 11:00:54 +00:00
|
|
|
focus_range: Option<TextRange>,
|
2019-02-12 19:47:51 +00:00
|
|
|
container_name: Option<SmolStr>,
|
2019-06-09 16:03:38 +00:00
|
|
|
description: Option<String>,
|
|
|
|
docs: Option<String>,
|
2019-01-11 11:00:54 +00:00
|
|
|
}
|
2019-01-11 10:01:35 +00:00
|
|
|
|
2019-11-11 08:15:19 +00:00
|
|
|
pub(crate) trait ToNav {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget;
|
2019-11-03 17:49:41 +00:00
|
|
|
}
|
|
|
|
|
2019-01-11 10:01:35 +00:00
|
|
|
impl NavigationTarget {
|
2019-02-17 11:38:32 +00:00
|
|
|
/// When `focus_range` is specified, returns it. otherwise
|
|
|
|
/// returns `full_range`
|
|
|
|
pub fn range(&self) -> TextRange {
|
|
|
|
self.focus_range.unwrap_or(self.full_range)
|
|
|
|
}
|
|
|
|
|
2019-01-11 11:00:54 +00:00
|
|
|
pub fn name(&self) -> &SmolStr {
|
|
|
|
&self.name
|
|
|
|
}
|
|
|
|
|
2019-02-12 19:47:51 +00:00
|
|
|
pub fn container_name(&self) -> Option<&SmolStr> {
|
|
|
|
self.container_name.as_ref()
|
|
|
|
}
|
|
|
|
|
2019-01-11 11:00:54 +00:00
|
|
|
pub fn kind(&self) -> SyntaxKind {
|
|
|
|
self.kind
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn file_id(&self) -> FileId {
|
|
|
|
self.file_id
|
|
|
|
}
|
|
|
|
|
2019-01-11 15:17:20 +00:00
|
|
|
pub fn full_range(&self) -> TextRange {
|
|
|
|
self.full_range
|
2019-01-11 11:00:54 +00:00
|
|
|
}
|
|
|
|
|
2019-06-09 19:37:34 +00:00
|
|
|
pub fn docs(&self) -> Option<&str> {
|
|
|
|
self.docs.as_ref().map(String::as_str)
|
2019-06-09 16:03:38 +00:00
|
|
|
}
|
|
|
|
|
2019-06-09 19:37:34 +00:00
|
|
|
pub fn description(&self) -> Option<&str> {
|
|
|
|
self.description.as_ref().map(String::as_str)
|
2019-06-09 16:03:38 +00:00
|
|
|
}
|
|
|
|
|
2019-02-17 11:38:32 +00:00
|
|
|
/// A "most interesting" range withing the `full_range`.
|
2019-01-11 11:00:54 +00:00
|
|
|
///
|
2019-02-17 11:38:32 +00:00
|
|
|
/// Typically, `full_range` is the whole syntax node,
|
|
|
|
/// including doc comments, and `focus_range` is the range of the identifier.
|
2019-01-11 11:00:54 +00:00
|
|
|
pub fn focus_range(&self) -> Option<TextRange> {
|
|
|
|
self.focus_range
|
|
|
|
}
|
|
|
|
|
2019-11-03 17:49:41 +00:00
|
|
|
pub(crate) fn from_bind_pat(
|
|
|
|
db: &RootDatabase,
|
|
|
|
file_id: FileId,
|
|
|
|
pat: &ast::BindPat,
|
|
|
|
) -> NavigationTarget {
|
|
|
|
NavigationTarget::from_named(db, file_id.into(), pat, None, None)
|
2019-02-17 11:38:32 +00:00
|
|
|
}
|
|
|
|
|
2019-04-10 08:15:55 +00:00
|
|
|
pub(crate) fn from_pat(
|
|
|
|
db: &RootDatabase,
|
2019-01-11 11:00:54 +00:00
|
|
|
file_id: FileId,
|
2019-07-19 12:53:16 +00:00
|
|
|
pat: AstPtr<ast::BindPat>,
|
2019-01-11 11:00:54 +00:00
|
|
|
) -> NavigationTarget {
|
2019-07-12 16:41:13 +00:00
|
|
|
let parse = db.parse(file_id);
|
2019-07-19 12:53:16 +00:00
|
|
|
let pat = pat.to_node(parse.tree().syntax());
|
2019-11-03 17:49:41 +00:00
|
|
|
NavigationTarget::from_bind_pat(db, file_id, &pat)
|
2019-01-11 11:00:54 +00:00
|
|
|
}
|
|
|
|
|
2019-05-22 16:49:22 +00:00
|
|
|
pub(crate) fn from_self_param(
|
|
|
|
file_id: FileId,
|
|
|
|
par: AstPtr<ast::SelfParam>,
|
|
|
|
) -> NavigationTarget {
|
|
|
|
let (name, full_range) = ("self".into(), par.syntax_node_ptr().range());
|
2019-06-08 14:26:27 +00:00
|
|
|
|
2019-05-22 16:49:22 +00:00
|
|
|
NavigationTarget {
|
|
|
|
file_id,
|
|
|
|
name,
|
|
|
|
full_range,
|
|
|
|
focus_range: None,
|
|
|
|
kind: NAME,
|
|
|
|
container_name: None,
|
2019-06-09 15:59:59 +00:00
|
|
|
description: None, //< No document node for SelfParam
|
|
|
|
docs: None, //< No document node for SelfParam
|
2019-05-22 16:49:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-15 15:50:16 +00:00
|
|
|
pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget {
|
2019-02-08 11:49:43 +00:00
|
|
|
let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
2019-06-11 14:48:27 +00:00
|
|
|
if let Some(src) = module.declaration_source(db) {
|
2019-11-03 17:49:41 +00:00
|
|
|
let (file_id, text_range) = find_range_from_node(db, src.file_id, src.ast.syntax());
|
2019-06-08 19:27:01 +00:00
|
|
|
return NavigationTarget::from_syntax(
|
|
|
|
file_id,
|
|
|
|
name,
|
|
|
|
None,
|
2019-11-03 17:49:41 +00:00
|
|
|
text_range,
|
2019-06-11 14:48:27 +00:00
|
|
|
src.ast.syntax(),
|
|
|
|
src.ast.doc_comment_text(),
|
|
|
|
src.ast.short_label(),
|
2019-06-08 19:27:01 +00:00
|
|
|
);
|
2019-01-13 18:56:20 +00:00
|
|
|
}
|
2019-11-11 08:15:19 +00:00
|
|
|
module.to_nav(db)
|
2019-03-07 08:32:39 +00:00
|
|
|
}
|
|
|
|
|
2019-05-30 13:10:07 +00:00
|
|
|
pub(crate) fn from_def(
|
|
|
|
db: &RootDatabase,
|
|
|
|
module_def: hir::ModuleDef,
|
|
|
|
) -> Option<NavigationTarget> {
|
|
|
|
let nav = match module_def {
|
2019-11-11 08:15:19 +00:00
|
|
|
hir::ModuleDef::Module(module) => module.to_nav(db),
|
|
|
|
hir::ModuleDef::Function(it) => it.to_nav(db),
|
|
|
|
hir::ModuleDef::Adt(it) => it.to_nav(db),
|
|
|
|
hir::ModuleDef::Const(it) => it.to_nav(db),
|
|
|
|
hir::ModuleDef::Static(it) => it.to_nav(db),
|
|
|
|
hir::ModuleDef::EnumVariant(it) => it.to_nav(db),
|
|
|
|
hir::ModuleDef::Trait(it) => it.to_nav(db),
|
|
|
|
hir::ModuleDef::TypeAlias(it) => it.to_nav(db),
|
2019-05-30 13:10:07 +00:00
|
|
|
hir::ModuleDef::BuiltinType(..) => {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
Some(nav)
|
2019-01-11 10:01:35 +00:00
|
|
|
}
|
2019-01-11 10:05:45 +00:00
|
|
|
|
2019-01-11 15:17:20 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
pub(crate) fn assert_match(&self, expected: &str) {
|
|
|
|
let actual = self.debug_render();
|
|
|
|
test_utils::assert_eq_text!(expected.trim(), actual.trim(),);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
pub(crate) fn debug_render(&self) -> String {
|
|
|
|
let mut buf = format!(
|
|
|
|
"{} {:?} {:?} {:?}",
|
|
|
|
self.name(),
|
|
|
|
self.kind(),
|
|
|
|
self.file_id(),
|
|
|
|
self.full_range()
|
|
|
|
);
|
|
|
|
if let Some(focus_range) = self.focus_range() {
|
|
|
|
buf.push_str(&format!(" {:?}", focus_range))
|
|
|
|
}
|
2019-02-12 19:47:51 +00:00
|
|
|
if let Some(container_name) = self.container_name() {
|
2019-02-23 10:53:53 +00:00
|
|
|
buf.push_str(&format!(" {}", container_name))
|
2019-02-12 19:47:51 +00:00
|
|
|
}
|
2019-01-11 15:17:20 +00:00
|
|
|
buf
|
|
|
|
}
|
|
|
|
|
2019-02-23 09:02:42 +00:00
|
|
|
/// Allows `NavigationTarget` to be created from a `NameOwner`
|
2019-06-08 19:27:01 +00:00
|
|
|
pub(crate) fn from_named(
|
2019-11-03 17:49:41 +00:00
|
|
|
db: &RootDatabase,
|
|
|
|
file_id: hir::HirFileId,
|
2019-06-08 19:27:01 +00:00
|
|
|
node: &impl ast::NameOwner,
|
|
|
|
docs: Option<String>,
|
2019-06-09 15:59:59 +00:00
|
|
|
description: Option<String>,
|
2019-06-08 19:27:01 +00:00
|
|
|
) -> NavigationTarget {
|
2019-04-10 08:15:55 +00:00
|
|
|
//FIXME: use `_` instead of empty string
|
2019-01-11 10:31:21 +00:00
|
|
|
let name = node.name().map(|it| it.text().clone()).unwrap_or_default();
|
2019-11-03 17:49:41 +00:00
|
|
|
let focus_range = node.name().map(|it| find_range_from_node(db, file_id, it.syntax()).1);
|
|
|
|
let (file_id, full_range) = find_range_from_node(db, file_id, node.syntax());
|
|
|
|
|
|
|
|
NavigationTarget::from_syntax(
|
|
|
|
file_id,
|
|
|
|
name,
|
|
|
|
focus_range,
|
|
|
|
full_range,
|
|
|
|
node.syntax(),
|
|
|
|
docs,
|
|
|
|
description,
|
|
|
|
)
|
2019-01-11 10:28:59 +00:00
|
|
|
}
|
|
|
|
|
2019-01-11 11:00:54 +00:00
|
|
|
fn from_syntax(
|
|
|
|
file_id: FileId,
|
|
|
|
name: SmolStr,
|
|
|
|
focus_range: Option<TextRange>,
|
2019-11-03 17:49:41 +00:00
|
|
|
full_range: TextRange,
|
2019-01-11 11:00:54 +00:00
|
|
|
node: &SyntaxNode,
|
2019-06-08 19:27:01 +00:00
|
|
|
docs: Option<String>,
|
2019-06-09 15:59:59 +00:00
|
|
|
description: Option<String>,
|
2019-01-11 11:00:54 +00:00
|
|
|
) -> NavigationTarget {
|
2019-01-11 10:05:45 +00:00
|
|
|
NavigationTarget {
|
|
|
|
file_id,
|
2019-01-11 10:28:59 +00:00
|
|
|
name,
|
2019-01-11 10:05:45 +00:00
|
|
|
kind: node.kind(),
|
2019-11-03 17:49:41 +00:00
|
|
|
full_range,
|
2019-01-11 11:00:54 +00:00
|
|
|
focus_range,
|
2019-02-12 19:47:51 +00:00
|
|
|
container_name: None,
|
2019-06-09 15:59:59 +00:00
|
|
|
description,
|
2019-06-08 19:27:01 +00:00
|
|
|
docs,
|
2019-01-11 10:05:45 +00:00
|
|
|
}
|
|
|
|
}
|
2019-06-08 14:26:27 +00:00
|
|
|
}
|
2019-04-09 11:43:11 +00:00
|
|
|
|
2019-11-11 08:15:19 +00:00
|
|
|
impl ToNav for FileSymbol {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
NavigationTarget {
|
|
|
|
file_id: self.file_id,
|
|
|
|
name: self.name.clone(),
|
|
|
|
kind: self.ptr.kind(),
|
|
|
|
full_range: self.ptr.range(),
|
|
|
|
focus_range: self.name_range,
|
|
|
|
container_name: self.container_name.clone(),
|
|
|
|
description: description_from_symbol(db, self),
|
|
|
|
docs: docs_from_symbol(db, self),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) trait ToNavFromAst {}
|
|
|
|
impl ToNavFromAst for hir::Function {}
|
|
|
|
impl ToNavFromAst for hir::Const {}
|
|
|
|
impl ToNavFromAst for hir::Static {}
|
|
|
|
impl ToNavFromAst for hir::Struct {}
|
|
|
|
impl ToNavFromAst for hir::Enum {}
|
|
|
|
impl ToNavFromAst for hir::EnumVariant {}
|
|
|
|
impl ToNavFromAst for hir::Union {}
|
|
|
|
impl ToNavFromAst for hir::TypeAlias {}
|
|
|
|
impl ToNavFromAst for hir::Trait {}
|
|
|
|
|
|
|
|
impl<D> ToNav for D
|
|
|
|
where
|
|
|
|
D: HasSource + ToNavFromAst + Copy,
|
|
|
|
D::Ast: ast::DocCommentsOwner + ast::NameOwner + ShortLabel,
|
|
|
|
{
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
let src = self.source(db);
|
|
|
|
NavigationTarget::from_named(
|
|
|
|
db,
|
|
|
|
src.file_id,
|
|
|
|
&src.ast,
|
|
|
|
src.ast.doc_comment_text(),
|
|
|
|
src.ast.short_label(),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ToNav for hir::Module {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
let src = self.definition_source(db);
|
|
|
|
let name = self.name(db).map(|it| it.to_string().into()).unwrap_or_default();
|
|
|
|
match src.ast {
|
|
|
|
ModuleSource::SourceFile(node) => {
|
|
|
|
let (file_id, text_range) = find_range_from_node(db, src.file_id, node.syntax());
|
|
|
|
|
|
|
|
NavigationTarget::from_syntax(
|
|
|
|
file_id,
|
|
|
|
name,
|
|
|
|
None,
|
|
|
|
text_range,
|
|
|
|
node.syntax(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
ModuleSource::Module(node) => {
|
|
|
|
let (file_id, text_range) = find_range_from_node(db, src.file_id, node.syntax());
|
|
|
|
|
|
|
|
NavigationTarget::from_syntax(
|
|
|
|
file_id,
|
|
|
|
name,
|
|
|
|
None,
|
|
|
|
text_range,
|
|
|
|
node.syntax(),
|
|
|
|
node.doc_comment_text(),
|
|
|
|
node.short_label(),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ToNav for hir::ImplBlock {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
let src = self.source(db);
|
|
|
|
let (file_id, text_range) = find_range_from_node(db, src.file_id, src.ast.syntax());
|
|
|
|
|
|
|
|
NavigationTarget::from_syntax(
|
|
|
|
file_id,
|
|
|
|
"impl".into(),
|
|
|
|
None,
|
|
|
|
text_range,
|
|
|
|
src.ast.syntax(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ToNav for hir::StructField {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
let src = self.source(db);
|
|
|
|
|
|
|
|
match src.ast {
|
|
|
|
FieldSource::Named(it) => NavigationTarget::from_named(
|
|
|
|
db,
|
|
|
|
src.file_id,
|
|
|
|
&it,
|
|
|
|
it.doc_comment_text(),
|
|
|
|
it.short_label(),
|
|
|
|
),
|
|
|
|
FieldSource::Pos(it) => {
|
|
|
|
let (file_id, text_range) = find_range_from_node(db, src.file_id, it.syntax());
|
|
|
|
NavigationTarget::from_syntax(
|
|
|
|
file_id,
|
|
|
|
"".into(),
|
|
|
|
None,
|
|
|
|
text_range,
|
|
|
|
it.syntax(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ToNav for hir::MacroDef {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
let src = self.source(db);
|
|
|
|
log::debug!("nav target {:#?}", src.ast.syntax());
|
|
|
|
NavigationTarget::from_named(db, src.file_id, &src.ast, src.ast.doc_comment_text(), None)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ToNav for hir::Adt {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
match self {
|
|
|
|
hir::Adt::Struct(it) => it.to_nav(db),
|
|
|
|
hir::Adt::Union(it) => it.to_nav(db),
|
|
|
|
hir::Adt::Enum(it) => it.to_nav(db),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ToNav for hir::AssocItem {
|
|
|
|
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
|
|
|
match self {
|
|
|
|
AssocItem::Function(it) => it.to_nav(db),
|
|
|
|
AssocItem::Const(it) => it.to_nav(db),
|
|
|
|
AssocItem::TypeAlias(it) => it.to_nav(db),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn find_range_from_node(
|
|
|
|
db: &RootDatabase,
|
|
|
|
src: hir::HirFileId,
|
|
|
|
node: &SyntaxNode,
|
|
|
|
) -> (FileId, TextRange) {
|
|
|
|
let text_range = node.text_range();
|
|
|
|
let (file_id, text_range) = src
|
|
|
|
.expansion_info(db)
|
|
|
|
.and_then(|expansion_info| expansion_info.find_range(text_range))
|
|
|
|
.unwrap_or((src, text_range));
|
|
|
|
|
|
|
|
// FIXME: handle recursive macro generated macro
|
|
|
|
(file_id.original_file(db), text_range)
|
|
|
|
}
|
|
|
|
|
2019-06-10 16:34:43 +00:00
|
|
|
pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
|
2019-07-12 16:41:13 +00:00
|
|
|
let parse = db.parse(symbol.file_id);
|
2019-09-25 01:32:01 +00:00
|
|
|
let node = symbol.ptr.to_node(parse.tree().syntax());
|
2019-06-08 19:27:01 +00:00
|
|
|
|
2019-10-05 14:03:03 +00:00
|
|
|
match_ast! {
|
|
|
|
match node {
|
|
|
|
ast::FnDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::StructDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::EnumDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::TraitDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::Module(it) => { it.doc_comment_text() },
|
|
|
|
ast::TypeAliasDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::ConstDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::StaticDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::RecordFieldDef(it) => { it.doc_comment_text() },
|
|
|
|
ast::EnumVariant(it) => { it.doc_comment_text() },
|
|
|
|
ast::MacroCall(it) => { it.doc_comment_text() },
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|
2019-06-08 14:26:27 +00:00
|
|
|
}
|
2019-04-09 11:43:11 +00:00
|
|
|
|
2019-06-09 15:59:59 +00:00
|
|
|
/// Get a description of a symbol.
|
2019-06-08 14:26:27 +00:00
|
|
|
///
|
|
|
|
/// e.g. `struct Name`, `enum Name`, `fn Name`
|
2019-06-10 16:34:43 +00:00
|
|
|
pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
|
2019-07-12 16:41:13 +00:00
|
|
|
let parse = db.parse(symbol.file_id);
|
2019-09-25 01:32:01 +00:00
|
|
|
let node = symbol.ptr.to_node(parse.tree().syntax());
|
2019-06-09 16:20:49 +00:00
|
|
|
|
2019-10-05 14:03:03 +00:00
|
|
|
match_ast! {
|
|
|
|
match node {
|
|
|
|
ast::FnDef(it) => { it.short_label() },
|
|
|
|
ast::StructDef(it) => { it.short_label() },
|
|
|
|
ast::EnumDef(it) => { it.short_label() },
|
|
|
|
ast::TraitDef(it) => { it.short_label() },
|
|
|
|
ast::Module(it) => { it.short_label() },
|
|
|
|
ast::TypeAliasDef(it) => { it.short_label() },
|
|
|
|
ast::ConstDef(it) => { it.short_label() },
|
|
|
|
ast::StaticDef(it) => { it.short_label() },
|
|
|
|
ast::RecordFieldDef(it) => { it.short_label() },
|
|
|
|
ast::EnumVariant(it) => { it.short_label() },
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|
2019-01-11 10:01:35 +00:00
|
|
|
}
|