* Replace all occurrences of a wildcard in an expression with a the corresponding non-wildcard, e.g. `_x` -> `x`
(expr: Expression)
| 1470 | * For each rule in the rule set that matches, return the full `RuleStep` |
| 1471 | * (replacement value with its provenance: the rule id in `because`, plus |
| 1472 | * `purpose`). Used by callers that keep a step trace (`explain`). |
| 1473 | * |
| 1474 | * @param rules |
| 1475 | */ |
| 1476 | export function matchAnyRulesWithSteps( |
| 1477 | expr: Expression, |
| 1478 | rules: BoxedRuleSet, |
| 1479 | sub: BoxedSubstitution, |
| 1480 | options?: Partial<ReplaceOptions> |
| 1481 | ): RuleStep[] { |
| 1482 | const results: RuleStep[] = []; |
| 1483 | |
| 1484 | const collect = (rule: BoxedRule): void => { |
| 1485 | // Matching a single rule against a large expression (e.g. a |