本文整理汇总了C++中CodeGenerator::getInsideScalarArray方法的典型用法代码示例。如果您正苦于以下问题:C++ CodeGenerator::getInsideScalarArray方法的具体用法?C++ CodeGenerator::getInsideScalarArray怎么用?C++ CodeGenerator::getInsideScalarArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator::getInsideScalarArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputCPPImpl
void UnaryOpExpression::outputCPPImpl(CodeGenerator &cg,
AnalysisResultPtr ar) {
if ((m_op == T_INC || m_op == T_DEC) && outputCPPImplOpEqual(cg, ar)) {
return;
}
if (m_op == T_ARRAY &&
(getContext() & (RefValue|LValue)) == 0 &&
!cg.getInsideScalarArray()) {
int id = -1;
int hash = -1;
int index = -1;
string text;
if (m_exp) {
ExpressionListPtr pairs = dynamic_pointer_cast<ExpressionList>(m_exp);
Variant v;
if (pairs && pairs->isScalarArrayPairs() && pairs->getScalarValue(v)) {
id = ar->registerScalarArray(cg.getInsideScalarArray(), getFileScope(),
m_exp, hash, index, text);
}
} else {
id = ar->registerScalarArray(cg.getInsideScalarArray(), getFileScope(),
m_exp, hash, index, text); // empty array
}
if (id != -1) {
if (Option::UseNamedScalarArray && cg.isFileOrClassHeader()) {
if (getClassScope()) {
getClassScope()->addUsedDefaultValueScalarArray(text);
} else {
getFileScope()->addUsedDefaultValueScalarArray(text);
}
}
ar->outputCPPScalarArrayId(cg, id, hash, index);
return;
}
}
if ((m_op == T_ISSET || m_op == T_EMPTY || m_op == T_UNSET) && m_exp) {
if (m_exp->is(Expression::KindOfExpressionList)) {
ExpressionListPtr exps = dynamic_pointer_cast<ExpressionList>(m_exp);
if (exps->getListKind() == ExpressionList::ListKindParam) {
int count = exps->getCount();
if (count > 1) {
cg_printf("(");
}
for (int i = 0; i < count; i++) {
if (m_op == T_UNSET) {
if (i > 0) cg_printf(", ");
(*exps)[i]->outputCPPUnset(cg, ar);
} else {
if (i > 0) cg_printf(" && ");
(*exps)[i]->outputCPPExistTest(cg, ar, m_op);
}
}
if (exps->getCount() > 1) {
cg_printf(")");
}
return;
}
}
if (m_op == T_UNSET) {
m_exp->outputCPPUnset(cg, ar);
} else {
m_exp->outputCPPExistTest(cg, ar, m_op);
}
return;
}
if (m_front) {
switch (m_op) {
case T_CLONE: cg_printf("f_clone("); break;
case T_INC: cg_printf("++"); break;
case T_DEC: cg_printf("--"); break;
case '+': cg_printf("+"); break;
case '-': cg_printf("negate("); break;
case '!': cg_printf("!("); break;
case '~': cg_printf("~"); break;
case T_INT_CAST: cg_printf("("); break;
case T_DOUBLE_CAST: cg_printf("("); break;
case T_STRING_CAST: cg_printf("("); break;
case T_ARRAY_CAST: cg_printf("("); break;
case T_OBJECT_CAST: cg_printf("("); break;
case T_BOOL_CAST: cg_printf("("); break;
case T_UNSET_CAST:
if (m_exp->isScalar()) {
cg_printf("(null)");
return;
}
if (m_exp->hasCPPTemp()) {
cg_printf("(id(");
} else {
cg_printf("(");
}
break;
case T_EXIT: cg_printf("f_exit("); break;
case T_ARRAY:
cg_printf("Array(");
break;
case T_PRINT: cg_printf("print("); break;
case T_EVAL:
if (Option::EnableEval > Option::NoEval) {
//.........这里部分代码省略.........