diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-03-18 16:47:09 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-04-06 11:48:19 +0300 |
| commit | e2afefd80bf779bc3c6f697a3c6cc3a476993602 (patch) | |
| tree | c419ff9b09e7065348264eff44e4c45d05060c4e /src/libsyntax_pos | |
| parent | 8719d1ed05761b344d611ae0893b1d994b6ebe6f (diff) | |
Get rid of `SpannedIdent`
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 661a28d8375..279f1dec142 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -41,7 +41,12 @@ impl Ident { Ident::with_empty_ctxt(Symbol::intern(string)) } - pub fn without_first_quote(&self) -> Ident { + /// Replace `lo` and `hi` with those from `span`, but keep hygiene context. + pub fn with_span_pos(self, span: Span) -> Ident { + Ident::new(self.name, span.with_ctxt(self.span.ctxt())) + } + + pub fn without_first_quote(self) -> Ident { Ident::new(Symbol::from(self.name.as_str().trim_left_matches('\'')), self.span) } |
