本文整理汇总了C++中Expression::getContext方法的典型用法代码示例。如果您正苦于以下问题:C++ Expression::getContext方法的具体用法?C++ Expression::getContext怎么用?C++ Expression::getContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::getContext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpNode
void Construct::dumpNode(int spc) {
int nkid = getKidCount();
const char* name = nullptr;
int type = 0;
std::string scontext;
std::string value;
std::string type_info;
int ef = 0;
if (isStatement()) {
Statement *s = static_cast<Statement*>(this);
auto stype = s->getKindOf();
name = Statement::nameOfKind(stype);
value = s->getName();
type = (int)stype;
} else {
assert(isExpression());
Expression *e = static_cast<Expression*>(this);
ef = e->getLocalEffects();
Expression::KindOf etype = e->getKindOf();
name = Expression::nameOfKind(etype);
switch (etype) {
case Expression::KindOfSimpleFunctionCall:
value = static_cast<SimpleFunctionCall*>(e)->getFullName();
break;
case Expression::KindOfSimpleVariable:
value = static_cast<SimpleVariable*>(e)->getName();
break;
case Expression::KindOfConstantExpression:
value = e->getText();
break;
case Expression::KindOfScalarExpression:
value = e->getText();
break;
default: break;
}
int c = e->getContext();
if ((c & Expression::Declaration) == Expression::Declaration) {
scontext += "|Declaration";
} else if (c & Expression::LValue) {
scontext += "|LValue";
}
if (c & Expression::NoLValueWrapper) {
scontext += "|NoLValueWrapper";
}
if (c & Expression::RefValue) {
scontext += "|RefValue";
}
if (c & Expression::RefParameter) {
scontext += "|RefParameter";
}
if (c & Expression::DeepReference) {
scontext += "|DeepReference";
}
if (c & Expression::ObjectContext) {
scontext += "|ObjectContext";
}
if (c & Expression::InParameterExpression) {
scontext += "|InParameterExpression";
}
if (c & Expression::ExistContext) {
scontext += "|ExistContext";
}
if (c & Expression::UnsetContext) {
scontext += "|UnsetContext";
}
if (c & Expression::AssignmentLHS) {
scontext += "|AssignmentLHS";
}
if (c & Expression::RefAssignmentLHS) {
scontext += "|RefAssignmentLHS";
}
if (c & Expression::DeepAssignmentLHS) {
scontext += "|DeepAssignmentLHS";
}
if (c & Expression::AssignmentRHS) {
scontext += "|AssignmentRHS";
}
if (c & Expression::InvokeArgument) {
scontext += "|InvokeArgument";
}
if (c & Expression::OprLValue) {
scontext += "|OprLValue";
}
if (c & Expression::DeepOprLValue) {
scontext += "|DeepOprLValue";
}
if (c & Expression::AccessContext) {
scontext += "|AccessContext";
}
if (c & Expression::ReturnContext) {
scontext += "|ReturnContext";
}
if (scontext != "") {
scontext = " (" + scontext.substr(1) + ")";
}
//.........这里部分代码省略.........
示例2: StmtExpr
/**
* Create an expression statement corresponding to a single expression,
* using that expression's context as our own.
*/
StmtExpr(Expression *expr) : Statement(expr->getContext()), expr(expr)
{
}