提交 0135b521 编写于 作者: E Erick Tryzelaar

syntax: add syntax extension helper to make simple view items

上级 bb8721da
......@@ -242,6 +242,9 @@ fn meta_name_value(&self,
fn view_use(&self, sp: Span,
vis: ast::Visibility, vp: ~[@ast::ViewPath]) -> ast::ViewItem;
fn view_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> ast::ViewItem;
fn view_use_simple_(&self, sp: Span, vis: ast::Visibility,
ident: ast::Ident, path: ast::Path) -> ast::ViewItem;
fn view_use_list(&self, sp: Span, vis: ast::Visibility,
path: ~[ast::Ident], imports: &[ast::Ident]) -> ast::ViewItem;
fn view_use_glob(&self, sp: Span,
......@@ -900,6 +903,20 @@ fn view_use(&self, sp: Span,
}
}
fn view_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> ast::ViewItem {
let last = path.segments.last().unwrap().identifier;
self.view_use_simple_(sp, vis, last, path)
}
fn view_use_simple_(&self, sp: Span, vis: ast::Visibility,
ident: ast::Ident, path: ast::Path) -> ast::ViewItem {
self.view_use(sp, vis,
~[@respan(sp,
ast::ViewPathSimple(ident,
path,
ast::DUMMY_NODE_ID))])
}
fn view_use_list(&self, sp: Span, vis: ast::Visibility,
path: ~[ast::Ident], imports: &[ast::Ident]) -> ast::ViewItem {
let imports = imports.map(|id| {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册