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


C++ IParseHandlerPtr::onParse方法代码示例

本文整理汇总了C++中IParseHandlerPtr::onParse方法的典型用法代码示例。如果您正苦于以下问题:C++ IParseHandlerPtr::onParse方法的具体用法?C++ IParseHandlerPtr::onParse怎么用?C++ IParseHandlerPtr::onParse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IParseHandlerPtr的用法示例。


在下文中一共展示了IParseHandlerPtr::onParse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onParse

void ClassVariable::onParse(AnalysisResultPtr ar) {
  ModifierExpressionPtr modifiers =
    ar->getScope()->setModifiers(m_modifiers);

  for (int i = 0; i < m_declaration->getCount(); i++) {
    VariableTablePtr variables = ar->getScope()->getVariables();
    ExpressionPtr exp = (*m_declaration)[i];
    if (exp->is(Expression::KindOfAssignmentExpression)) {
      AssignmentExpressionPtr assignment =
        dynamic_pointer_cast<AssignmentExpression>(exp);
      ExpressionPtr var = assignment->getVariable();
      const std::string &name =
        dynamic_pointer_cast<SimpleVariable>(var)->getName();
      if (variables->isPresent(name)) {
        ar->getCodeError()->record(CodeError::DeclaredVariableTwice, exp);
      }
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>(exp);
      ph->onParse(ar);
    } else {
      const std::string &name =
        dynamic_pointer_cast<SimpleVariable>(exp)->getName();
      if (variables->isPresent(name)) {
        ar->getCodeError()->record(CodeError::DeclaredVariableTwice, exp);
      }
      variables->add(name, TypePtr(), false, ar, exp, m_modifiers);
    }
  }

  ar->getScope()->setModifiers(modifiers);
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:30,代码来源:class_variable.cpp

示例2: onParse

void ClassStatement::onParse(AnalysisResultPtr ar) {
  ClassScope::KindOf kindOf = ClassScope::KindOfObjectClass;
  switch (m_type) {
  case T_CLASS:     kindOf = ClassScope::KindOfObjectClass;   break;
  case T_ABSTRACT:  kindOf = ClassScope::KindOfAbstractClass; break;
  case T_FINAL:     kindOf = ClassScope::KindOfFinalClass;    break;
  default:
    ASSERT(false);
  }

  vector<string> bases;
  if (!m_parent.empty()) {
    bases.push_back(m_parent);
    ar->addNonFinal(m_parent);
  }
  if (m_base) m_base->getStrings(bases);
  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  ClassScopePtr classScope(new ClassScope(kindOf, m_originalName, m_parent,
                                          bases, m_docComment,
                                          stmt, ar->getFileScope()));
  m_classScope = classScope;
  if (!ar->getFileScope()->addClass(ar, classScope)) {
    m_ignored = true;
    return;
  }
  ar->recordClassSource(m_name, ar->getFileScope()->getName());

  if (m_stmt) {
    ar->pushScope(classScope);
    bool seenConstruct = false;
    for (int i = 0; i < m_stmt->getCount(); i++) {
      MethodStatementPtr meth =
        dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
      if (meth && meth->getName() == "__construct") {
        seenConstruct = true;
        break;
      }
    }
    for (int i = 0; i < m_stmt->getCount(); i++) {
      if (!seenConstruct) {
        MethodStatementPtr meth =
          dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
        if (meth && classScope && meth->getName() == classScope->getName()
         && !meth->getModifiers()->isStatic()) {
          // class-name constructor
          classScope->setAttribute(ClassScope::classNameConstructor);
        }
      }
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
      ph->onParse(ar);
    }
    ar->popScope();
  }
}
开发者ID:GunioRobot,项目名称:hiphop-php,代码行数:54,代码来源:class_statement.cpp

示例3: onParse

void InterfaceStatement::onParse(AnalysisResultPtr ar, BlockScopePtr scope) {
  vector<string> bases;
  if (m_base) m_base->getStrings(bases);

  FileScopePtr fs = dynamic_pointer_cast<FileScope>(scope);
  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  ClassScopePtr classScope
    (new ClassScope(ClassScope::KindOfInterface, m_name, "", bases,
                    m_docComment, stmt));
  setBlockScope(classScope);
  fs->addClass(ar, classScope);

  if (m_stmt) {
    for (int i = 0; i < m_stmt->getCount(); i++) {
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
      ph->onParse(ar, classScope);
    }
  }
}
开发者ID:dipjyotighosh,项目名称:hiphop-php,代码行数:19,代码来源:interface_statement.cpp

示例4: onParse

void InterfaceStatement::onParse(AnalysisResultPtr ar) {
  vector<string> bases;
  if (m_base) m_base->getStrings(bases);

  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  ClassScopePtr classScope(new ClassScope(ClassScope::KindOfInterface,
                                          m_name, "", bases, m_docComment, stmt,
                                          ar->getFileScope()));
  m_classScope = classScope;
  ar->getFileScope()->addClass(ar, classScope);
  ar->getDependencyGraph()->addParent(DependencyGraph::KindOfProgramUserClass,
                                      "", m_originalName, stmt);

  if (m_stmt) {
    ar->pushScope(classScope);
    for (int i = 0; i < m_stmt->getCount(); i++) {
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
      ph->onParse(ar);
    }
    ar->popScope();
  }
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:22,代码来源:interface_statement.cpp

示例5: onParse

void ClassConstant::onParse(AnalysisResultPtr ar) {
  for (int i = 0; i < m_exp->getCount(); i++) {
    IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_exp)[i]);
    ph->onParse(ar);
  }
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:6,代码来源:class_constant.cpp


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