Skip to content

Commit

Permalink
fix some bugs in store functional
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Zolotilin committed Mar 30, 2020
1 parent 134e20a commit f33e9ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/hafriedlander/Peg/Parser/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct($string) {

protected function isCallable($name) {
return $this->isCallableCache[$name]
?? ($this->isCallableCache[$name] = \is_callable($this, $name));
?? ($this->isCallableCache[$name] = \is_callable([$this, $name]));
}

public function whitespace() {
Expand Down Expand Up @@ -156,13 +156,13 @@ public function store(&$result, $subres, $storetag = \null) {
$storecalled = \false;

foreach ($this->typestack($result['_matchrule']) as $type) {
if ($method = $this->isCallable($storetag ? "{$type}_{$storetag}" : "{$type}_{$subres['name']}")) {
if ($this->isCallable($method = $storetag ? "{$type}_{$storetag}" : "{$type}_{$subres['name']}")) {
$this->{$method}(...[&$result, $subres]);
$storecalled = \true;
break;
}

if ($method = $this->isCallable("{$type}_STR")) {
if ($this->isCallable($method = "{$type}_STR")) {
$this->{$method}(...[&$result, $subres]);
$storecalled = \true;
break;
Expand Down

0 comments on commit f33e9ba

Please sign in to comment.