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


C++ TypeAnnotationPtr类代码示例

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


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

示例1: accessTypeName

void TypeAnnotation::accessTypeName(std::string &name) const {
  name += m_name;
  TypeAnnotationPtr typeEl = m_typeArgs;
  while (typeEl) {
    folly::toAppend("::", typeEl->fullName(), &name);
    typeEl = typeEl->m_typeList;
  }
}
开发者ID:elgenie,项目名称:hiphop-php,代码行数:8,代码来源:type_annotation.cpp

示例2: tupleTypeName

void TypeAnnotation::tupleTypeName(std::string &name) const {
  name += "(";
  TypeAnnotationPtr typeEl = m_typeArgs;
  while (typeEl) {
    name += typeEl->fullName();
    typeEl = typeEl->m_typeList;
    name += ", ";
  }
  // replace the trailing ", " with ")"
  name.replace(name.size() - 2, 2, ")");
}
开发者ID:rafaeldecruzeiro,项目名称:hiphop-php,代码行数:11,代码来源:type_annotation.cpp

示例3: genericTypeName

void TypeAnnotation::genericTypeName(std::string &name) const {
  folly::toAppend(m_name, "<", &name);
  TypeAnnotationPtr typeEl = m_typeArgs;
  auto sep = "";
  while (typeEl) {
    folly::toAppend(sep, typeEl->fullName(), &name);
    typeEl = typeEl->m_typeList;
    sep = ", ";
  }
  name += ">";
}
开发者ID:elgenie,项目名称:hiphop-php,代码行数:11,代码来源:type_annotation.cpp

示例4: tupleTypeName

void TypeAnnotation::tupleTypeName(std::string &name) const {
  name += "(";
  TypeAnnotationPtr typeEl = m_typeArgs;
  auto sep = "";
  while (typeEl) {
    folly::toAppend(sep, typeEl->fullName(), &name);
    typeEl = typeEl->m_typeList;
    sep = ", ";
  }
  name += ")";
}
开发者ID:elgenie,项目名称:hiphop-php,代码行数:11,代码来源:type_annotation.cpp

示例5: functionTypeName

void TypeAnnotation::functionTypeName(std::string &name) const {
  name += "(function (";
  // return value of function types is the first element of type list
  TypeAnnotationPtr retType = m_typeArgs;
  TypeAnnotationPtr typeEl = m_typeArgs->m_typeList;
  auto sep = "";
  while (typeEl) {
    folly::toAppend(sep, typeEl->fullName(), &name);
    typeEl = typeEl->m_typeList;
    sep = ", ";
  }
  // add function return value
  folly::toAppend("): ", retType->fullName(), ")", &name);
}
开发者ID:elgenie,项目名称:hiphop-php,代码行数:14,代码来源:type_annotation.cpp

示例6: Expression

ParameterExpression::ParameterExpression(
     EXPRESSION_CONSTRUCTOR_PARAMETERS,
     TypeAnnotationPtr type,
     bool hhType,
     const std::string &name,
     bool ref,
     TokenID modifier,
     ExpressionPtr defaultValue,
     ExpressionPtr attributeList,
     bool variadic)
  : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES(ParameterExpression))
  , m_originalType(type)
  , m_name(name)
  , m_hhType(hhType)
  , m_ref(ref)
  , m_modifier(modifier)
  , m_defaultValue(defaultValue)
  , m_attributeList(attributeList)
  , m_variadic(variadic)
{
  m_type = toLower(type ? type->vanillaName() : "");
  if (m_defaultValue) {
    m_defaultValue->setContext(InParameterExpression);
  }
}
开发者ID:Frankie-666,项目名称:hhvm,代码行数:25,代码来源:parameter_expression.cpp

示例7: outputCodeModel

void TypeAnnotation::outputCodeModel(CodeGenerator& cg) {
    TypeAnnotationPtr typeArgsElem = m_typeArgs;
    auto numTypeArgs = 0;
    while (typeArgsElem != nullptr) {
        numTypeArgs++;
        typeArgsElem = typeArgsElem->m_typeList;
    }
    typeArgsElem = m_typeArgs;

    auto numProps = 1;
    if (m_nullable) numProps++;
    if (m_soft) numProps++;
    if (m_function) numProps++;
    if (numTypeArgs > 0) numProps++;
    cg.printObjectHeader("TypeExpression", numProps);
    cg.printPropertyHeader("name");
    cg.printValue(m_tuple ? "tuple" : m_name);
    if (m_nullable) {
        cg.printPropertyHeader("isNullable");
        cg.printBool(true);
    }
    if (m_soft) {
        cg.printPropertyHeader("isSoft");
        cg.printBool(true);
    }
    if (m_function) {
        cg.printPropertyHeader("returnType");
        typeArgsElem->outputCodeModel(cg);
        typeArgsElem = typeArgsElem->m_typeList;
        numTypeArgs--;
    }
    if (numTypeArgs > 0) {
        cg.printPropertyHeader("typeArguments");
        cg.printf("V:9:\"HH\\Vector\":%d:{", numTypeArgs);
        while (typeArgsElem != nullptr) {
            typeArgsElem->outputCodeModel(cg);
            typeArgsElem = typeArgsElem->m_typeList;
        }
        cg.printf("}");
    }
    cg.printObjectFooter();
}
开发者ID:Tintazul,项目名称:hhvm,代码行数:42,代码来源:type_annotation.cpp

示例8: functionTypeName

void TypeAnnotation::functionTypeName(std::string &name) const {
  name += "(function (";
  // return value of function types is the first element of type list
  TypeAnnotationPtr retType = m_typeArgs;
  TypeAnnotationPtr typeEl = m_typeArgs->m_typeList;
  bool hasArgs = (typeEl != nullptr);
  while (typeEl) {
    name += typeEl->fullName();
    typeEl = typeEl->m_typeList;
    name += ", ";
  }
  // replace the trailing ", " (if any) with "): "
  if (hasArgs) {
    name.replace(name.size() - 2, 2, "): ");
  } else {
    name += "): ";
  }
  // add function return value
  name += retType->fullName();
  name += ")";
}
开发者ID:rafaeldecruzeiro,项目名称:hiphop-php,代码行数:21,代码来源:type_annotation.cpp

示例9: shapeTypeName

void TypeAnnotation::shapeTypeName(std::string& name) const {
  name += "HH\\shape(";
  TypeAnnotationPtr shapeField = m_typeArgs;
  auto sep = "";
  while (shapeField) {
    name += sep;

    if (shapeField->isClsCnsShapeField()) {
      folly::toAppend(shapeField->m_name, &name);
    } else {
      folly::toAppend("'", shapeField->m_name, "'", &name);
    }
    auto fieldValue = shapeField->m_typeArgs;
    assert(fieldValue);
    folly::toAppend("=>", fieldValue->fullName(), &name);

    sep = ", ";
    shapeField = shapeField->m_typeList;
  }

  name += ")";
}
开发者ID:elgenie,项目名称:hiphop-php,代码行数:22,代码来源:type_annotation.cpp


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