add module-level goal_expansion and term_expansion

This commit is contained in:
Mark Thom
2019-01-05 22:02:06 -07:00
parent 042779cff9
commit da731ad1f9
4 changed files with 105 additions and 42 deletions

View File

@@ -386,6 +386,7 @@ impl CompileTimeHook {
}
}
#[inline]
pub fn arity(self) -> usize {
match self {
CompileTimeHook::UserGoalExpansion
@@ -394,6 +395,24 @@ impl CompileTimeHook {
| CompileTimeHook::TermExpansion => 2
}
}
#[inline]
pub fn user_scope(self) -> Self {
match self {
CompileTimeHook::UserGoalExpansion | CompileTimeHook::GoalExpansion =>
CompileTimeHook::UserGoalExpansion,
CompileTimeHook::UserTermExpansion | CompileTimeHook::TermExpansion =>
CompileTimeHook::UserTermExpansion,
}
}
#[inline]
pub fn has_module_scope(self) -> bool {
match self {
CompileTimeHook::UserTermExpansion | CompileTimeHook::UserGoalExpansion => false,
_ => true
}
}
}
#[derive(Clone)]