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


C++ FunctionScopePtr::disableInline方法代码示例

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


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

示例1: onParse

void SimpleFunctionCall::onParse(AnalysisResultPtr ar) {
    if (m_class) return;

    FileScopePtr fs = ar->getFileScope();
    ConstructPtr self = shared_from_this();
    if (m_className.empty()) {
        CodeErrorPtr codeError = ar->getCodeError();
        switch (m_type) {
        case CreateFunction:
            if (m_params->getCount() == 2 &&
                    (*m_params)[0]->isLiteralString() &&
                    (*m_params)[1]->isLiteralString()) {
                FunctionScopePtr func = ar->getFunctionScope();
                if (func) func->disableInline();
                string params = (*m_params)[0]->getLiteralString();
                string body = (*m_params)[1]->getLiteralString();
                m_lambda = CodeGenerator::GetNewLambda();
                string code = "function " + m_lambda + "(" + params + ") "
                              "{" + body + "}";
                ar->appendExtraCode(code);
            }
            break;
        case VariableArgumentFunction:
            ar->getFileScope()->setAttribute(FileScope::VariableArgument);
            break;
        case ExtractFunction:
            ar->getCodeError()->record(self, CodeError::UseExtract, self);
            ar->getFileScope()->setAttribute(FileScope::ContainsLDynamicVariable);
            ar->getFileScope()->setAttribute(FileScope::ContainsExtract);
            break;
        case CompactFunction:
            ar->getFileScope()->setAttribute(FileScope::ContainsDynamicVariable);
            ar->getFileScope()->setAttribute(FileScope::ContainsCompact);
            break;
        case ShellExecFunction:
            ar->getCodeError()->record(self, CodeError::UseShellExec, self);
            break;
        case GetDefinedVarsFunction:
            ar->getFileScope()->setAttribute(FileScope::ContainsGetDefinedVars);
            ar->getFileScope()->setAttribute(FileScope::ContainsCompact);
            break;
        default:
            CHECK_HOOK(onSimpleFunctionCallFuncType);
            break;
        }
    }

    string call = getText();
    string name = m_name;
    if (!m_className.empty()) {
        name = m_className + "::" + name;
    }
    ar->getDependencyGraph()->add(DependencyGraph::KindOfFunctionCall, call,
                                  shared_from_this(), name);
}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:55,代码来源:simple_function_call.cpp

示例2: analyzeProgram

void ListAssignment::analyzeProgram(AnalysisResultPtr ar) {
  if (m_variables) m_variables->analyzeProgram(ar);
  if (m_array) m_array->analyzeProgram(ar);
  FunctionScopePtr func = getFunctionScope();
  if (func) func->disableInline();
  if (ar->getPhase() == AnalysisResult::AnalyzeFinal) {
    if (m_variables) {
      for (int i = 0; i < m_variables->getCount(); i++) {
        ExpressionPtr exp = (*m_variables)[i];
        if (exp) {
          if (!exp->is(Expression::KindOfListAssignment)) {
            CheckNeeded(exp, ExpressionPtr());
          }
        }
      }
    }
  }
}
开发者ID:bastiaanzapf,项目名称:hiphop-php,代码行数:18,代码来源:list_assignment.cpp

示例3: analyzeProgram

void ListAssignment::analyzeProgram(AnalysisResultPtr ar) {
  if (m_variables) m_variables->analyzeProgram(ar);
  if (m_array) m_array->analyzeProgram(ar);
  FunctionScopePtr func = ar->getFunctionScope();
  if (func) func->disableInline();
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:6,代码来源:list_assignment.cpp

示例4: onParseImpl

FunctionScopePtr MethodStatement::onParseImpl(AnalysisResultPtr ar) {
  int minParam, maxParam;
  ConstructPtr self = shared_from_this();
  minParam = maxParam = 0;
  bool hasRef = false;
  if (m_params) {
    set<string> names;
    int i = 0;
    maxParam = m_params->getCount();
    for (; i < maxParam; i++) {
      ParameterExpressionPtr param =
        dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
      if (param->isRef()) hasRef = true;
      if (param->isOptional()) break;
      minParam++;
    }
    for (i++; i < maxParam; i++) {
      ParameterExpressionPtr param =
        dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
      if (param->isRef()) hasRef = true;
      if (!param->isOptional()) {
        ar->getCodeError()->record(self, CodeError::RequiredAfterOptionalParam,
                                   param);
        param->defaultToNull(ar);
      }
    }

    if (ar->isFirstPass()) {
      for (i = 0; i < maxParam; i++) {
        ParameterExpressionPtr param =
          dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
        if (names.find(param->getName()) == names.end()) {
          names.insert(param->getName());
        } else {
          ar->getCodeError()->record(self,
                                     CodeError::RedundantParameter, param);
          for (int j = 0; j < 1000; j++) {
            string name = param->getName() + lexical_cast<string>(j);
            if (names.find(name) == names.end()) {
              param->rename(name);
              break;
            }
          }
        }
      }
    }
  }

  if (hasRef || m_ref) {
    m_attribute |= FileScope::ContainsReference;
  }

  StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this());
  FunctionScopePtr funcScope
    (new FunctionScope(ar, m_method, m_name, stmt, m_ref, minParam, maxParam,
                       m_modifiers, m_attribute, m_docComment,
                       ar->getFileScope()));
  if (!m_stmt) {
    funcScope->setVirtual();
  }
  m_funcScope = funcScope;

  // TODO: this may have to expand to a concept of "virtual" functions...
  if (ar->getClassScope()) {
    funcScope->disableInline();
    if (m_name.length() > 2 && m_name.substr(0,2) == "__") {
      bool magic = true;
      int paramCount = 0;
      if (m_name == "__destruct") {
        funcScope->setOverriding(Type::Variant);
      } else if (m_name == "__call") {
        funcScope->setOverriding(Type::Variant, Type::String, Type::Array);
        paramCount = 2;
      } else if (m_name == "__set") {
        funcScope->setOverriding(Type::Variant, Type::String, Type::Variant);
        paramCount = 2;
      } else if (m_name == "__get") {
        funcScope->setOverriding(Type::Variant, Type::String);
        paramCount = 1;
      } else if (m_name == "__isset") {
        funcScope->setOverriding(Type::Boolean, Type::String);
        paramCount = 1;
      } else if (m_name == "__unset") {
        funcScope->setOverriding(Type::Variant, Type::String);
        paramCount = 1;
      } else if (m_name == "__sleep") {
        funcScope->setOverriding(Type::Variant);
      } else if (m_name == "__wakeup") {
        funcScope->setOverriding(Type::Variant);
      } else if (m_name == "__set_state") {
        funcScope->setOverriding(Type::Variant, Type::Variant);
        paramCount = 1;
      } else if (m_name == "__tostring") {
        funcScope->setOverriding(Type::String);
      } else if (m_name == "__clone") {
        funcScope->setOverriding(Type::Variant);
      } else {
        paramCount = -1;
        if (m_name != "__construct") {
          ar->getCodeError()->record(self, CodeError::UnknownMagicMethod,
//.........这里部分代码省略.........
开发者ID:yigithub,项目名称:hiphop-php,代码行数:101,代码来源:method_statement.cpp


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