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


C++ ExpressionPtr::addElement方法代码示例

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


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

示例1: onVariable

void Parser::onVariable(Token *out, Token *exprs, Token *var, Token *value,
                        bool constant /* = false */) {
  ExpressionPtr expList;
  if (exprs) {
    expList = exprs->exp;
  } else {
    expList = NEW_EXP0(ExpressionList);
  }
  ExpressionPtr exp;
  if (constant) {
    exp = NEW_EXP(ConstantExpression, var->text());
  } else {
    exp = NEW_EXP(SimpleVariable, var->text());
  }
  if (value) {
    exp = NEW_EXP(AssignmentExpression, exp, value->exp, false);
  }
  else {
    // implicit null, #147156
    static const std::string s_null ("null");
    ExpressionPtr null_exp (NEW_EXP(ConstantExpression, s_null));
    exp = NEW_EXP(AssignmentExpression, exp, null_exp, false);
  }
  expList->addElement(exp);
  out->exp = expList;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:26,代码来源:parser.cpp

示例2: optimizeArgArray

void FunctionCall::optimizeArgArray(AnalysisResultPtr ar) {
  if (m_extraArg <= 0) return;
  int paramCount = m_params->getOutputCount();
  int iMax = paramCount - m_extraArg;
  bool isScalar = true;
  for (int i = iMax; i < paramCount; i++) {
    ExpressionPtr param = (*m_params)[i];
    if (!param->isScalar()) {
      isScalar = false;
      break;
    }
  }
  if (isScalar) {
    ExpressionPtr argArrayPairs =
      ExpressionListPtr(new ExpressionList(getLocation(),
                                           Expression::KindOfExpressionList));
    for (int i = iMax; i < paramCount; i++) {
      ExpressionPtr param = (*m_params)[i];
      argArrayPairs->addElement(ArrayPairExpressionPtr(
        new ArrayPairExpression(param->getLocation(),
                                Expression::KindOfArrayPairExpression,
                                ExpressionPtr(), param, false)));
    }
    m_argArrayId = ar->registerScalarArray(argArrayPairs);
  }
}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:26,代码来源:function_call.cpp

示例3: onGlobalVar

void Parser::onGlobalVar(Token *out, Token *exprs, Token *expr) {
  ExpressionPtr expList;
  if (exprs && exprs->exp) {
    expList = exprs->exp;
  } else {
    expList = NEW_EXP0(ExpressionList);
  }
  switch (expr->num) {
  case 0:
    expList->addElement(NEW_EXP(SimpleVariable, expr->text()));
    break;
  case 1:
    expList->addElement(createDynamicVariable(expr->exp));
    break;
  default:
    ASSERT(false);
  }
  out->exp = expList;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:19,代码来源:parser.cpp

示例4: onInterfaceName

void Parser::onInterfaceName(Token *out, Token *names, Token *name) {
  ExpressionPtr expList;
  if (names) {
    expList = names->exp;
  } else {
    expList = NEW_EXP0(ExpressionList);
  }
  expList->addElement(NEW_EXP(ScalarExpression, T_STRING, name->text()));
  out->exp = expList;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:10,代码来源:parser.cpp

示例5: onExprListElem

void Parser::onExprListElem(Token *out, Token *exprs, Token *expr) {
  ExpressionPtr expList;
  if (exprs && exprs->exp) {
    expList = exprs->exp;
  } else {
    expList = NEW_EXP0(ExpressionList);
  }
  expList->addElement(expr->exp);
  out->exp = expList;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:10,代码来源:parser.cpp

示例6: onArrayPair

void Parser::onArrayPair(Token *out, Token *pairs, Token *name, Token *value,
                         bool ref) {
  ExpressionPtr expList;
  if (pairs) {
    expList = pairs->exp;
  } else {
    expList = NEW_EXP0(ExpressionList);
  }
  ExpressionPtr nameExp = name ? name->exp : ExpressionPtr();
  expList->addElement(NEW_EXP(ArrayPairExpression, nameExp, value->exp, ref));
  out->exp = expList;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:12,代码来源:parser.cpp

示例7: onParam

void Parser::onParam(Token *out, Token *params, Token *type, Token *var,
                     bool ref, Token *defValue) {
  ExpressionPtr expList;
  if (params) {
    expList = params->exp;
  } else {
    expList = NEW_EXP0(ExpressionList);
  }
  expList->addElement(NEW_EXP(ParameterExpression, type->text(), var->text(),
                              ref,
                              defValue ? defValue->exp : ExpressionPtr()));
  out->exp = expList;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:13,代码来源:parser.cpp


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