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


C++ PreClassEmitter::methods方法代码示例

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


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

示例1: parse_methods

void parse_methods(ParseUnitState& puState,
                   borrowed_ptr<php::Class> ret,
                   borrowed_ptr<php::Unit> unit,
                   const PreClassEmitter& pce) {
  for (auto& me : pce.methods()) {
    auto f = parse_func(puState, unit, ret, *me);
    ret->methods.push_back(std::move(f));
  }
}
开发者ID:409033632,项目名称:hhvm,代码行数:9,代码来源:parse.cpp

示例2: FTRACE

std::unique_ptr<php::Class> parse_class(ParseUnitState& puState,
                                        borrowed_ptr<php::Unit> unit,
                                        const PreClassEmitter& pce) {
    FTRACE(2, "  class: {}\n", pce.name()->data());

    auto ret            = folly::make_unique<php::Class>();
    ret->name           = pce.name();
    ret->srcInfo        = php::SrcInfo { pce.getLocation(),
                                         pce.docComment() };
    ret->unit           = unit;
    ret->parentName     = pce.parentName()->empty() ? nullptr : pce.parentName();
    ret->attrs          = pce.attrs();
    ret->hoistability   = pce.hoistability();
    ret->userAttributes = pce.userAttributes();

    for (auto& iface : pce.interfaces()) {
        ret->interfaceNames.push_back(iface);
    }

    ret->usedTraitNames  = pce.usedTraits();
    ret->traitPrecRules  = pce.traitPrecRules();
    ret->traitAliasRules = pce.traitAliasRules();
    ret->traitRequirements = pce.traitRequirements();

    for (auto& me : pce.methods()) {
        ret->methods.push_back(parse_func(puState, unit, borrow(ret), *me));
    }

    auto& propMap = pce.propMap();
    for (size_t idx = 0; idx < propMap.size(); ++idx) {
        auto& prop = propMap[idx];
        ret->properties.push_back(
        php::Prop {
            prop.name(),
            prop.attrs(),
            prop.docComment(),
            prop.typeConstraint(),
            prop.val()
        }
        );
    }

    auto& constMap = pce.constMap();
    for (size_t idx = 0; idx < constMap.size(); ++idx) {
        auto& cconst = constMap[idx];
        ret->constants.push_back(
        php::Const {
            cconst.name(),
            cconst.val(),
            cconst.phpCode(),
            cconst.typeConstraint()
        }
        );
    }

    return ret;
}
开发者ID:Hillgod,项目名称:hiphop-php,代码行数:57,代码来源:parse.cpp

示例3: parse_methods

void parse_methods(ParseUnitState& puState,
                   borrowed_ptr<php::Class> ret,
                   borrowed_ptr<php::Unit> unit,
                   const PreClassEmitter& pce) {
  std::unique_ptr<php::Func> cinit;
  for (auto& me : pce.methods()) {
    auto f = parse_func(puState, unit, ret, *me);
    if (f->name == s_86cinit.get()) {
      cinit = std::move(f);
    } else {
      ret->methods.push_back(std::move(f));
    }
  }
  if (cinit) ret->methods.push_back(std::move(cinit));
}
开发者ID:aloiret,项目名称:hhvm,代码行数:15,代码来源:parse.cpp

示例4: parse_methods

void parse_methods(ParseUnitState& puState,
                   borrowed_ptr<php::Class> ret,
                   borrowed_ptr<php::Unit> unit,
                   const PreClassEmitter& pce) {
  std::unordered_map<
    SString,
    borrowed_ptr<php::Func>,
    string_data_hash,
    string_data_isame
  > innerGenerators;
  std::vector<std::pair<borrowed_ptr<php::Func>,SString>> generatorsToLink;

  for (auto& me : pce.methods()) {
    auto f = parse_func(puState, unit, ret, *me);

    if (f->isGeneratorBody) {
      always_assert(!innerGenerators.count(f->name));
      innerGenerators[f->name] = borrow(f);
    }
    if (me->getGeneratorBodyName() && !f->isClosureBody) {
      generatorsToLink.emplace_back(borrow(f), me->getGeneratorBodyName());
    }

    ret->methods.push_back(std::move(f));
  }

  for (auto kv : generatorsToLink) {
    auto const it = innerGenerators.find(kv.second);
    assert(it != end(innerGenerators));
    auto const outer = kv.first;
    auto const inner = it->second;
    assert(inner->isGeneratorBody);
    assert(!inner->innerGeneratorFunc && !inner->outerGeneratorFunc);
    assert(!outer->innerGeneratorFunc && !outer->outerGeneratorFunc);
    inner->outerGeneratorFunc = outer;
    outer->innerGeneratorFunc = inner;
  }
}
开发者ID:fmarcos83,项目名称:hhvm,代码行数:38,代码来源:parse.cpp


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