Add HygieneData::marks
.
This commit is contained in:
parent
88fd7a8eb7
commit
a02b2e36c0
@ -244,6 +244,19 @@ fn remove_mark(&self, ctxt: &mut SyntaxContext) -> Mark {
|
||||
outer_mark
|
||||
}
|
||||
|
||||
fn marks(&self, mut ctxt: SyntaxContext) -> Vec<(Mark, Transparency)> {
|
||||
let mut marks = Vec::new();
|
||||
while ctxt != SyntaxContext::empty() {
|
||||
let outer_mark = self.outer(ctxt);
|
||||
let transparency = self.transparency(ctxt);
|
||||
let prev_ctxt = self.prev_ctxt(ctxt);
|
||||
marks.push((outer_mark, transparency));
|
||||
ctxt = prev_ctxt;
|
||||
}
|
||||
marks.reverse();
|
||||
marks
|
||||
}
|
||||
|
||||
fn adjust(&self, ctxt: &mut SyntaxContext, expansion: Mark) -> Option<Mark> {
|
||||
let mut scope = None;
|
||||
while !self.is_descendant_of(expansion, self.outer(*ctxt)) {
|
||||
@ -423,19 +436,8 @@ pub fn remove_mark(&mut self) -> Mark {
|
||||
HygieneData::with(|data| data.remove_mark(self))
|
||||
}
|
||||
|
||||
pub fn marks(mut self) -> Vec<(Mark, Transparency)> {
|
||||
HygieneData::with(|data| {
|
||||
let mut marks = Vec::new();
|
||||
while self != SyntaxContext::empty() {
|
||||
let outer_mark = data.outer(self);
|
||||
let transparency = data.transparency(self);
|
||||
let prev_ctxt = data.prev_ctxt(self);
|
||||
marks.push((outer_mark, transparency));
|
||||
self = prev_ctxt;
|
||||
}
|
||||
marks.reverse();
|
||||
marks
|
||||
})
|
||||
pub fn marks(self) -> Vec<(Mark, Transparency)> {
|
||||
HygieneData::with(|data| data.marks(self))
|
||||
}
|
||||
|
||||
/// Adjust this context for resolution in a scope created by the given expansion.
|
||||
|
Loading…
Reference in New Issue
Block a user