本文整理汇总了C++中StatementPtr::getExpression方法的典型用法代码示例。如果您正苦于以下问题:C++ StatementPtr::getExpression方法的具体用法?C++ StatementPtr::getExpression怎么用?C++ StatementPtr::getExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementPtr
的用法示例。
在下文中一共展示了StatementPtr::getExpression方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findInterpolatable
CodeNodePtr findInterpolatable(StatementPtr stmt) {
if (CodeNodePtr e = stmt->getExpression()) {
if (CodeNodePtr f = findInterpolatable(e)) {
return f;
}
}
StatementList children = stmt->getChildren();
for (size_t i = 0; i < children.size(); ++i) {
if (CodeNodePtr f = findInterpolatable(children[i])) {
return f;
}
}
return CodeNodePtr();
}
示例2: doCountReferences
static void doCountReferences(
StatementPtr statement,
ReferenceMap& refs,
ReferencePath path
) {
assert(statement);
path.push_back(statement);
if (CodeNodePtr e = statement->getExpression()) {
countReferences(e, refs, path);
}
StatementList children = statement->getChildren();
for (size_t i = 0; i < children.size(); ++i) {
doCountReferences(children[i], refs, path);
}
}
示例3: replace
void replace(StatementPtr st, CodeNodePtr node, CodeNodePtr with) {
assert(st);
assert(node);
assert(with);
if (CodeNodePtr e = st->getExpression()) {
if (e == node) {
st->setExpression(with);
} else {
replace(e, node, with);
}
}
StatementList children = st->getChildren();
for (size_t i = 0; i < children.size(); ++i) {
replace(children[i], node, with);
}
}
示例4: findBranch
IfCodeNodePtr findBranch(StatementPtr stmt, StatementPtr& ref) {
assert(stmt);
if (CodeNodePtr e = stmt->getExpression()) {
if (IfCodeNodePtr f = findBranch(e)) {
ref = stmt;
return f;
}
}
StatementList children = stmt->getChildren();
for (size_t i = 0; i < children.size(); ++i) {
if (IfCodeNodePtr f = findBranch(children[i], ref)) {
return f;
}
}
return IfCodeNodePtr();
}
示例5: findMultiplyReferenced
CodeNodePtr findMultiplyReferenced(
StatementPtr stmt,
const ReferenceMap& refs
) {
assert(stmt);
if (CodeNodePtr e = stmt->getExpression()) {
if (CodeNodePtr f = findMultiplyReferenced(e, refs)) {
return f;
}
}
StatementList children = stmt->getChildren();
for (size_t i = 0; i < children.size(); ++i) {
if (CodeNodePtr f = findMultiplyReferenced(children[i], refs)) {
return f;
}
}
return CodeNodePtr();
}