Changeset View
Changeset View
Standalone View
Standalone View
src/hardpoint/ArcanistHardpointTask.php
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | if ($this->generator) { | ||||
| $this->hasRewound = true; | $this->hasRewound = true; | ||||
| $generator->rewind(); | $generator->rewind(); | ||||
| } else if ($has_send) { | } else if ($has_send) { | ||||
| $generator->send($send_value); | $generator->send($send_value); | ||||
| } else { | } else { | ||||
| $generator->next(); | $generator->next(); | ||||
| } | } | ||||
| $generator_result = null; | |||||
| if ($generator->valid()) { | if ($generator->valid()) { | ||||
| $result = $generator->current(); | $result = $generator->current(); | ||||
| if ($result instanceof Future) { | if ($result instanceof Future) { | ||||
| $result = new ArcanistHardpointFutureList($result); | $result = new ArcanistHardpointFutureList($result); | ||||
| } | } | ||||
| if ($result instanceof ArcanistHardpointFutureList) { | if ($result instanceof ArcanistHardpointFutureList) { | ||||
| Show All 36 Lines | if ($this->generator) { | ||||
| foreach ($request_list as $blocking_request) { | foreach ($request_list as $blocking_request) { | ||||
| $this->blockingRequests[] = $blocking_request; | $this->blockingRequests[] = $blocking_request; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| if ($result instanceof ArcanistHardpointTaskResult) { | |||||
| $generator_result = $result; | |||||
| } else { | |||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Hardpoint generator (for query "%s") yielded an unexpected '. | 'Hardpoint generator (for query "%s") yielded an unexpected '. | ||||
| 'value. Generators may only yield "Future" or '. | 'value (of type "%s").', | ||||
| '"ArcanistHardpointRequest" objects, got "%s".', | |||||
| get_class($query), | get_class($query), | ||||
| phutil_describe_type($result))); | phutil_describe_type($result))); | ||||
| } | } | ||||
| } | |||||
| $this->generator = null; | $this->generator = null; | ||||
| if ($generator_result !== null) { | |||||
| $result = $generator_result->getValue(); | |||||
| } else { | |||||
| $result = $generator->getReturn(); | $result = $generator->getReturn(); | ||||
| } | |||||
| $this->attachResult($result); | $this->attachResult($result); | ||||
| return true; | return true; | ||||
| } | } | ||||
| $objects = $this->getObjects(); | $objects = $this->getObjects(); | ||||
| $hardpoint = $this->getRequest()->getHardpoint(); | $hardpoint = $this->getRequest()->getHardpoint(); | ||||
| ▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines | |||||