当前位置: 首页>>代码示例>>C++>>正文


C++ ExpressionPtr::canonCompare方法代码示例

本文整理汇总了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();
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:12,代码来源:alias_manager.cpp

示例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;
}
开发者ID:360buyliulei,项目名称:hiphop-php,代码行数:17,代码来源:list_assignment.cpp

示例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;
//.........这里部分代码省略.........
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:101,代码来源:alias_manager.cpp


注:本文中的ExpressionPtr::canonCompare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。