ownQueueCall function

MethodInvocation? ownQueueCall(
  1. Expression waited
)

The call of the enclosing controller's own queue that waited waits for: method(...).value and method(...).done for a method of a Solo that returns a SoloJob, and close() and cancelAll() of a Solo.

A wait in a SoloLanes is not among these: queueLaneOf tells whether it is for the lane the job runs in.

Implementation

MethodInvocation? ownQueueCall(Expression waited) {
  final call = queueCallOf(waited);
  if (call == null) return null;
  final jobOf = waited is PropertyAccess;
  final own = _ownMethodOf(call);
  if (own == null) return null;
  final (method, owner) = own;
  if (jobOf) {
    return isSolo(owner) && _returnsSoloJob(call, method) ? call : null;
  }
  // Both close and cancelAll are members of SoloController, so a method of
  // the controller by either name is its own or overrides it; the one of a
  // mixin on SoloController, such as SoloStream, counts in a Solo.
  final ofSolo =
      isSolo(owner) ||
      (isSoloController(owner) && isSolo(controllerAround(call)));
  return ofSolo ? call : null;
}