本文整理汇总了C++中ExpressionPtr::canonCompare方法的典型用法代码示例。如果您正苦于以下问题:C++ ExpressionPtr::canonCompare方法的具体用法?C++ ExpressionPtr::canonCompare怎么用?C++ ExpressionPtr::canonCompare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionPtr
的用法示例。
在下文中一共展示了ExpressionPtr::canonCompare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
ExpressionPtr BucketMapEntry::find(ExpressionPtr e) {
ExpressionPtrList::iterator it = m_exprs.begin();
while (it != m_exprs.end()) {
ExpressionPtr c = *it;
if (e->canonCompare(c)) {
return c;
}
++it;
}
return ExpressionPtr();
}
示例2: AssignmentCouldSet
static bool AssignmentCouldSet(ExpressionListPtr vars, ExpressionPtr var) {
for (int i = 0; i < vars->getCount(); i++) {
ExpressionPtr v = (*vars)[i];
if (!v) continue;
if (v->is(Expression::KindOfSimpleVariable) &&
v->canonCompare(var)) {
return true;
}
if (v->is(Expression::KindOfDynamicVariable)) return true;
if (v->is(Expression::KindOfListAssignment) &&
AssignmentCouldSet(static_pointer_cast<ListAssignment>(v)->
getVariables(), var)) {
return true;
}
}
return false;
}
示例3: testAccesses
int AliasManager::testAccesses(ExpressionPtr e1, ExpressionPtr e2) {
Expression::KindOf k1 = e1->getKindOf(), k2 = e2->getKindOf();
while (true) {
switch (k1) {
case Expression::KindOfConstantExpression:
if (e1->canonCompare(e2)) return SameAccess;
switch (k2) {
case Expression::KindOfObjectMethodExpression:
case Expression::KindOfDynamicFunctionCall:
case Expression::KindOfSimpleFunctionCall:
case Expression::KindOfNewObjectExpression:
return InterfAccess;
default:
return DisjointAccess;
}
break;
case Expression::KindOfArrayElementExpression:
if (k2 == Expression::KindOfSimpleVariable ||
k2 == Expression::KindOfDynamicVariable ||
k2 == Expression::KindOfConstantExpression) {
break;
}
return e1->canonCompare(e2) ?
SameAccess : InterfAccess;
case Expression::KindOfStaticMemberExpression:
if (k2 == Expression::KindOfSimpleVariable ||
k2 == Expression::KindOfConstantExpression) {
break;
}
return e1->canonCompare(e2) ?
SameAccess : InterfAccess;
case Expression::KindOfObjectPropertyExpression:
if (k2 == Expression::KindOfSimpleVariable ||
k2 == Expression::KindOfConstantExpression) {
break;
}
return InterfAccess;
case Expression::KindOfDynamicVariable:
if (k2 == Expression::KindOfSimpleVariable ||
k2 == Expression::KindOfConstantExpression) {
break;
}
return e1->canonCompare(e2) ?
SameAccess : InterfAccess;
case Expression::KindOfSimpleVariable:
{
if (k2 == Expression::KindOfConstantExpression) {
return DisjointAccess;
}
SimpleVariablePtr sv1 = spc(SimpleVariable, e1);
AliasInfo &ai1 = m_aliasInfo[sv1->getName()];
switch (k2) {
case Expression::KindOfSimpleVariable:
{
SimpleVariablePtr sv2 = spc(SimpleVariable, e2);
if (sv1->getName() == sv2->getName()) {
return SameAccess;
}
AliasInfo &ai2 = m_aliasInfo[sv2->getName()];
if (ai1.getIsRefTo() || ai1.getIsGlobal()) {
return m_wildRefs || ai2.getIsGlobal() || ai2.checkRefLevel(0) ?
InterfAccess : DisjointAccess;
}
if (ai2.getIsRefTo() || ai2.getIsGlobal()) {
return m_wildRefs || ai1.getIsGlobal() || ai1.checkRefLevel(0) ?
InterfAccess : DisjointAccess;
}
}
return DisjointAccess;
case Expression::KindOfDynamicVariable:
return InterfAccess;
case Expression::KindOfArrayElementExpression:
if (ai1.getIsRefTo() || ai1.getIsGlobal() ||
m_wildRefs || ai1.checkRefLevel(0)) {
return InterfAccess;
} else {
// $a = "foo"; $a[0] = "x";
ExpressionPtr var = spc(ArrayElementExpression, e2)->getVariable();
if (e1->canonCompare(var)) {
return InterfAccess;
}
}
return DisjointAccess;
case Expression::KindOfStaticMemberExpression:
case Expression::KindOfObjectPropertyExpression:
default:
if (ai1.getIsRefTo() || ai1.getIsGlobal() || m_wildRefs) {
return InterfAccess;
//.........这里部分代码省略.........