void ObjectMethodExpression::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { if (!m_name.empty() && m_valid && m_object->getType()->isSpecificObject()) { // Static method call outputCPPObjectCall(cg, ar); cg_printf("%s%s(", m_funcScope ? m_funcScope->getPrefix(m_params) : Option::MethodPrefix, m_name.c_str()); FunctionScope::OutputCPPArguments(m_params, m_funcScope, cg, ar, m_extraArg, m_variableArgument, m_argArrayId, m_argArrayHash, m_argArrayIndex); cg_printf(")"); } else { bool maybeStatic = true; if (!ar->isSystem() && !m_name.empty()) { FunctionScope::FunctionInfoPtr info = FunctionScope::GetFunctionInfo(m_name); if (info && !info->getMaybeStatic()) maybeStatic = false; } cg_printf("(mcp%d.%s->", m_ciTemp, maybeStatic ? "bindClass(fi)" : "ci" ); outputDynamicCall(cg, ar, true); } }
void FunctionCall::markRefParams(FunctionScopePtr func, const std::string &fooBarName) { ExpressionList ¶ms = *m_params; if (func) { int mpc = func->getMaxParamCount(); for (int i = params.getCount(); i--; ) { ExpressionPtr p = params[i]; if (i < mpc ? func->isRefParam(i) : func->isReferenceVariableArgument()) { p->setContext(Expression::RefValue); } else if (i < mpc && p->hasContext(RefParameter)) { Symbol *sym = func->getVariables()->addSymbol(func->getParamName(i)); sym->setLvalParam(); sym->setCallTimeRef(); } } } else if (Option::WholeProgram && !m_origName.empty()) { FunctionScope::FunctionInfoPtr info = FunctionScope::GetFunctionInfo(m_origName); if (info) { for (int i = params.getCount(); i--; ) { if (info->isRefParam(i)) { m_params->markParam(i); } } } // If we cannot find information of the so-named function, it might not // exist, or it might go through __call(), either of which cannot have // reference parameters. } else { for (int i = params.getCount(); i--; ) { m_params->markParam(i); } } }
void ObjectMethodExpression::setInvokeParams(AnalysisResultPtr ar) { FunctionScope::FunctionInfoPtr info = FunctionScope::GetFunctionInfo(m_name); if (info || m_name.empty()) { for (int i = m_params->getCount(); i--; ) { if (!info || info->isRefParam(i)) { m_params->markParam(i, canInvokeFewArgs()); } } } // If we cannot find information of the so-named function, it might not // exist, or it might go through __call(), either of which cannot have // reference parameters. for (int i = 0; i < m_params->getCount(); i++) { (*m_params)[i]->inferAndCheck(ar, Type::Variant, false); } m_params->resetOutputCount(); }