self.unresolved_imports += 1;
if is_public {
- module_.pub_count.set(module_.pub_count.get() + 1);
+ module_.inc_pub_count();
}
// Bump the reference count on the name. Or, if this is a glob, set
// Set the glob flag. This tells us that we don't know the
// module's exports ahead of time.
- module_.glob_count.set(module_.glob_count.get() + 1);
+ module_.inc_glob_count();
if is_public {
- module_.pub_glob_count.set(module_.pub_glob_count.get() + 1);
+ module_.inc_pub_glob_count();
}
}
}
}
}
+impl Module {
+ pub fn inc_glob_count(&self) {
+ self.glob_count.set(self.glob_count.get() + 1);
+ }
+ pub fn dec_glob_count(&self) {
+ assert!(self.glob_count.get() > 0);
+ self.glob_count.set(self.glob_count.get() - 1);
+ }
+ pub fn inc_pub_count(&self) {
+ self.pub_count.set(self.pub_count.get() + 1);
+ }
+ pub fn dec_pub_count(&self) {
+ assert!(self.pub_count.get() > 0);
+ self.pub_count.set(self.pub_count.get() - 1);
+ }
+ pub fn inc_pub_glob_count(&self) {
+ self.pub_glob_count.set(self.pub_glob_count.get() + 1);
+ }
+ pub fn dec_pub_glob_count(&self) {
+ assert!(self.pub_glob_count.get() > 0);
+ self.pub_glob_count.set(self.pub_glob_count.get() - 1);
+ }
+}
+
impl fmt::Debug for Module {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}, kind: {:?}, {}",
if resolution_result.success() {
match import_directive.subclass {
GlobImport => {
- assert!(module_.glob_count.get() >= 1);
- module_.glob_count.set(module_.glob_count.get() - 1);
+ module_.dec_glob_count();
if import_directive.is_public {
- assert!(module_.pub_glob_count.get() >= 1);
- module_.pub_glob_count.set(module_.pub_glob_count.get() - 1);
+ module_.dec_pub_glob_count();
}
}
SingleImport(..) => {
}
}
if import_directive.is_public {
- assert!(module_.pub_count.get() >= 1);
- module_.pub_count.set(module_.pub_count.get() - 1);
+ module_.dec_pub_count();
}
}