当前位置: 首页>>代码示例>>PHP>>正文


PHP Variable::isDoublePointer方法代码示例

本文整理汇总了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;
 }
开发者ID:Mrhjx2,项目名称:zephir,代码行数:12,代码来源:Backend.php

示例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();
 }
开发者ID:chet0xhenry,项目名称:zephir,代码行数:60,代码来源:Backend.php


注:本文中的Zephir\Variable::isDoublePointer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。