diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2016-03-29 12:12:01 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-04-06 09:04:15 +0300 |
| commit | 7bebe80bc28ff818c7990061275fa0ad6c8b3686 (patch) | |
| tree | 55cbc78dd15233353b37d8242e5ba6434b20be2e /src/libsyntax/ast.rs | |
| parent | ef4c7241f82c08848938b8b2dafed01535559ec0 (diff) | |
| download | rust-7bebe80bc28ff818c7990061275fa0ad6c8b3686.tar.gz rust-7bebe80bc28ff818c7990061275fa0ad6c8b3686.zip | |
syntax: dismantle ast_util.
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index a441f2990cd..370dd0dad72 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -205,6 +205,23 @@ impl fmt::Display for Path { } } +impl Path { + // convert a span and an identifier to the corresponding + // 1-segment path + pub fn from_ident(s: Span, identifier: Ident) -> Path { + Path { + span: s, + global: false, + segments: vec!( + PathSegment { + identifier: identifier, + parameters: PathParameters::none() + } + ), + } + } +} + /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] |
