$hash static method

$int $hash(
  1. Runtime runtime,
  2. $Value? target,
  3. List<$Value?> args
)

dart_eval implementation of Object.hash

Strange implementation is due to the use of internal-only APIs in the original method

Implementation

static $int $hash(Runtime runtime, $Value? target, List<$Value?> args) {
  final object1 = args[0]?.$value;
  final object2 = args[1]?.$value;
  final object3 = args.length > 2 ? args[2] : null;
  final object4 = args.length > 3 ? args[3] : null;
  final object5 = args.length > 4 ? args[4] : null;
  final object6 = args.length > 5 ? args[5] : null;
  final object7 = args.length > 6 ? args[6] : null;
  final object8 = args.length > 7 ? args[7] : null;
  final object9 = args.length > 8 ? args[8] : null;
  final object10 = args.length > 9 ? args[9] : null;
  final object11 = args.length > 10 ? args[10] : null;
  final object12 = args.length > 11 ? args[11] : null;
  final object13 = args.length > 12 ? args[12] : null;

  if (null == args[2]) {
    return $int(Object.hash(object1, object2));
  }
  if (null == args[3]) {
    return $int(Object.hash(object1, object2, object3!.$value));
  }
  if (null == args[4]) {
    return $int(
        Object.hash(object1, object2, object3!.$value, object4!.$value));
  }
  if (null == args[5]) {
    return $int(Object.hash(
        object1, object2, object3!.$value, object4!.$value, object5!.$value));
  }
  if (null == args[6]) {
    return $int(Object.hash(object1, object2, object3!.$value,
        object4!.$value, object5!.$value, object6!.$value));
  }
  if (null == args[7]) {
    return $int(Object.hash(object1, object2, object3!.$value,
        object4!.$value, object5!.$value, object6!.$value, object7!.$value));
  }
  if (null == args[8]) {
    return $int(Object.hash(
        object1,
        object2,
        object3!.$value,
        object4!.$value,
        object5!.$value,
        object6!.$value,
        object7!.$value,
        object8!.$value));
  }
  if (null == args[9]) {
    return $int(Object.hash(
        object1,
        object2,
        object3!.$value,
        object4!.$value,
        object5!.$value,
        object6!.$value,
        object7!.$value,
        object8!.$value,
        object9!.$value));
  }
  if (null == args[10]) {
    return $int(Object.hash(
        object1,
        object2,
        object3!.$value,
        object4!.$value,
        object5!.$value,
        object6!.$value,
        object7!.$value,
        object8!.$value,
        object9!.$value,
        object10!.$value));
  }
  if (null == args[11]) {
    return $int(Object.hash(
        object1,
        object2,
        object3!.$value,
        object4!.$value,
        object5!.$value,
        object6!.$value,
        object7!.$value,
        object8!.$value,
        object9!.$value,
        object10!.$value,
        object11!.$value));
  }
  if (null == args[12]) {
    return $int(Object.hash(
        object1,
        object2,
        object3!.$value,
        object4!.$value,
        object5!.$value,
        object6!.$value,
        object7!.$value,
        object8!.$value,
        object9!.$value,
        object10!.$value,
        object11!.$value,
        object12!.$value));
  }
  return $int(Object.hash(
      object1,
      object2,
      object3!.$value,
      object4!.$value,
      object5!.$value,
      object6!.$value,
      object7!.$value,
      object8!.$value,
      object9!.$value,
      object10!.$value,
      object11!.$value,
      object12!.$value,
      object13!.$value));
}