Permalink
Browse files

Fix unlikely and likely to also work on variables

  • Loading branch information...
steffen
steffen committed Jun 2, 2015
1 parent 456a45d commit 99870fd3f36ae5e7e48e3f0407d066b0baa3b98b
Showing with 2 additions and 2 deletions.
  1. +1 −1 Library/Operators/Other/LikelyOperator.php
  2. +1 −1 Library/Operators/Other/UnlikelyOperator.php
@@ -60,7 +60,7 @@ public function compile(array $expression, CompilationContext $compilationContex
return new CompiledExpression('bool', 'likely(' . $variable->getName() . ')', $expression);
default:
throw new CompilerException("Cannot use expression variable type: '" . $variable->getType() . "' in 'likely' operator", $expression['left']);
return new CompiledExpression('bool', 'unlikely(zephir_is_true(' . $variable->getName() . '))', $expression);
}
}
@@ -60,7 +60,7 @@ public function compile($expression, CompilationContext $compilationContext)
case 'bool':
return new CompiledExpression('bool', 'unlikely(' . $variable->getName() . ')', $expression);
default:
throw new CompilerException("Cannot use expression variable type: '" . $variable->getType() . "' in 'unlikely' operator", $expression['left']);
return new CompiledExpression('bool', 'unlikely(zephir_is_true(' . $variable->getName() . '))', $expression);
}
}

0 comments on commit 99870fd

Please sign in to comment.