import { ast, elementExpressionFromPredicate } from "../ast.js";
import { tryOrLog } from "./_shared.js";
export const dynamicViewRulePredicate = (_services) => {
  return tryOrLog((predicate, accept) => {
    const expr = elementExpressionFromPredicate(predicate.value);
    switch (true) {
      case ast.isElementKindExpression(expr):
      case ast.isElementTagExpression(expr):
      case ast.isWildcardExpression(expr): {
        accept("warning", `Predicate is ignored, as not supported in dynamic views`, {
          node: predicate
        });
        return;
      }
    }
  });
};
