diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-16 01:42:58 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-19 12:01:49 +0300 |
| commit | 09703e3843622430276d0b3c672fbc772ce0b862 (patch) | |
| tree | 0dc50e1c9b48fa2d9112783d32d9b15380e9f070 /src/libsyntax/ext | |
| parent | 31e10aec83d68df0f45cf6643cca4e90e9c1fb55 (diff) | |
| download | rust-09703e3843622430276d0b3c672fbc772ce0b862.tar.gz rust-09703e3843622430276d0b3c672fbc772ce0b862.zip | |
Adjust other names after the `Mark` renaming
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/derive.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 28 | ||||
| -rw-r--r-- | src/libsyntax/ext/placeholders.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 10 |
5 files changed, 28 insertions, 28 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 00b614d1584..926c9e88efe 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -685,7 +685,7 @@ pub trait Resolver { fn get_module_scope(&mut self, id: ast::NodeId) -> ExpnId; fn resolve_dollar_crates(&mut self); - fn visit_ast_fragment_with_placeholders(&mut self, mark: ExpnId, fragment: &AstFragment, + fn visit_ast_fragment_with_placeholders(&mut self, expn_id: ExpnId, fragment: &AstFragment, derives: &[ExpnId]); fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>); @@ -705,7 +705,7 @@ pub struct ModuleData { #[derive(Clone)] pub struct ExpansionData { - pub mark: ExpnId, + pub id: ExpnId, pub depth: usize, pub module: Rc<ModuleData>, pub directory_ownership: DirectoryOwnership, @@ -735,7 +735,7 @@ impl<'a> ExtCtxt<'a> { root_path: PathBuf::new(), resolver, current_expansion: ExpansionData { - mark: ExpnId::root(), + id: ExpnId::root(), depth: 0, module: Rc::new(ModuleData { mod_path: Vec::new(), directory: PathBuf::new() }), directory_ownership: DirectoryOwnership::Owned { relative: None }, @@ -763,13 +763,13 @@ impl<'a> ExtCtxt<'a> { pub fn parse_sess(&self) -> &'a parse::ParseSess { self.parse_sess } pub fn cfg(&self) -> &ast::CrateConfig { &self.parse_sess.config } pub fn call_site(&self) -> Span { - match self.current_expansion.mark.expn_info() { + match self.current_expansion.id.expn_info() { Some(expn_info) => expn_info.call_site, None => DUMMY_SP, } } pub fn backtrace(&self) -> SyntaxContext { - SyntaxContext::empty().apply_mark(self.current_expansion.mark) + SyntaxContext::empty().apply_mark(self.current_expansion.id) } /// Returns span for the macro which originally caused the current expansion to happen. @@ -877,7 +877,7 @@ impl<'a> ExtCtxt<'a> { ast::Ident::from_str(st) } pub fn std_path(&self, components: &[Symbol]) -> Vec<ast::Ident> { - let def_site = DUMMY_SP.apply_mark(self.current_expansion.mark); + let def_site = DUMMY_SP.apply_mark(self.current_expansion.id); iter::once(Ident::new(kw::DollarCrate, def_site)) .chain(components.iter().map(|&s| Ident::with_empty_ctxt(s))) .collect() @@ -900,7 +900,7 @@ pub fn expr_to_spanned_string<'a>( err_msg: &str, ) -> Result<Spanned<(Symbol, ast::StrStyle)>, Option<DiagnosticBuilder<'a>>> { // Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation. - expr.span = expr.span.apply_mark(cx.current_expansion.mark); + expr.span = expr.span.apply_mark(cx.current_expansion.id); // we want to be able to handle e.g., `concat!("foo", "bar")` cx.expander().visit_expr(&mut expr); diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs index 1c15deab373..ff9ad46deec 100644 --- a/src/libsyntax/ext/derive.rs +++ b/src/libsyntax/ext/derive.rs @@ -54,7 +54,7 @@ pub fn add_derived_markers<T>(cx: &mut ExtCtxt<'_>, span: Span, traits: &[ast::P names.insert(unwrap_or!(path.segments.get(0), continue).ident.name); } - let span = span.fresh_expansion(cx.current_expansion.mark, ExpnInfo::allow_unstable( + let span = span.fresh_expansion(cx.current_expansion.id, ExpnInfo::allow_unstable( ExpnKind::Macro(MacroKind::Derive, Symbol::intern(&pretty_name)), span, cx.parse_sess.edition, cx.allow_derive_markers.clone(), )); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 8eb26ae8d33..ae72f1fd108 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -319,7 +319,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }; let scope = - if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark }; + if self.monotonic { invoc.expansion_data.id } else { orig_expansion_data.id }; let ext = match self.cx.resolver.resolve_macro_invocation(&invoc, scope, force) { Ok(ext) => ext, Err(Indeterminate) => { @@ -329,9 +329,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }; progress = true; - let ExpansionData { depth, mark, .. } = invoc.expansion_data; + let ExpansionData { depth, id: expn_id, .. } = invoc.expansion_data; self.cx.current_expansion = invoc.expansion_data.clone(); - self.cx.current_expansion.mark = scope; + self.cx.current_expansion.id = scope; // FIXME(jseyfried): Refactor out the following logic let (expanded_fragment, new_invocations) = if let Some(ext) = ext { @@ -362,13 +362,13 @@ impl<'a, 'b> MacroExpander<'a, 'b> { item.visit_attrs(|attrs| attrs.retain(|a| a.path != sym::derive)); let mut item_with_markers = item.clone(); add_derived_markers(&mut self.cx, item.span(), &traits, &mut item_with_markers); - let derives = derives.entry(invoc.expansion_data.mark).or_default(); + let derives = derives.entry(invoc.expansion_data.id).or_default(); derives.reserve(traits.len()); invocations.reserve(traits.len()); for path in traits { - let mark = ExpnId::fresh(self.cx.current_expansion.mark, None); - derives.push(mark); + let expn_id = ExpnId::fresh(self.cx.current_expansion.id, None); + derives.push(expn_id); invocations.push(Invocation { kind: InvocationKind::Derive { path, @@ -377,7 +377,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }, fragment_kind: invoc.fragment_kind, expansion_data: ExpansionData { - mark, + id: expn_id, ..invoc.expansion_data.clone() }, }); @@ -392,7 +392,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { if expanded_fragments.len() < depth { expanded_fragments.push(Vec::new()); } - expanded_fragments[depth - 1].push((mark, expanded_fragment)); + expanded_fragments[depth - 1].push((expn_id, expanded_fragment)); if !self.cx.ecfg.single_step { invocations.extend(new_invocations.into_iter().rev()); } @@ -405,7 +405,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { while let Some(expanded_fragments) = expanded_fragments.pop() { for (mark, expanded_fragment) in expanded_fragments.into_iter().rev() { let derives = derives.remove(&mark).unwrap_or_else(Vec::new); - placeholder_expander.add(NodeId::placeholder_from_mark(mark), + placeholder_expander.add(NodeId::placeholder_from_expn_id(mark), expanded_fragment, derives); } } @@ -444,7 +444,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { if self.monotonic { self.cx.resolver.visit_ast_fragment_with_placeholders( - self.cx.current_expansion.mark, &fragment, derives); + self.cx.current_expansion.id, &fragment, derives); } (fragment, invocations) @@ -493,7 +493,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } if self.cx.current_expansion.depth > self.cx.ecfg.recursion_limit { - let info = self.cx.current_expansion.mark.expn_info().unwrap(); + let info = self.cx.current_expansion.id.expn_info().unwrap(); let suggested_limit = self.cx.ecfg.recursion_limit * 2; let mut err = self.cx.struct_span_err(info.call_site, &format!("recursion limit reached while expanding the macro `{}`", @@ -822,17 +822,17 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { )), _ => None, }; - let mark = ExpnId::fresh(self.cx.current_expansion.mark, expn_info); + let expn_id = ExpnId::fresh(self.cx.current_expansion.id, expn_info); self.invocations.push(Invocation { kind, fragment_kind, expansion_data: ExpansionData { - mark, + id: expn_id, depth: self.cx.current_expansion.depth + 1, ..self.cx.current_expansion.clone() }, }); - placeholder(fragment_kind, NodeId::placeholder_from_mark(mark)) + placeholder(fragment_kind, NodeId::placeholder_from_expn_id(expn_id)) } fn collect_bang(&mut self, mac: ast::Mac, span: Span, kind: AstFragmentKind) -> AstFragment { diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index 872292bb600..17d8bf3ab17 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -88,7 +88,7 @@ impl<'a, 'b> PlaceholderExpander<'a, 'b> { fragment.mut_visit_with(self); if let AstFragment::Items(mut items) = fragment { for derive in derives { - match self.remove(NodeId::placeholder_from_mark(derive)) { + match self.remove(NodeId::placeholder_from_expn_id(derive)) { AstFragment::Items(derived_items) => items.extend(derived_items), _ => unreachable!(), } diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index e04fd2ddc05..845dac557e8 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -219,7 +219,7 @@ pub fn transcribe( if let NtTT(ref tt) = **nt { result.push(tt.clone().into()); } else { - sp = sp.apply_mark(cx.current_expansion.mark); + sp = sp.apply_mark(cx.current_expansion.id); let token = TokenTree::token(token::Interpolated(nt.clone()), sp); result.push(token.into()); } @@ -234,8 +234,8 @@ pub fn transcribe( // If we aren't able to match the meta-var, we push it back into the result but // with modified syntax context. (I believe this supports nested macros). let ident = - Ident::new(ident.name, ident.span.apply_mark(cx.current_expansion.mark)); - sp = sp.apply_mark(cx.current_expansion.mark); + Ident::new(ident.name, ident.span.apply_mark(cx.current_expansion.id)); + sp = sp.apply_mark(cx.current_expansion.id); result.push(TokenTree::token(token::Dollar, sp).into()); result.push(TokenTree::Token(Token::from_ast_ident(ident)).into()); } @@ -247,7 +247,7 @@ pub fn transcribe( // jump back out of the Delimited, pop the result_stack and add the new results back to // the previous results (from outside the Delimited). quoted::TokenTree::Delimited(mut span, delimited) => { - span = span.apply_mark(cx.current_expansion.mark); + span = span.apply_mark(cx.current_expansion.id); stack.push(Frame::Delimited { forest: delimited, idx: 0, span }); result_stack.push(mem::take(&mut result)); } @@ -255,7 +255,7 @@ pub fn transcribe( // Nothing much to do here. Just push the token to the result, being careful to // preserve syntax context. quoted::TokenTree::Token(token) => { - let mut marker = Marker(cx.current_expansion.mark); + let mut marker = Marker(cx.current_expansion.id); let mut tt = TokenTree::Token(token); noop_visit_tt(&mut tt, &mut marker); result.push(tt.into()); |
