1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use rnode::{VisitMut, VisitMutWith};
use stc_ts_types::{Ref, Type};
pub struct ExpansionPreventer {
pub is_for_ignoring: bool,
}
impl VisitMut<Ref> for ExpansionPreventer {
fn visit_mut(&mut self, ty: &mut Ref) {
ty.visit_mut_children_with(self);
if self.is_for_ignoring {
ty.metadata.ignore_no_expand = true;
} else {
ty.metadata.no_expand = true;
}
}
}
impl VisitMut<Type> for ExpansionPreventer {
fn visit_mut(&mut self, ty: &mut Type) {
ty.normalize_mut();
ty.visit_mut_children_with(self)
}
}