diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-28 12:41:29 +0300 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-09-05 15:07:17 +0100 |
| commit | c8cf9f5a025bb475804b5a90f54aca310b952526 (patch) | |
| tree | 1c456dab13065396aa1ee1ac79a9574143b82663 /src/libsyntax/ext | |
| parent | 0b86782058c27ba694ec81ebe7108dceb0968a2b (diff) | |
| download | rust-c8cf9f5a025bb475804b5a90f54aca310b952526.tar.gz rust-c8cf9f5a025bb475804b5a90f54aca310b952526.zip | |
Add `with_{def_site,call_site,legacy}_ctxt,` methods to `Span`
Use these to create call-site spans for AST passes when needed.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 962447e8cf0..4c146611dea 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -3,7 +3,7 @@ use crate::attr::{HasAttrs, Stability, Deprecation}; use crate::source_map::SourceMap; use crate::edition::Edition; use crate::ext::expand::{self, AstFragment, Invocation}; -use crate::ext::hygiene::{ExpnId, Transparency}; +use crate::ext::hygiene::ExpnId; use crate::mut_visit::{self, MutVisitor}; use crate::parse::{self, parser, DirectoryOwnership}; use crate::parse::token; @@ -658,13 +658,13 @@ pub trait Resolver { extra_placeholders: &[NodeId]); fn register_builtin_macro(&mut self, ident: ast::Ident, ext: SyntaxExtension); - fn span_for_ast_pass( + fn expansion_for_ast_pass( &mut self, - span: Span, + call_site: Span, pass: AstPass, features: &[Symbol], parent_module_id: Option<NodeId>, - ) -> Span; + ) -> ExpnId; fn resolve_imports(&mut self); @@ -750,20 +750,20 @@ impl<'a> ExtCtxt<'a> { /// Equivalent of `Span::def_site` from the proc macro API, /// except that the location is taken from the span passed as an argument. pub fn with_def_site_ctxt(&self, span: Span) -> Span { - span.with_ctxt_from_mark(self.current_expansion.id, Transparency::Opaque) + span.with_def_site_ctxt(self.current_expansion.id) } /// Equivalent of `Span::call_site` from the proc macro API, /// except that the location is taken from the span passed as an argument. pub fn with_call_site_ctxt(&self, span: Span) -> Span { - span.with_ctxt_from_mark(self.current_expansion.id, Transparency::Transparent) + span.with_call_site_ctxt(self.current_expansion.id) } /// Span with a context reproducing `macro_rules` hygiene (hygienic locals, unhygienic items). /// FIXME: This should be eventually replaced either with `with_def_site_ctxt` (preferably), /// or with `with_call_site_ctxt` (where necessary). pub fn with_legacy_ctxt(&self, span: Span) -> Span { - span.with_ctxt_from_mark(self.current_expansion.id, Transparency::SemiTransparent) + span.with_legacy_ctxt(self.current_expansion.id) } /// Returns span for the macro which originally caused the current expansion to happen. |
