Assuming expr is a function, attempts to match the patterns * to the arguments of the function.
( expr: Expression, pattern: Expression, substitution: BoxedSubstitution, options: MatchOptions )
| 340 | if ( |
| 341 | operator === 'Divide' && |
| 342 | isNumber(expr) && |
| 343 | !expr.denominator.isSame(1) |
| 344 | ) { |
| 345 | // Create a synthetic Divide expression to match against |
| 346 | const divideExpr = ce.function( |
| 347 | 'Divide', |
| 348 | [expr.numerator, expr.denominator], |
| 349 | { form: 'structural' } |
| 350 | ); |
| 351 | return matchArguments(divideExpr, pattern.ops, substitution, options); |
| 352 | } |
| 353 | |
| 354 | // Special case: Match Multiply(Rational(1, n), x) against a Divide pattern |
| 355 | // This handles cases like x/2 which is canonicalized as x * (1/2) |
| 356 | if ( |
| 357 | operator === 'Divide' && |
| 358 | isFunction(expr) && |
| 359 | expr.operator === 'Multiply' && |
| 360 | headAdmits(operator, expr) |
| 361 | ) { |
| 362 | const ops = expr.ops; |
| 363 | for (let i = 0; i < ops.length; i++) { |
no test coverage detected