Skip to content

Commit

Permalink
Add HygieneData::default_transparency.
Browse files Browse the repository at this point in the history
Also use `HygieneData::expn_info` in an appropriate place.
  • Loading branch information
nnethercote committed Jun 4, 2019
1 parent 0ba36ea commit 7bec8c9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/libsyntax_pos/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl Mark {

#[inline]
pub fn expn_info(self) -> Option<ExpnInfo> {
HygieneData::with(|data| data.marks[self.0 as usize].expn_info.clone())
HygieneData::with(|data| data.expn_info(self))
}

#[inline]
Expand Down Expand Up @@ -214,6 +214,10 @@ impl HygieneData {
true
}

fn default_transparency(&self, mark: Mark) -> Transparency {
self.marks[mark.0 as usize].default_transparency
}

fn modern(&self, ctxt: SyntaxContext) -> SyntaxContext {
self.syntax_contexts[ctxt.0 as usize].opaque
}
Expand Down Expand Up @@ -287,7 +291,7 @@ impl SyntaxContext {
pub fn apply_mark(self, mark: Mark) -> SyntaxContext {
assert_ne!(mark, Mark::root());
self.apply_mark_with_transparency(
mark, HygieneData::with(|data| data.marks[mark.0 as usize].default_transparency)
mark, HygieneData::with(|data| data.default_transparency(mark))
)
}

Expand Down

0 comments on commit 7bec8c9

Please sign in to comment.