本文整理汇总了C++中Func::appendParam方法的典型用法代码示例。如果您正苦于以下问题:C++ Func::appendParam方法的具体用法?C++ Func::appendParam怎么用?C++ Func::appendParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::appendParam方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
Func* FuncEmitter::create(Unit& unit, PreClass* preClass /* = NULL */) const {
Func* f = (m_pce == NULL)
? m_ue.newFunc(this, unit, m_id, m_line1, m_line2, m_base,
m_past, m_name, m_attrs, m_top, m_docComment,
m_params.size())
: m_ue.newFunc(this, unit, preClass, m_line1, m_line2, m_base,
m_past, m_name, m_attrs, m_top, m_docComment,
m_params.size());
f->shared()->m_info = m_info;
for (unsigned i = 0; i < m_params.size(); ++i) {
Func::ParamInfo pi;
pi.setFuncletOff(m_params[i].funcletOff());
pi.setDefaultValue(m_params[i].defaultValue());
pi.setPhpCode(m_params[i].phpCode());
pi.setTypeConstraint(m_params[i].typeConstraint());
f->appendParam(m_params[i].ref(), pi);
}
f->shared()->m_localNames.create(m_localNames);
f->shared()->m_numLocals = m_numLocals;
f->shared()->m_numIterators = m_numIterators;
f->m_maxStackCells = m_maxStackCells;
ASSERT(m_maxStackCells > 0 && "You probably didn't set m_maxStackCells");
f->shared()->m_staticVars = m_staticVars;
f->shared()->m_ehtab = m_ehtab;
f->shared()->m_fpitab = m_fpitab;
f->shared()->m_isClosureBody = m_isClosureBody;
f->shared()->m_isGenerator = m_isGenerator;
f->shared()->m_isGeneratorFromClosure = m_isGeneratorFromClosure;
f->shared()->m_userAttributes = m_userAttributes;
f->shared()->m_builtinFuncPtr = m_builtinFuncPtr;
return f;
}
示例2: create
Func* FuncEmitter::create(Unit& unit, PreClass* preClass /* = NULL */) const {
Attr attrs = m_attrs;
if (attrs & AttrPersistent &&
(RuntimeOption::EvalJitEnableRenameFunction ||
(!RuntimeOption::RepoAuthoritative && SystemLib::s_inited))) {
attrs = Attr(attrs & ~AttrPersistent);
}
Func* f = (m_pce == NULL)
? m_ue.newFunc(this, unit, m_id, m_line1, m_line2, m_base,
m_past, m_name, attrs, m_top, m_docComment,
m_params.size())
: m_ue.newFunc(this, unit, preClass, m_line1, m_line2, m_base,
m_past, m_name, attrs, m_top, m_docComment,
m_params.size());
f->shared()->m_info = m_info;
f->shared()->m_returnType = m_returnType;
std::vector<Func::ParamInfo> pBuilder;
for (unsigned i = 0; i < m_params.size(); ++i) {
Func::ParamInfo pi;
pi.setFuncletOff(m_params[i].funcletOff());
pi.setDefaultValue(m_params[i].defaultValue());
pi.setPhpCode(m_params[i].phpCode());
pi.setTypeConstraint(m_params[i].typeConstraint());
pi.setUserAttributes(m_params[i].userAttributes());
pi.setBuiltinType(m_params[i].builtinType());
f->appendParam(m_params[i].ref(), pi, pBuilder);
}
f->shared()->m_params = pBuilder;
f->shared()->m_localNames.create(m_localNames);
f->shared()->m_numLocals = m_numLocals;
f->shared()->m_numIterators = m_numIterators;
f->m_maxStackCells = m_maxStackCells;
ASSERT(m_maxStackCells > 0 && "You probably didn't set m_maxStackCells");
f->shared()->m_staticVars = m_staticVars;
f->shared()->m_ehtab = m_ehtab;
f->shared()->m_fpitab = m_fpitab;
f->shared()->m_isClosureBody = m_isClosureBody;
f->shared()->m_isGenerator = m_isGenerator;
f->shared()->m_isGeneratorFromClosure = m_isGeneratorFromClosure;
f->shared()->m_userAttributes = m_userAttributes;
f->shared()->m_builtinFuncPtr = m_builtinFuncPtr;
f->shared()->m_nativeFuncPtr = m_nativeFuncPtr;
return f;
}
示例3: create
Func* FuncEmitter::create(Unit& unit, PreClass* preClass /* = NULL */) const {
bool isGenerated = isdigit(name->data()[0]) ||
ParserBase::IsClosureName(name->toCppString());
Attr attrs = this->attrs;
if (preClass && preClass->attrs() & AttrInterface) {
attrs |= AttrAbstract;
}
if (attrs & AttrPersistent &&
((RuntimeOption::EvalJitEnableRenameFunction && !isGenerated) ||
(!RuntimeOption::RepoAuthoritative && SystemLib::s_inited) ||
attrs & AttrInterceptable)) {
if (attrs & AttrBuiltin) {
SystemLib::s_anyNonPersistentBuiltins = true;
}
attrs = Attr(attrs & ~AttrPersistent);
}
if (RuntimeOption::EvalJitEnableRenameFunction &&
!name->empty() &&
!Func::isSpecial(name) &&
!isClosureBody) {
// intercepted functions need to pass all args through
// to the interceptee
attrs |= AttrMayUseVV;
}
if (isVariadic()) { attrs |= AttrVariadicParam; }
if (!containsCalls) { attrs |= AttrPhpLeafFn; }
assert(!m_pce == !preClass);
Func* f = m_ue.newFunc(this, unit, preClass, line1, line2, base,
past, name, attrs, top, docComment,
params.size(), isClosureBody);
f->shared()->m_info = m_info;
f->shared()->m_returnType = returnType;
std::vector<Func::ParamInfo> fParams;
for (unsigned i = 0; i < params.size(); ++i) {
Func::ParamInfo pi = params[i];
f->appendParam(params[i].byRef, pi, fParams);
}
f->shared()->m_localNames.create(m_localNames);
f->shared()->m_numLocals = m_numLocals;
f->shared()->m_numIterators = m_numIterators;
f->m_maxStackCells = maxStackCells;
f->shared()->m_staticVars = staticVars;
f->shared()->m_ehtab = ehtab;
f->shared()->m_fpitab = fpitab;
f->shared()->m_isClosureBody = isClosureBody;
f->shared()->m_isAsync = isAsync;
f->shared()->m_isGenerator = isGenerator;
f->shared()->m_isPairGenerator = isPairGenerator;
f->shared()->m_userAttributes = userAttributes;
f->shared()->m_builtinFuncPtr = m_builtinFuncPtr;
f->shared()->m_nativeFuncPtr = m_nativeFuncPtr;
f->shared()->m_retTypeConstraint = retTypeConstraint;
f->shared()->m_retUserType = retUserType;
f->shared()->m_originalFilename = originalFilename;
f->shared()->m_isGenerated = isGenerated;
f->finishedEmittingParams(fParams);
if (attrs & AttrNative) {
auto nif = Native::GetBuiltinFunction(name,
m_pce ? m_pce->name() : nullptr,
f->isStatic());
if (nif) {
Attr dummy = AttrNone;
int nativeAttrs = parseNativeAttributes(dummy);
if (nativeAttrs & Native::AttrZendCompat) {
f->shared()->m_nativeFuncPtr = nif;
f->shared()->m_builtinFuncPtr = zend_wrap_func;
} else {
if (parseNativeAttributes(dummy) & Native::AttrActRec) {
f->shared()->m_builtinFuncPtr = nif;
f->shared()->m_nativeFuncPtr = nullptr;
} else {
f->shared()->m_nativeFuncPtr = nif;
f->shared()->m_builtinFuncPtr = m_pce ? Native::methodWrapper
: Native::functionWrapper;
}
}
} else {
f->shared()->m_builtinFuncPtr = Native::unimplementedWrapper;
}
}
return f;
}
示例4: create
Func* FuncEmitter::create(Unit& unit, PreClass* preClass /* = NULL */) const {
bool isGenerated = isdigit(m_name->data()[0]) ||
ParserBase::IsClosureName(m_name->toCPPString()) || m_isGenerator;
Attr attrs = m_attrs;
if (attrs & AttrPersistent &&
((RuntimeOption::EvalJitEnableRenameFunction && !isGenerated) ||
(!RuntimeOption::RepoAuthoritative && SystemLib::s_inited))) {
attrs = Attr(attrs & ~AttrPersistent);
}
if (RuntimeOption::EvalJitEnableRenameFunction &&
!m_name->empty() &&
!Func::isSpecial(m_name) &&
!m_isClosureBody &&
!m_isGenerator) {
// intercepted functions need to pass all args through
// to the interceptee
attrs = attrs | AttrMayUseVV;
}
if (!m_containsCalls) attrs = Attr(attrs | AttrPhpLeafFn);
Func* f = (m_pce == nullptr)
? m_ue.newFunc(this, unit, m_id, m_line1, m_line2, m_base,
m_past, m_name, attrs, m_top, m_docComment,
m_params.size(), m_isClosureBody | m_isGeneratorFromClosure,
m_isGenerator)
: m_ue.newFunc(this, unit, preClass, m_line1, m_line2, m_base,
m_past, m_name, attrs, m_top, m_docComment,
m_params.size(), m_isClosureBody | m_isGeneratorFromClosure,
m_isGenerator);
f->shared()->m_info = m_info;
f->shared()->m_returnType = m_returnType;
std::vector<Func::ParamInfo> pBuilder;
for (unsigned i = 0; i < m_params.size(); ++i) {
Func::ParamInfo pi;
pi.setFuncletOff(m_params[i].funcletOff());
pi.setDefaultValue(m_params[i].defaultValue());
pi.setPhpCode(m_params[i].phpCode());
pi.setTypeConstraint(m_params[i].typeConstraint());
pi.setUserAttributes(m_params[i].userAttributes());
pi.setBuiltinType(m_params[i].builtinType());
pi.setUserType(m_params[i].userType());
f->appendParam(m_params[i].ref(), pi, pBuilder);
}
if (!m_params.size()) {
assert(!f->m_refBitVal && !f->shared()->m_refBitPtr);
f->m_refBitVal = attrs & AttrVariadicByRef ? -1uLL : 0uLL;
}
f->shared()->m_params = pBuilder;
f->shared()->m_localNames.create(m_localNames);
f->shared()->m_numLocals = m_numLocals;
f->shared()->m_numIterators = m_numIterators;
f->m_maxStackCells = m_maxStackCells;
f->shared()->m_staticVars = m_staticVars;
f->shared()->m_ehtab = m_ehtab;
f->shared()->m_fpitab = m_fpitab;
f->shared()->m_isClosureBody = m_isClosureBody;
f->shared()->m_isGenerator = m_isGenerator;
f->shared()->m_isGeneratorFromClosure = m_isGeneratorFromClosure;
f->shared()->m_isPairGenerator = m_isPairGenerator;
f->shared()->m_hasGeneratorAsBody = m_hasGeneratorAsBody;
f->shared()->m_userAttributes = m_userAttributes;
f->shared()->m_builtinFuncPtr = m_builtinFuncPtr;
f->shared()->m_nativeFuncPtr = m_nativeFuncPtr;
f->shared()->m_retTypeConstraint = m_retTypeConstraint;
f->shared()->m_originalFilename = m_originalFilename;
f->shared()->m_isGenerated = isGenerated;
return f;
}