提交 600237fa 编写于 作者: N Nick Cameron

Add a sig module to save-analysis

Generates signatures for use in Rustdoc and similar tools.
上级 e2eaef84
......@@ -44,6 +44,7 @@
pub mod external_data;
#[macro_use]
pub mod span_utils;
mod sig;
use rustc::hir;
use rustc::hir::def::Def;
......
此差异已折叠。
......@@ -370,6 +370,10 @@ pub fn path_to_string(p: &ast::Path) -> String {
to_string(|s| s.print_path(p, false, 0, false))
}
pub fn path_segment_to_string(p: &ast::PathSegment) -> String {
to_string(|s| s.print_path_segment(p, false))
}
pub fn ident_to_string(id: ast::Ident) -> String {
to_string(|s| s.print_ident(id))
}
......@@ -2359,18 +2363,27 @@ fn print_path(&mut self,
if i > 0 {
word(&mut self.s, "::")?
}
if segment.identifier.name != keywords::CrateRoot.name() &&
segment.identifier.name != "$crate" {
self.print_ident(segment.identifier)?;
if let Some(ref parameters) = segment.parameters {
self.print_path_parameters(parameters, colons_before_params)?;
}
}
self.print_path_segment(segment, colons_before_params)?;
}
Ok(())
}
fn print_path_segment(&mut self,
segment: &ast::PathSegment,
colons_before_params: bool)
-> io::Result<()>
{
if segment.identifier.name != keywords::CrateRoot.name() &&
segment.identifier.name != "$crate" {
self.print_ident(segment.identifier)?;
if let Some(ref parameters) = segment.parameters {
self.print_path_parameters(parameters, colons_before_params)?;
}
}
Ok(())
}
fn print_qpath(&mut self,
path: &ast::Path,
qself: &ast::QSelf,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册