本文整理汇总了PHP中Zephir\Call::addCallStatusOrJump方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::addCallStatusOrJump方法的具体用法?PHP Call::addCallStatusOrJump怎么用?PHP Call::addCallStatusOrJump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zephir\Call
的用法示例。
在下文中一共展示了Call::addCallStatusOrJump方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optimize
/**
*
* @param array $expression
* @param Call $call
* @param CompilationContext $context
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("'phql_parse_phql' only accepts one parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$symbolVariable->setDynamicTypes('array');
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
$context->headersManager->add('phalcon/mvc/model/query/scanner', HeadersManager::POSITION_LAST);
$context->headersManager->add('phalcon/mvc/model/query/phql', HeadersManager::POSITION_LAST);
$call->addCallStatusFlag($context);
$context->codePrinter->output('ZEPHIR_LAST_CALL_STATUS = phql_parse_phql(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ' TSRMLS_CC);');
$call->checkTempParameters($context);
$call->addCallStatusOrJump($context);
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
示例2: optimize
/**
*
* @param array $expression
* @param Call $call
* @param CompilationContext $context
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
throw new CompilerException("This function requires parameters", $expression);
}
if (count($expression['parameters']) != 2) {
throw new CompilerException("This function only requires two parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable(true, $context);
if (!$symbolVariable->isVariable()) {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
/**
* Add the last call status to the current symbol table
*/
$call->addCallStatusFlag($context);
$context->headersManager->add('kernel/object');
$symbolVariable->setDynamicTypes('object');
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
/**
* Add the last call status to the current symbol table
*/
$call->addCallStatusFlag($context);
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ' TSRMLS_CC);');
$call->addCallStatusOrJump($context);
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
示例3: optimize
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression|mixed
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 2) {
return false;
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable(true, $context);
if ($symbolVariable) {
if (!$symbolVariable->isVariable()) {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
} else {
$symbolVariable = $context->symbolTable->addTemp('variable', $context);
$symbolVariable->initVariant($context);
}
/**
* Add the last call status to the current symbol table
*/
$call->addCallStatusFlag($context);
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
$context->headersManager->add('kernel/fcall');
/**
* Add the last call status to the current symbol table
*/
$call->addCallStatusFlag($context);
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('ZEPHIR_CALL_USER_FUNC_ARRAY(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');');
$call->addCallStatusOrJump($context);
return new CompiledExpression('variable', $symbolVariable->getName(), $expression);
}