Asynchronously call methods of yielded objects, no extra syntax required (+ automatically release tagged commits)

This commit is contained in:
Daniil Gentili 2019-09-21 15:38:54 +02:00
parent 876278919a
commit 11a939c403
2 changed files with 13 additions and 2 deletions

View File

@ -217,6 +217,18 @@ final class Coroutine implements Promise, \ArrayAccess
})()); })());
} }
public function __get($offset)
{
return Tools::call((function () use ($offset) {
return (yield $this)->{$offset};
})());
}
public function __call($name, $arguments)
{
return Tools::call((function () use ($name, $arguments) {
return (yield $this)->{$name}(...$arguments);
})());
}
/** /**
* Get stacktrace from when the generator was started. * Get stacktrace from when the generator was started.
* *

View File

@ -91,7 +91,6 @@ find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} +
# Make sure conversion worked # Make sure conversion worked
for f in $(find phar5 -type f -name '*.php'); do php -l $f;done for f in $(find phar5 -type f -name '*.php'); do php -l $f;done
#[ "$TRAVIS_BRANCH" != "master" ] && branch="-$TRAVIS_BRANCH" || branch=""
branch="-$TRAVIS_BRANCH" branch="-$TRAVIS_BRANCH"
cd $madelinePath cd $madelinePath
php makephar.php $HOME/phar5 "madeline$php$branch.phar" $TRAVIS_COMMIT php makephar.php $HOME/phar5 "madeline$php$branch.phar" $TRAVIS_COMMIT
@ -135,7 +134,7 @@ cp "../madeline$php$branch.phar" .
cp ../phar.php ../mtproxyd . cp ../phar.php ../mtproxyd .
echo -n $TRAVIS_COMMIT > release$php$branch echo -n $TRAVIS_COMMIT > release$php$branch
echo "$TRAVIS_COMMIT_MESSAGE" | grep -i "subrelease" && { [ "$TRAVIS_COMMIT" != "$(git rev-parse "$TRAVIS_COMMIT" 2>/dev/null)" ] && {
cp release$php$branch release$php cp release$php$branch release$php
cp madeline$php$branch.phar madeline$php.phar cp madeline$php$branch.phar madeline$php.phar
} }