Pre: add some 'am I a pattern?' helper predicates to clause types.
This commit is contained in:
parent
d2e6b767c6
commit
439f3a2283
1 changed files with 19 additions and 0 deletions
|
@ -504,12 +504,31 @@ pub enum UnifyVars {
|
||||||
Explicit(Vec<Variable>),
|
Explicit(Vec<Variable>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WhereClause {
|
||||||
|
pub fn is_pattern(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
&WhereClause::Pattern(_) => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub enum OrWhereClause {
|
pub enum OrWhereClause {
|
||||||
Clause(WhereClause),
|
Clause(WhereClause),
|
||||||
And(Vec<WhereClause>),
|
And(Vec<WhereClause>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl OrWhereClause {
|
||||||
|
pub fn is_pattern_or_patterns(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
&OrWhereClause::Clause(WhereClause::Pattern(_)) => true,
|
||||||
|
&OrWhereClause::And(ref clauses) => clauses.iter().all(|clause| clause.is_pattern()),
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct OrJoin {
|
pub struct OrJoin {
|
||||||
pub unify_vars: UnifyVars,
|
pub unify_vars: UnifyVars,
|
||||||
|
|
Loading…
Reference in a new issue