protected function compile($expr, Context $context)
{
$compiler = $context->getExpressionCompiler();
if ($expr->name == "class") {
// @todo return fully qualified classname
return new CompiledExpression();
}
$leftCE = $compiler->compile($expr->class);
if ($leftCE->isObject()) {
$leftCEValue = $leftCE->getValue();
if ($leftCEValue instanceof ClassDefinition) {
if (!$leftCEValue->hasConst($expr->name, true)) {
$context->notice('language_error', sprintf('Constant %s does not exist in %s scope', $expr->name, $expr->class), $expr);
return new CompiledExpression(CompiledExpression::UNKNOWN);
}
return new CompiledExpression();
}
}
$context->debug('Unknown const fetch', $expr);
return new CompiledExpression();
}