ml_switcheroo.core.rewriter.calls.dispatch¶

Logic for Conditional API Dispatch.

Handles evaluation of ODL Rules at runtime to switch APIs based on argument values.

Functions¶

evaluate_dispatch_rules(→ Optional[str])

Evaluates conditional dispatch rules against the current call arguments.

Module Contents¶

ml_switcheroo.core.rewriter.calls.dispatch.evaluate_dispatch_rules(rewriter, node: libcst.Call, rules: List[Any], details: Dict[str, Any]) → str | None¶

Evaluates conditional dispatch rules against the current call arguments.

Parameters:
  • rewriter – The calling Rewriter (CallMixin) instance.

  • node – The CST Call node.

  • rules – List of Rule objects.

  • details – Semantic definition details.

Returns:

targeted API string if a rule matches, else None.

Return type:

Optional[str]