import 'validators.dart' show Validator, ValidatorFn;

ValidatorFn normalizeValidator(dynamic validator) {
  if (validator is Validator) {
    return (c) => validator.validate(c);
  } else {
    return validator as ValidatorFn;
  }
}

import 'validators.dart' show Validator, ValidatorFn;

ValidatorFn normalizeValidator(dynamic validator) {
  if (validator is Validator) {
    return (c) => validator.validate(c);
  } else if (validator is Function) {
    return validator as ValidatorFn;
  } else {
    return validator.call as ValidatorFn;
  }
}

Stop relying on Dart 1.0 behavior of callable classes.
Stop relying on Dart 1.0 behavior of callable classes.

Due to an upcoming change in Dart language semantics
(https://github.com/dart-lang/sdk/issues/32152), we can no longer use "callable classes" (those that contain a ".call" method) in a place where function types are expected.

To avoid breaking a lot of code, the front end will implicitly tear off ".call" when assigning a callable type to a function type.  This covers most Google3 code.  However, in a small number of cases the implicit tear-off is not sufficient, so we need to fix those cases manually.

Tested:
    tap_presubmit: http://test/OCL:186287469:BASE:186415347:1519218277328:530e6725
    Some tests failed; test failures are believed to be unrelated to this CL
PiperOrigin-RevId: 186468920
