本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}