message: Add logic, but disable FeatureFlag as TODO
diff: @@ -442,6 +442,12 @@ pub enum FeatureFlag {
  Xor,
  }
  +impl FeatureFlag {
  + pub fn is_enabled(&self) -> bool {
  + todo!("Handle features")
  + }
  +}
  +
  /// An multi-variate polynomial over the base ring `C` with
  /// variables
  ///
  @@ -589,14 +595,15 @@ impl<F: FftField> PolishToken<F> {
  cache.push(x);
  }
  Load(i) => stack.push(cache[*i]),
  - SkipIf(_feature, count) => {
  - todo!("Handle features");
  + SkipIf(feature, count) => {
  + if !feature.is_enabled() {
  skip_count = *count;
  stack.push(F::zero());
  }
  }
  }
  }
  + }
  assert_eq!(stack.len(), 1);
  Ok(stack[0])
  @@ -1365,12 +1372,15 @@ impl<F: FftField> Expr<ConstantExpr<F>> {
  UnnormalizedLagrangeBasis(i) => Ok(unnormalized_lagrange_basis(&d, *i, &pt)),
  Cell(v) => v.evaluate(evals),
  Cache(_, e) => e.evaluate_(d, pt, evals, c),
  - EnabledIf(_feature, _e) => {
  - todo!("Handle features");
  + EnabledIf(feature, e) => {
  + if feature.is_enabled() {
  + e.evaluate_(d, pt, evals, c)
  + } else {
  Ok(F::zero())
  }
  }
  }
  + }
  /// Evaluate the constant expressions in this expression down into field elements.
  pub fn evaluate_constants(&self, env: &Environment<F>) -> Expr<F> {
  @@ -1416,12 +1426,15 @@ impl<F: FftField> Expr<F> {
  UnnormalizedLagrangeBasis(i) => Ok(unnormalized_lagrange_basis(&d, *i, &pt)),
  Cell(v) => v.evaluate(evals),
  Cache(_, e) => e.evaluate(d, pt, evals),
  - EnabledIf(_feature, _e) => {
  - todo!("Handle features");
  + EnabledIf(feature, e) => {
  + if feature.is_enabled() {
  + e.evaluate(d, pt, evals)
  + } else {
  Ok(F::zero())
  }
  }
  }
  + }
  /// Compute the polynomial corresponding to this expression, in evaluation form.
  pub fn evaluations<'a>(&self, env: &Environment<'a, F>) -> Evaluations<F, D<F>> {
  @@ -1584,10 +1597,16 @@ impl<F: FftField> Expr<F> {
  }
  }
  }
  - Expr::EnabledIf(_feature, _e) => {
  - todo!("Handle features");
  + Expr::EnabledIf(feature, e) => {
  + if feature.is_enabled() {
  + /* Clone the cache, to make sure we don't try to access cached statements later
  + when the feature flag is off. */
  + let mut cache = cache.clone();
  + return e.evaluations_helper(&mut cache, d, env);
  + } else {
  EvalResult::Constant(F::zero())
  }
  + }
  };
  Either::Left(res)
  }
  @@ -1816,12 +1835,15 @@ impl<F: Neg<Output = F> + Clone + One + Zero + PartialEq> Expr<F> {
  let x = x.monomials(ev);
  mul_monomials(&x, &x)
  }
  - EnabledIf(_feature, _x) => {
  - todo!("Handle features");
  + EnabledIf(feature, x) => {
  + if feature.is_enabled() {
  + x.monomials(ev)
  + } else {
  HashMap::default()
  }
  }
  }
  + }
  /// There is an optimization in PLONK called "linearization" in which a certain
  /// polynomial is expressed as a linear combination of other polynomials in order
  