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


C++ StatementListPtr类代码示例

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


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

示例1: assert

void ClassScope::applyTraitRules(TMIData& tmid) {
  ClassStatementPtr classStmt =
    dynamic_pointer_cast<ClassStatement>(getStmt());
  assert(classStmt);

  StatementListPtr stmts = classStmt->getStmts();
  if (!stmts) return;

  for (int s = 0; s < stmts->getCount(); s++) {
    StatementPtr stmt = (*stmts)[s];

    UseTraitStatementPtr useStmt =
      dynamic_pointer_cast<UseTraitStatement>(stmt);
    if (!useStmt) continue;

    StatementListPtr rules = useStmt->getStmts();
    for (int r = 0; r < rules->getCount(); r++) {
      StatementPtr rule = (*rules)[r];
      TraitPrecStatementPtr precStmt =
        dynamic_pointer_cast<TraitPrecStatement>(rule);
      if (precStmt) {
        tmid.applyPrecRule(precStmt);
      } else {
        TraitAliasStatementPtr aliasStmt =
          dynamic_pointer_cast<TraitAliasStatement>(rule);
        assert(aliasStmt);
        tmid.applyAliasRule(aliasStmt, this);
      }
    }
  }
}
开发者ID:orok,项目名称:hhvm,代码行数:31,代码来源:class_scope.cpp

示例2: setVolatile

void FunctionScope::init(AnalysisResultConstPtr ar) {
    m_dynamicInvoke = false;

    if (isNamed("__autoload")) {
        setVolatile();
    }

    // FileScope's flags are from parser, but VariableTable has more flags
    // coming from type inference phase. So we are tranferring these flags
    // just for better modularization between FileScope and VariableTable.
    if (m_attribute & FileScope::ContainsDynamicVariable) {
        m_variables->setAttribute(VariableTable::ContainsDynamicVariable);
    }
    if (m_attribute & FileScope::ContainsLDynamicVariable) {
        m_variables->setAttribute(VariableTable::ContainsLDynamicVariable);
    }
    if (m_attribute & FileScope::ContainsExtract) {
        m_variables->setAttribute(VariableTable::ContainsExtract);
    }
    if (m_attribute & FileScope::ContainsAssert) {
        m_variables->setAttribute(VariableTable::ContainsAssert);
    }
    if (m_attribute & FileScope::ContainsCompact) {
        m_variables->setAttribute(VariableTable::ContainsCompact);
    }
    if (m_attribute & FileScope::ContainsUnset) {
        m_variables->setAttribute(VariableTable::ContainsUnset);
    }
    if (m_attribute & FileScope::ContainsGetDefinedVars) {
        m_variables->setAttribute(VariableTable::ContainsGetDefinedVars);
    }

    if (m_stmt && Option::AllVolatile && !m_pseudoMain && !m_method) {
        m_volatile = true;
    }

    if (!m_method && Option::DynamicInvokeFunctions.find(m_scopeName) !=
            Option::DynamicInvokeFunctions.end()) {
        setDynamicInvoke();
    }
    if (m_modifiers) {
        m_virtual = m_modifiers->isAbstract();
    }

    if (m_stmt) {
        MethodStatementPtr stmt = dynamic_pointer_cast<MethodStatement>(m_stmt);
        StatementListPtr stmts = stmt->getStmts();
        if (stmts) {
            for (int i = 0; i < stmts->getCount(); i++) {
                StatementPtr stmt = (*stmts)[i];
                stmt->setFileLevel();
                if (stmt->is(Statement::KindOfExpStatement)) {
                    ExpStatementPtr expStmt = dynamic_pointer_cast<ExpStatement>(stmt);
                    ExpressionPtr exp = expStmt->getExpression();
                    exp->setTopLevel();
                }
            }
        }
    }
}
开发者ID:Globalcherry,项目名称:hhvm,代码行数:60,代码来源:function_scope.cpp

示例3: assert

void ClassScope::applyTraitRules(AnalysisResultPtr ar) {
  assert(Option::WholeProgram);
  ClassStatementPtr classStmt = dynamic_pointer_cast<ClassStatement>(getStmt());
  assert(classStmt);
  StatementListPtr stmts = classStmt->getStmts();
  if (!stmts) return;
  for (int s = 0; s < stmts->getCount(); s++) {
    StatementPtr stmt = (*stmts)[s];

    UseTraitStatementPtr useStmt =
      dynamic_pointer_cast<UseTraitStatement>(stmt);
    if (!useStmt) continue;

    StatementListPtr rules = useStmt->getStmts();
    for (int r = 0; r < rules->getCount(); r++) {
      StatementPtr rule = (*rules)[r];
      TraitPrecStatementPtr precStmt =
        dynamic_pointer_cast<TraitPrecStatement>(rule);
      if (precStmt) {
        applyTraitPrecRule(precStmt);
      } else {
        TraitAliasStatementPtr aliasStmt =
          dynamic_pointer_cast<TraitAliasStatement>(rule);
        assert(aliasStmt);
        applyTraitAliasRule(ar, aliasStmt);
      }
    }
  }
}
开发者ID:Paul-ReferralMob,项目名称:hhvm,代码行数:29,代码来源:class_scope.cpp

示例4: printStatementVector

void CodeGenerator::printStatementVector(StatementListPtr sl) {
  printf("V:9:\"HH\\Vector\":%d:{", sl->getCount());
  if (sl->getCount() > 0) {
    sl->outputCodeModel(*this);
  }
  printf("}");
}
开发者ID:Hywan,项目名称:hhvm,代码行数:7,代码来源:code_generator.cpp

示例5: ASSERT

bool TestParser::VerifyParser(const char *input, const char *output,
                              const char *file /* = "" */, int line /* = 0 */,
                              const char *output2 /* = NULL */) {
  ASSERT(input);
  ASSERT(output);
  if (output2 == NULL) output2 = output;

  string oldTab = Option::Tab;
  Option::Tab = "";

  bool ret = true;
  {
    AnalysisResultPtr ar(new AnalysisResult());
    Compiler::Parser::Reset();
    StatementListPtr tree = Compiler::Parser::ParseString(input, ar);
    std::ostringstream code;
    CodeGenerator cg(&code);
    tree->outputPHP(cg, ar);
    if (!SameCode(code.str(), output)) {
      printf("======================================\n"
             "[Compiler] %s:%d:\n"
             "======================================\n",
             file, line);
      printf("[%s]\nExpecting %d: [%s]\nGot %d: [%s]\n",
             input, (int)strlen(output), output,
             (int)code.str().length(), code.str().c_str());
      ret = false;
    }
  }

  Option::Tab = oldTab;
  return ret;
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:33,代码来源:test_parser.cpp

示例6: addUserClass

void ClassStatement::analyzeProgram(AnalysisResultPtr ar) {
  vector<string> bases;
  if (!m_parent.empty()) bases.push_back(m_parent);
  if (m_base) m_base->getStrings(bases);
  for (unsigned int i = 0; i < bases.size(); i++) {
    string className = bases[i];
    addUserClass(ar, bases[i]);
  }

  checkVolatile(ar);

  if (m_stmt) {
    m_stmt->analyzeProgram(ar);
  }

  ClassScopePtr clsScope = getClassScope();

  // Check that every trait stmt is either a method, class_var, or trait_use
  if (clsScope->isTrait()) {
    StatementListPtr stmts = getStmts();
    if (stmts) {
      for (int s = 0; s < stmts->getCount(); s++) {
        StatementPtr stmt = (*stmts)[s];
        if(!dynamic_pointer_cast<UseTraitStatement>(stmt) &&
           !dynamic_pointer_cast<MethodStatement>(stmt) &&
           !dynamic_pointer_cast<ClassVariable>(stmt)) {
          Compiler::Error(Compiler::InvalidTraitStatement, stmt);
        }
      }
    }
  }

  if (ar->getPhase() != AnalysisResult::AnalyzeAll) return;

  clsScope->importUsedTraits(ar);

  ar->recordClassSource(m_name, m_loc, getFileScope()->getName());
  for (unsigned int i = 0; i < bases.size(); i++) {
    ClassScopePtr cls = ar->findClass(bases[i]);
    if (cls) {
      if ((!cls->isInterface() && (m_parent.empty() || i > 0 )) ||
          (cls->isInterface() && (!m_parent.empty() && i == 0 )) ||
          (cls->isTrait())) {
        Compiler::Error(Compiler::InvalidDerivation, shared_from_this(),
                        cls->getOriginalName());
      }
      if (cls->isUserClass()) {
        cls->addUse(getScope(), BlockScope::UseKindParentRef);
      }
    }
  }
}
开发者ID:cdnewbee,项目名称:hiphop-php,代码行数:52,代码来源:class_statement.cpp

示例7: ASSERT

bool TestParser::VerifyParser(const char *input, const char *output,
                              const char *file /* = "" */,
                              int line /* = 0 */) {
  ASSERT(input);
  ASSERT(output);

  AnalysisResultPtr ar(new AnalysisResult());
  StatementListPtr tree = Parser::parseString(input, ar);
  ostringstream code;
  CodeGenerator cg(&code);
  tree->outputPHP(cg, ar);
  if (code.str() != output) {
    printf("%s:%d\nParsing: [%s]\nExpecting %d: [%s]\nGot %d: [%s]\n",
           file, line, input, (int)strlen(output), output,
           (int)code.str().length(), code.str().c_str());
    return false;
  }
  return true;
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:19,代码来源:test_parser.cpp

示例8: execute

  void execute() {
    std::sort(m_rootEntries.begin(), m_rootEntries.end(), reCmp);

    for (int i = 0; i < m_size; i++) {
      RootEntry &re = m_rootEntries[i];
      if (!re.second) break;
      const AstWalkerState &s = re.first[re.first.size() - 1];
      StatementPtr sp(dynamic_pointer_cast<Statement>(s.cp));
      assert(sp);
      StatementListPtr sl;
      int ix;
      if (sp->is(Statement::KindOfStatementList)) {
        sl = static_pointer_cast<StatementList>(sp);
        ix = (s.index - 1) / 2;
      } else {
        assert(sp->is(Statement::KindOfBlockStatement));
        sl = static_pointer_cast<BlockStatement>(sp)->getStmts();
        if (!sl) continue;
        ix = 0;
      }
      ExpressionPtr e = m_dict.get(re.second);
      assert(e && e->is(Expression::KindOfSimpleVariable));
      SimpleVariablePtr sv(static_pointer_cast<SimpleVariable>(e));
      Symbol *sym = sv->getSymbol();
      bool inGen = sv->getFunctionScope()->isGenerator();
      if (!sym || sym->isGlobal() || sym->isStatic() || sym->isParameter() ||
          sym->isClosureVar() || sv->isThis() || inGen) {
        continue;
      }

      sym->setShrinkWrapped();
      e = e->clone();
      e->clearContext();
      e->recomputeEffects();
      e->setContext(Expression::Declaration);
      StatementPtr sub = (*sl)[ix];
      e->setLocation(sub->getLocation());
      e->setBlockScope(sub->getScope());
      ExpStatementPtr exp(
          new ExpStatement(sub->getScope(), sub->getLocation(), e));
      sl->insertElement(exp, ix);
    }
  }
开发者ID:ArPharazon,项目名称:hiphop-php,代码行数:43,代码来源:live_dict.cpp

示例9: MethodStatementPtr

MethodStatementPtr
ClassScope::findTraitMethod(AnalysisResultPtr ar,
                            ClassScopePtr trait,
                            const string &methodName,
                            std::set<ClassScopePtr> &visitedTraits) {
  if (visitedTraits.find(trait) != visitedTraits.end()) {
    return MethodStatementPtr();
  }
  visitedTraits.insert(trait);

  ClassStatementPtr tStmt =
    dynamic_pointer_cast<ClassStatement>(trait->getStmt());
  StatementListPtr tStmts = tStmt->getStmts();

  // Look in the current trait
  for (int s = 0; s < tStmts->getCount(); s++) {
    MethodStatementPtr meth =
      dynamic_pointer_cast<MethodStatement>((*tStmts)[s]);
    if (meth) {    // Handle methods
      if (meth->getName() == methodName) {
        return meth;
      }
    }
  }

  // Look into children traits
  for (int s = 0; s < tStmts->getCount(); s++) {
    UseTraitStatementPtr useTraitStmt =
      dynamic_pointer_cast<UseTraitStatement>((*tStmts)[s]);
    if (useTraitStmt) {
      vector<string> usedTraits;
      useTraitStmt->getUsedTraitNames(usedTraits);
      for (unsigned i = 0; i < usedTraits.size(); i++) {
        MethodStatementPtr foundMethod =
          findTraitMethod(ar, ar->findClass(usedTraits[i]), methodName,
                          visitedTraits);
        if (foundMethod) return foundMethod;
      }
    }
  }
  return MethodStatementPtr(); // not found
}
开发者ID:Paul-ReferralMob,项目名称:hhvm,代码行数:42,代码来源:class_scope.cpp

示例10: switch

void ClassStatement::GetCtorAndInitInfo(
    StatementPtr s, bool &needsCppCtor, bool &needsInit) {
  if (!s) return;
  switch (s->getKindOf()) {
  case Statement::KindOfStatementList:
    {
      StatementListPtr stmts = static_pointer_cast<StatementList>(s);
      for (int i = 0; i < stmts->getCount(); i++) {
        GetCtorAndInitInfo((*stmts)[i], needsCppCtor, needsInit);
      }
    }
    break;
  case Statement::KindOfClassVariable:
    {
      ClassVariablePtr cv = static_pointer_cast<ClassVariable>(s);
      cv->getCtorAndInitInfo(needsCppCtor, needsInit);
    }
    break;
  default: break;
  }
}
开发者ID:DenisBazhan,项目名称:hiphop-php,代码行数:21,代码来源:class_statement.cpp

示例11: importTraitProperties

void ClassScope::importTraitProperties(AnalysisResultPtr ar) {

  for (unsigned i = 0; i < m_usedTraitNames.size(); i++) {
    ClassScopePtr tCls = ar->findClass(m_usedTraitNames[i]);
    if (!tCls) continue;
    ClassStatementPtr tStmt =
      dynamic_pointer_cast<ClassStatement>(tCls->getStmt());
    StatementListPtr tStmts = tStmt->getStmts();
    if (!tStmts) continue;
    for (int s = 0; s < tStmts->getCount(); s++) {
      ClassVariablePtr prop =
        dynamic_pointer_cast<ClassVariable>((*tStmts)[s]);
      if (prop) {
        ClassVariablePtr cloneProp = dynamic_pointer_cast<ClassVariable>(
          dynamic_pointer_cast<ClassStatement>(m_stmt)->addClone(prop));
        cloneProp->resetScope(shared_from_this());
        cloneProp->addTraitPropsToScope(ar,
                      dynamic_pointer_cast<ClassScope>(shared_from_this()));
      }
    }
  }
}
开发者ID:orok,项目名称:hhvm,代码行数:22,代码来源:class_scope.cpp

示例12: setFileLevel

void FileScope::setFileLevel(StatementListPtr stmtList) {
  for (int i = 0; i < stmtList->getCount(); i++) {
    StatementPtr stmt = (*stmtList)[i];
    stmt->setFileLevel();
    if (stmt->is(Statement::KindOfExpStatement)) {
      ExpStatementPtr expStmt = dynamic_pointer_cast<ExpStatement>(stmt);
      ExpressionPtr exp = expStmt->getExpression();
      exp->setFileLevel();
    }
    if (stmt->is(Statement::KindOfStatementList)) {
      setFileLevel(dynamic_pointer_cast<StatementList>(stmt));
    }
  }
}
开发者ID:enov,项目名称:hhvm,代码行数:14,代码来源:file_scope.cpp

示例13: switch

void ClassStatement::onParse(AnalysisResultConstPtr ar, FileScopePtr fs) {
  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);
  }
  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));
  setBlockScope(classScope);
  if (!fs->addClass(ar, classScope)) {
    m_ignored = true;
    return;
  }

  if (m_stmt) {
    bool seenConstruct = false;

    // flatten continuation StatementList into MethodStatements
    for (int i = 0; i < m_stmt->getCount(); i++) {
      StatementListPtr stmts =
        dynamic_pointer_cast<StatementList>((*m_stmt)[i]);
      if (stmts) {
        m_stmt->removeElement(i);
        for (int j = 0; j < stmts->getCount(); j++) {
          m_stmt->insertElement((*stmts)[j], i + j);
        }
      }
    }

    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->onParseRecur(ar, classScope);
    }
  }
}
开发者ID:playnine,项目名称:hiphop-php,代码行数:63,代码来源:class_statement.cpp

示例14: switch

void ClassStatement::onParse(AnalysisResultConstPtr ar, FileScopePtr fs) {
  ClassScope::KindOf kindOf = ClassScope::KindOf::ObjectClass;
  switch (m_type) {
    case T_CLASS:     kindOf = ClassScope::KindOf::ObjectClass;   break;
    case T_ABSTRACT:  kindOf = ClassScope::KindOf::AbstractClass; break;
    case T_STATIC: // Slight hack: see comments in hphp.y
      kindOf = ClassScope::KindOf::UtilClass;     break;
    case T_FINAL:     kindOf = ClassScope::KindOf::FinalClass;    break;
    case T_TRAIT:     kindOf = ClassScope::KindOf::Trait;         break;
    case T_ENUM:      kindOf = ClassScope::KindOf::Enum;          break;
    default:
      assert(false);
  }

  std::vector<std::string> bases;
  if (!m_originalParent.empty()) {
    bases.push_back(m_originalParent);
  }
  if (m_base) m_base->getStrings(bases);

  for (auto &b : bases) {
    ar->parseOnDemandByClass(b);
  }

  std::vector<UserAttributePtr> attrs;
  if (m_attrList) {
    for (int i = 0; i < m_attrList->getCount(); ++i) {
      UserAttributePtr a =
        dynamic_pointer_cast<UserAttribute>((*m_attrList)[i]);
      attrs.push_back(a);
    }
  }

  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  auto classScope = std::make_shared<ClassScope>(
    fs, kindOf, m_originalName,
    m_originalParent,
    bases, m_docComment,
    stmt, attrs);

  setBlockScope(classScope);
  if (!fs->addClass(ar, classScope)) {
    m_ignored = true;
    return;
  }

  classScope->setPersistent(false);

  if (m_stmt) {
    MethodStatementPtr constructor = nullptr;
    MethodStatementPtr destructor = nullptr;
    MethodStatementPtr clone = nullptr;

    // flatten continuation StatementList into MethodStatements
    for (int i = 0; i < m_stmt->getCount(); i++) {
      StatementListPtr stmts =
        dynamic_pointer_cast<StatementList>((*m_stmt)[i]);
      if (stmts) {
        m_stmt->removeElement(i);
        for (int j = 0; j < stmts->getCount(); j++) {
          m_stmt->insertElement((*stmts)[j], i + j);
        }
      }
    }

    for (int i = 0; i < m_stmt->getCount(); i++) {
      MethodStatementPtr meth =
        dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
      if (meth) {
        if (meth->isNamed("__construct")) {
          constructor = meth;
          continue;
        }
        if (meth->isNamed("__destruct")) {
          destructor = meth;
          continue;
        }
        if (meth->isNamed("__clone")) {
          clone = meth;
          continue;
        }
      }
      if (constructor && destructor && clone) {
        break;
      }
    }

    for (int i = 0; i < m_stmt->getCount(); i++) {
      if (!constructor) {
        MethodStatementPtr meth =
          dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
        if (meth &&
            meth->isNamed(classScope->getOriginalName()) &&
            !classScope->isTrait()) {
          // class-name constructor
          constructor = meth;
          classScope->setAttribute(ClassScope::ClassNameConstructor);
        }
      }
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
//.........这里部分代码省略.........
开发者ID:nurulimamnotes,项目名称:hhvm,代码行数:101,代码来源:class_statement.cpp

示例15: switch

void ClassStatement::onParse(AnalysisResultConstPtr ar, FileScopePtr fs) {
  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;
  case T_TRAIT:     kindOf = ClassScope::KindOfTrait;         break;
  default:
    assert(false);
  }

  vector<string> bases;
  if (!m_originalParent.empty()) {
    bases.push_back(m_originalParent);
  }
  if (m_base) m_base->getOriginalStrings(bases);

  for (auto &b : bases) {
    ar->parseOnDemandByClass(Util::toLower(b));
  }

  vector<UserAttributePtr> attrs;
  if (m_attrList) {
    for (int i = 0; i < m_attrList->getCount(); ++i) {
      UserAttributePtr a =
        dynamic_pointer_cast<UserAttribute>((*m_attrList)[i]);
      attrs.push_back(a);
    }
  }

  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  ClassScopePtr classScope(new ClassScope(kindOf, m_originalName,
                                          m_originalParent,
                                          bases, m_docComment,
                                          stmt, attrs));
  setBlockScope(classScope);
  if (!fs->addClass(ar, classScope)) {
    m_ignored = true;
    return;
  }

  if (Option::PersistenceHook) {
    classScope->setPersistent(Option::PersistenceHook(classScope, fs));
  }

  if (m_stmt) {
    MethodStatementPtr constructor;

    // flatten continuation StatementList into MethodStatements
    for (int i = 0; i < m_stmt->getCount(); i++) {
      StatementListPtr stmts =
        dynamic_pointer_cast<StatementList>((*m_stmt)[i]);
      if (stmts) {
        m_stmt->removeElement(i);
        for (int j = 0; j < stmts->getCount(); j++) {
          m_stmt->insertElement((*stmts)[j], i + j);
        }
      }
    }

    for (int i = 0; i < m_stmt->getCount(); i++) {
      MethodStatementPtr meth =
        dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
      if (meth && meth->getName() == "__construct") {
        constructor = meth;
        break;
      }
    }
    for (int i = 0; i < m_stmt->getCount(); i++) {
      if (!constructor) {
        MethodStatementPtr meth =
          dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]);
        if (meth && meth->getName() == classScope->getName()
            && !classScope->isTrait()) {
          // class-name constructor
          constructor = meth;
          classScope->setAttribute(ClassScope::ClassNameConstructor);
        }
      }
      IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]);
      ph->onParseRecur(ar, classScope);
    }
    if (constructor && constructor->getModifiers()->isStatic()) {
      constructor->parseTimeFatal(Compiler::InvalidAttribute,
                                  "Constructor %s::%s() cannot be static",
                                  classScope->getOriginalName().c_str(),
                                  constructor->getOriginalName().c_str());
    }
  }
}
开发者ID:524777134,项目名称:hiphop-php,代码行数:90,代码来源:class_statement.cpp


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