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


C++ AnalysisResultPtr::getInsideScalarArray方法代码示例

本文整理汇总了C++中AnalysisResultPtr::getInsideScalarArray方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::getInsideScalarArray方法的具体用法?C++ AnalysisResultPtr::getInsideScalarArray怎么用?C++ AnalysisResultPtr::getInsideScalarArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnalysisResultPtr的用法示例。


在下文中一共展示了AnalysisResultPtr::getInsideScalarArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: postOptimize

ExpressionPtr UnaryOpExpression::postOptimize(AnalysisResultPtr ar) {
  bool insideScalarArray = ar->getInsideScalarArray();

  if (m_op == T_ARRAY &&
      (getContext() & (RefValue|LValue)) == 0) {
    if (m_exp) {
      ExpressionListPtr pairs = dynamic_pointer_cast<ExpressionList>(m_exp);
      if (pairs && pairs->isScalarArrayPairs()) {
        m_arrayId = ar->registerScalarArray(m_exp);
        ar->setInsideScalarArray(true);
      }
    } else {
      m_arrayId = ar->registerScalarArray(m_exp); // empty array
    }
  }

  ar->postOptimize(m_exp);
  if (m_op == T_PRINT && m_exp->is(KindOfEncapsListExpression) &&
      !m_exp->hasEffect()) {
    EncapsListExpressionPtr e = static_pointer_cast<EncapsListExpression>
      (m_exp);
    e->stripConcat();
  }

  ar->setInsideScalarArray(insideScalarArray);

  if (m_op == T_UNSET_CAST && !hasEffect()) {
    return CONSTANT("null");
  } else if (m_op == T_UNSET && m_exp->is(KindOfExpressionList) &&
             !static_pointer_cast<ExpressionList>(m_exp)->getCount()) {
    return CONSTANT("null");
  }

  return ExpressionPtr();
}
开发者ID:kreshano,项目名称:hiphop-php,代码行数:35,代码来源:unary_op_expression.cpp

示例2: postOptimize

ExpressionPtr UnaryOpExpression::postOptimize(AnalysisResultPtr ar) {
    bool insideScalarArray = ar->getInsideScalarArray();

    if (m_op == T_ARRAY &&
            (getContext() & (RefValue|LValue)) == 0) {
        if (m_exp) {
            ExpressionListPtr pairs = dynamic_pointer_cast<ExpressionList>(m_exp);
            if (pairs && pairs->isScalarArrayPairs()) {
                m_arrayId = ar->registerScalarArray(m_exp);
                ar->setInsideScalarArray(true);
            }
        } else {
            m_arrayId = ar->registerScalarArray(m_exp); // empty array
        }
    }

    ar->postOptimize(m_exp);

    ar->setInsideScalarArray(insideScalarArray);
    return ExpressionPtr();
}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:21,代码来源:unary_op_expression.cpp

示例3: 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 &&
      !ar->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(getFileScope(), m_exp, hash, index, text);
      }
    } else {
      id = ar->registerScalarArray(getFileScope(), m_exp,
                                   hash, index, text); // empty array
    }
    if (id != -1) {
      if (Option::UseNamedScalarArray &&
          cg.getContext() == CodeGenerator::CppParameterDefaultValueDecl) {
        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 '(':             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->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) {
        bool instance;
        if (getClassScope()) {
          FunctionScopePtr fs = getFunctionScope();
          instance = fs && !fs->isStatic();
        } else {
          instance = false;
        }
//.........这里部分代码省略.........
开发者ID:dipjyotighosh,项目名称:hiphop-php,代码行数:101,代码来源:unary_op_expression.cpp

示例4: outputCPPImpl

void UnaryOpExpression::outputCPPImpl(CodeGenerator &cg,
                                      AnalysisResultPtr ar) {
    if (m_arrayId != -1) {
        if (cg.getOutput() == CodeGenerator::SystemCPP) {
            cg.printf("SystemScalarArrays::%s[%d]",
                      Option::SystemScalarArrayName, m_arrayId);
        } else {
            cg.printf("ScalarArrays::%s[%d]",
                      Option::ScalarArrayName, m_arrayId);
        }
        return;
    }

    if ((m_op == T_ISSET || m_op == T_EMPTY) && m_exp) {
        if (m_exp->is(Expression::KindOfExpressionList)) {
            ExpressionListPtr exps = dynamic_pointer_cast<ExpressionList>(m_exp);
            if (exps->getCount() > 1) {
                cg.printf("(");
            }
            for (int i = 0; i < exps->getCount(); i++) {
                if (i > 0) cg.printf(" && ");
                (*exps)[i]->outputCPPExistTest(cg, ar, m_op);
            }
            if (exps->getCount() > 1) {
                cg.printf(")");
            }
        } 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 '(':
            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:
            cg.printf("unset(");
            break;
        case T_EXIT:
            cg.printf("f_exit(");
            break;
        case T_ARRAY:
            if (ar->getInsideScalarArray()) {
                cg.printf("StaticArray(");
            } else {
                cg.printf("Array(");
            }
            break;
        case T_PRINT:
            cg.printf("print(");
            break;
        case T_EVAL:
            if (Option::EnableEval > Option::NoEval) {
                cg.printf("eval(%s, Object(%s), ",
                          ar->getScope()->inPseudoMain() ?
                          "get_variable_table()" : "variables",
                          ar->getClassScope() ? "this" : "");
            } else {
                cg.printf("f_eval(");
//.........这里部分代码省略.........
开发者ID:sumitk,项目名称:hiphop-php,代码行数:101,代码来源:unary_op_expression.cpp


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