protected function compile($expr, Context $context)
{
$left = $context->getExpressionCompiler()->compile($expr->left);
$right = $context->getExpressionCompiler()->compile($expr->right);
if ($left->isTypeKnown() && $right->isTypeKnown()) {
if ($left->getValue() == $right->getValue()) {
return new CompiledExpression(CompiledExpression::INTEGER, 0);
} elseif ($left->getValue() < $right->getValue()) {
return new CompiledExpression(CompiledExpression::INTEGER, -1);
} elseif ($left->getValue() > $right->getValue()) {
return new CompiledExpression(CompiledExpression::INTEGER, 1);
}
}
return new CompiledExpression();
}