本文整理汇总了PHP中Zephir\Variable::isDoublePointer方法的典型用法代码示例。如果您正苦于以下问题:PHP Variable::isDoublePointer方法的具体用法?PHP Variable::isDoublePointer怎么用?PHP Variable::isDoublePointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zephir\Variable
的用法示例。
在下文中一共展示了Variable::isDoublePointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ifVariableValueUndefined
public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $useBody = false, $useCodePrinter = true)
{
if ($var->isDoublePointer()) {
return parent::ifVariableValueUndefined($var, $context, $useBody, $useCodePrinter);
}
$body = 'Z_TYPE_P(' . $this->getVariableCode($var) . ') == IS_UNDEF';
$output = 'if (' . $body . ') {';
if ($useCodePrinter) {
$context->codePrinter->output($output);
}
return $useBody ? $body : $output;
}
示例2: generateInitCode
public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable)
{
$isComplex = $type == 'variable' || $type == 'string' || $type == 'array' || $type == 'resource' || $type == 'callable' || $type == 'object';
if ($isComplex && $variable->mustInitNull()) {
if ($variable->isLocalOnly()) {
$groupVariables[] = $variable->getName() . ' = zval_used_for_init';
} else {
if ($variable->isDoublePointer()) {
$groupVariables[] = $pointer . $pointer . $variable->getName() . ' = NULL';
} else {
$groupVariables[] = $pointer . $variable->getName() . ' = NULL';
}
}
return;
}
if ($variable->isLocalOnly()) {
$groupVariables[] = $variable->getName();
return;
}
if ($variable->isDoublePointer()) {
if ($variable->mustInitNull()) {
$groupVariables[] = $pointer . $pointer . $variable->getName() . ' = NULL';
} else {
$groupVariables[] = $pointer . $pointer . $variable->getName();
}
return;
}
$defaultValue = $variable->getDefaultInitValue();
if ($defaultValue !== null) {
switch ($type) {
case 'variable':
case 'string':
case 'array':
case 'resource':
case 'callable':
case 'object':
$groupVariables[] = $pointer . $variable->getName();
break;
case 'char':
if (strlen($defaultValue) > 4) {
if (strlen($defaultValue) > 10) {
throw new CompilerException("Invalid char literal: '" . substr($defaultValue, 0, 10) . "...'", $variable->getOriginal());
} else {
throw new CompilerException("Invalid char literal: '" . $defaultValue . "'", $variable->getOriginal());
}
}
/* no break */
/* no break */
default:
$groupVariables[] = $pointer . $variable->getName() . ' = ' . $defaultValue;
break;
}
return;
}
if ($variable->mustInitNull() && $pointer) {
$groupVariables[] = $pointer . $variable->getName() . ' = NULL';
return;
}
$groupVariables[] = $pointer . $variable->getName();
}