import { tryCompileSimpleDirectScalarFormula } from '../../formula/simple-direct-scalar-compile.js';
export function tryRewriteSimpleDirectScalarFormulaSourcePreservingBinding(existing, definedNameCount, source, rewriteCompiled) {
    if (existing?.directScalar === undefined ||
        existing.directAggregate !== undefined ||
        existing.directCriteria !== undefined ||
        existing.directLookup !== undefined ||
        definedNameCount !== 0) {
        return false;
    }
    const compiled = tryCompileSimpleDirectScalarFormula(source);
    return compiled !== undefined && rewriteCompiled(compiled);
}
//# sourceMappingURL=formula-binding-direct-scalar-rewrite.js.map