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


C++ FunctionScopePtrVec类代码示例

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


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

示例1: ImportClassScopePtr

ClassScopePtr BuiltinSymbols::ImportClassScopePtr(AnalysisResultPtr ar,
                                                  ClassInfo *cls) {
  FunctionScopePtrVec methods;
  ImportExtMethods(ar, methods, cls);

  ClassInfo::InterfaceVec ifaces = cls->getInterfacesVec();
  String parent = cls->getParentClass();
  std::vector<std::string> stdIfaces;
  if (!parent.empty() && (ifaces.empty() || ifaces[0] != parent)) {
    stdIfaces.push_back(parent.data());
  }
  for (auto it = ifaces.begin(); it != ifaces.end(); ++it) {
    stdIfaces.push_back(it->data());
  }

  ClassScopePtr cl(new ClassScope(ar, cls->getName().data(), parent.data(),
                                  stdIfaces, methods));
  for (uint i = 0; i < methods.size(); ++i) {
    methods[i]->setOuterScope(cl);
  }

  ImportExtProperties(ar, cl->getVariables(), cls);
  ImportExtConstants(ar, cl->getConstants(), cls);
  int attrs = cls->getAttribute();
  cl->setClassInfoAttribute(attrs);
  cl->setDocComment(cls->getDocComment());
  cl->setSystem();
  return cl;
}
开发者ID:Ocramius,项目名称:hiphop-php,代码行数:29,代码来源:builtin_symbols.cpp

示例2: getFunctionsFlattened

void FunctionContainer::getFunctionsFlattened(
  const StringToFunctionScopePtrVecMap *redec,
  FunctionScopePtrVec &funcs,
  bool excludePseudoMains /* = false */) const {
  for (StringToFunctionScopePtrMap::const_iterator it = m_functions.begin();
       it != m_functions.end(); ++it) {
    FunctionScopePtr func = it->second;
    if (!excludePseudoMains || !func->inPseudoMain()) {
      if (func->isLocalRedeclaring()) {
        const FunctionScopePtrVec &r = redec->find(it->first)->second;
        funcs.insert(funcs.end(), r.begin(), r.end());
      } else {
        funcs.push_back(func);
      }
    }
  }
}
开发者ID:191919,项目名称:hhvm,代码行数:17,代码来源:function_container.cpp

示例3: ImportExtMethods

void BuiltinSymbols::ImportExtMethods(AnalysisResultPtr ar,
                                      FunctionScopePtrVec &vec,
                                      ClassInfo *cls) {
  const ClassInfo::MethodVec &methods = cls->getMethodsVec();
  for (auto it = methods.begin(); it != methods.end(); ++it) {
    FunctionScopePtr f = ImportFunctionScopePtr(ar, cls, *it);
    vec.push_back(f);
  }
}
开发者ID:Ocramius,项目名称:hiphop-php,代码行数:9,代码来源:builtin_symbols.cpp

示例4: while

void BuiltinSymbols::ParseExtClasses(AnalysisResultPtr ar, const char **p,
                                     bool sep) {
    while (*p) {
        // Parse name
        const char *cname = *p++;
        // Parse parent
        const char *cparent = *p++;
        if (!cparent) cparent = "";
        // Parse list of interfaces
        vector<string> ifaces;
        while (*p) ifaces.push_back(*p++);
        p++;
        // Parse methods
        FunctionScopePtrVec methods;
        while (*p) {
            FunctionScopePtr fs = ParseExtFunction(ar, p, true);
            if (sep) {
                fs->setSepExtension();
            }
            int flags = (int)(int64)(*p++);
            if (flags & ClassInfo::IsAbstract) {
                fs->addModifier(T_ABSTRACT);
            }
            int vismod = 0;
            if (flags & ClassInfo::IsProtected) {
                vismod = T_PROTECTED;
            } else if (flags & ClassInfo::IsPrivate) {
                vismod = T_PRIVATE;
            }
            fs->addModifier(vismod);
            if (flags & ClassInfo::IsStatic) {
                fs->addModifier(T_STATIC);
            }
            methods.push_back(fs);
        }
        if (cparent && *cparent && (ifaces.empty() || ifaces[0] != cparent)) {
            ifaces.insert(ifaces.begin(), cparent);
        }
        ClassScopePtr cl(new ClassScope(ar, cname, cparent, ifaces, methods));
        for (uint i = 0; i < methods.size(); ++i) {
            methods[i]->setOuterScope(cl);
        }
        p++;
        // Parse properties
        while (*p) {
            int flags = (int)(int64)(*p++);
            ModifierExpressionPtr modifiers(
                new ModifierExpression(BlockScopePtr(), LocationPtr()));
            if (flags & ClassInfo::IsProtected) {
                modifiers->add(T_PROTECTED);
            } else if (flags & ClassInfo::IsPrivate) {
                modifiers->add(T_PRIVATE);
            }
            if (flags & ClassInfo::IsStatic) {
                modifiers->add(T_STATIC);
            }
            const char *name = *p++;
            TypePtr type = ParseType(p);
            cl->getVariables()->add(name, type, false, ar, ExpressionPtr(), modifiers);
        }
        p++;
        // Parse consts
        while (*p) {
            const char *name = *p++;
            TypePtr type = ParseType(p);
            cl->getConstants()->add(name, type, ExpressionPtr(), ar, ConstructPtr());
        }
        p++;

        int flags = (int)(int64)(*p++);
        cl->setClassInfoAttribute(flags);
        if (flags & ClassInfo::HasDocComment) {
            cl->setDocComment(*p++);
        }

        cl->setSystem();
        if (sep) {
            cl->setSepExtension();
        }
        s_classes[cl->getName()] = cl;
    }
}
开发者ID:serphen,项目名称:hiphop-php,代码行数:82,代码来源:builtin_symbols.cpp


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