public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext)
    {
        if ('int' != $expression['left']['type'] && 'double' != $expression['left']['type']) {
            return false;
        }

        if ($compilationContext->config->get('constant-folding', 'optimizations')) {
            if ('int' == $expression['left']['type'] && 'int' == $expression['right']['type']) {
                switch ($this->operator) {
                    case '+':
                        return new CompiledExpression('int', $expression['left']['value'] + $expression['right']['value'], $expression);

                    case '-':
                        return new CompiledExpression('int', $expression['left']['value'] - $expression['right']['value'], $expression);

                    case '*':
                        return new CompiledExpression('int', $expression['left']['value'] * $expression['right']['value'], $expression);
                }
            }

            if (('double' == $expression['left']['type'] && 'double' == $expression['right']['type']) || ('double' == $expression['left']['type'] && 'int' == $expression['right']['type']) || ('int' == $expression['left']['type'] && 'double' == $expression['right']['type'])) {
                switch ($this->operator) {
                    case '+':
                        return new CompiledExpression('double', $expression['left']['value'] + $expression['right']['value'], $expression);

                    case '-':
                        return new CompiledExpression('double', $expression['left']['value'] - $expression['right']['value'], $expression);

                    case '*':
                        return new CompiledExpression('double', $expression['left']['value'] * $expression['right']['value'], $expression);
                }
            }
        }

        return false;
    }