findOperator method

InterpretedFunction? findOperator(
  1. String operatorSymbol
)

Implementation

InterpretedFunction? findOperator(String operatorSymbol) {
  final cached = _operatorResolutionCache[operatorSymbol];
  if (cached != null) return cached;

  final local = operators[operatorSymbol];
  if (local != null) return _operatorResolutionCache[operatorSymbol] = local;

  // Check applied mixins in reverse order
  for (int i = mixins.length - 1; i >= 0; i--) {
    final mixinOperator = mixins[i].findOperator(operatorSymbol);
    if (mixinOperator != null) {
      return _operatorResolutionCache[operatorSymbol] = mixinOperator;
    }
  }

  if (superclass != null) {
    final superOperator = superclass!.findOperator(operatorSymbol);
    if (superOperator != null) {
      return _operatorResolutionCache[operatorSymbol] = superOperator;
    }
    return null;
  }

  return null;
}