示例#1
0
文件: phc.php 项目: nowelium/phptree
 private static function getParameterList(SimpleXMLElement $element)
 {
     $list = new ParameterMetaDataList();
     foreach ($element->AST_formal_parameter_list as $key => $parameterList) {
         if (strcasecmp($key, ParameterMetaDataList::NODE_NAME) !== 0) {
             continue;
         }
         $parameters = $parameterList->children();
         foreach ($parameters as $k => $parameterDef) {
             if (strcasecmp($k, ParameterMetaData::NODE_NAME) !== 0) {
                 continue;
             }
             $parameterMeta = new ParameterMetaData();
             $parameterMeta->setToken(new VariableTokenMetaData(self::getTokenValue($parameterDef->Token_variable_name)));
             if (strcasecmp($k, ParameterMetaData::NODE_NAME) === 0) {
                 $astType = $parameterDef->AST_type;
                 $type = new TypeMetaData();
                 $type->setToken(new ClassTokenMetaData(self::getTokenValue($astType->Token_class_name)));
                 $parameterMeta->setType($type);
             }
             $list->add($parameterMeta);
         }
     }
     return $list;
 }
示例#2
0
 public function visitParameterListMeta(ParameterMetaDataList $meta)
 {
     $buf = new TreeOutput();
     $buf->add('[' . $meta->getNodeName() . ']');
     $buf->down();
     $list = $meta->getList();
     foreach ($list as $parameter) {
         $buf->writeln($parameter->toJSValue($this));
     }
     $buf->up();
     return $buf;
 }