void FuncEmitter::setBuiltinFunc(const ClassInfo::MethodInfo* info, BuiltinFunction bif, BuiltinFunction nif, Offset base) { assert(info); m_info = info; Attr attrs = AttrBuiltin; if (info->attribute & (ClassInfo::RefVariableArguments | ClassInfo::MixedVariableArguments)) { attrs = attrs | AttrVariadicByRef; } if (info->attribute & ClassInfo::IsReference) { attrs = attrs | AttrReference; } if (info->attribute & ClassInfo::NoInjection) { attrs = attrs | AttrNoInjection; } if (info->attribute & ClassInfo::NoFCallBuiltin) { attrs = attrs | AttrNoFCallBuiltin; } if (info->attribute & ClassInfo::ParamCoerceModeNull) { attrs = attrs | AttrParamCoerceModeNull; } else if (info->attribute & ClassInfo::ParamCoerceModeFalse) { attrs = attrs | AttrParamCoerceModeFalse; } if (pce()) { if (info->attribute & ClassInfo::IsStatic) { attrs = attrs | AttrStatic; } if (info->attribute & ClassInfo::IsFinal) { attrs = attrs | AttrFinal; } if (info->attribute & ClassInfo::IsAbstract) { attrs = attrs | AttrAbstract; } if (info->attribute & ClassInfo::IsPrivate) { attrs = attrs | AttrPrivate; } else if (info->attribute & ClassInfo::IsProtected) { attrs = attrs | AttrProtected; } else { attrs = attrs | AttrPublic; } } else if (info->attribute & ClassInfo::AllowOverride) { attrs = attrs | AttrAllowOverride; } setReturnType(info->returnType); setDocComment(info->docComment); setLocation(0, 0); setBuiltinFunc(bif, nif, attrs, base); for (unsigned i = 0; i < info->parameters.size(); ++i) { // For builtin only, we use a dummy ParamInfo FuncEmitter::ParamInfo pi; const auto& parameter = info->parameters[i]; pi.setRef((bool)(parameter->attribute & ClassInfo::IsReference)); pi.builtinType = parameter->argType; appendParam(makeStaticString(parameter->name), pi); } }
void FuncEmitter::setBuiltinFunc(const ClassInfo::MethodInfo* info, BuiltinFunction bif, BuiltinFunction nif, Offset base) { assert(info); assert(bif); m_info = info; m_builtinFuncPtr = bif; m_nativeFuncPtr = nif; m_base = base; m_top = true; m_docComment = StringData::GetStaticString(info->docComment); m_line1 = 0; m_line2 = 0; m_attrs = AttrBuiltin | AttrSkipFrame; // TODO: Task #1137917: See if we can avoid marking most builtins with // "MayUseVV" and still make things work m_attrs = m_attrs | AttrMayUseVV; if (info->attribute & (ClassInfo::RefVariableArguments | ClassInfo::MixedVariableArguments)) { m_attrs = m_attrs | AttrVariadicByRef; } if (info->attribute & ClassInfo::IsReference) { m_attrs = m_attrs | AttrReference; } if (info->attribute & ClassInfo::NoInjection) { m_attrs = m_attrs | AttrNoInjection; } if (pce()) { if (info->attribute & ClassInfo::IsStatic) { m_attrs = m_attrs | AttrStatic; } if (info->attribute & ClassInfo::IsFinal) { m_attrs = m_attrs | AttrFinal; } if (info->attribute & ClassInfo::IsAbstract) { m_attrs = m_attrs | AttrAbstract; } if (info->attribute & ClassInfo::IsPrivate) { m_attrs = m_attrs | AttrPrivate; } else if (info->attribute & ClassInfo::IsProtected) { m_attrs = m_attrs | AttrProtected; } else { m_attrs = m_attrs | AttrPublic; } } else if (info->attribute & ClassInfo::AllowOverride) { m_attrs = m_attrs | AttrAllowOverride; } m_returnType = info->returnType; for (unsigned i = 0; i < info->parameters.size(); ++i) { // For builtin only, we use a dummy ParamInfo FuncEmitter::ParamInfo pi; pi.setRef((bool)(info->parameters[i]->attribute & ClassInfo::IsReference)); pi.setBuiltinType(info->parameters[i]->argType); appendParam(StringData::GetStaticString(info->parameters[i]->name), pi); } }
void FuncEmitter::setBuiltinFunc(const ClassInfo::MethodInfo* info, BuiltinFunction funcPtr, Offset base) { ASSERT(info); ASSERT(funcPtr); m_info = info; m_builtinFuncPtr = funcPtr; m_base = base; m_top = true; m_docComment = StringData::GetStaticString(info->docComment); m_line1 = 0; m_line2 = 0; m_attrs = AttrNone; // TODO: Task #1137917: See if we can avoid marking most builtins with // "MayUseVV" and still make things work m_attrs = (Attr)(m_attrs | AttrMayUseVV); if (info->attribute & (ClassInfo::RefVariableArguments | ClassInfo::MixedVariableArguments)) { m_attrs = Attr(m_attrs | AttrVariadicByRef); } if (info->attribute & ClassInfo::IsReference) { m_attrs = (Attr)(m_attrs | AttrReference); } if (info->attribute & ClassInfo::NoInjection) { m_attrs = (Attr)(m_attrs | AttrNoInjection); } if (pce()) { if (info->attribute & ClassInfo::IsStatic) { m_attrs = (Attr)(m_attrs | AttrStatic); } if (info->attribute & ClassInfo::IsFinal) { m_attrs = (Attr)(m_attrs | AttrFinal); } if (info->attribute & ClassInfo::IsAbstract) { m_attrs = (Attr)(m_attrs | AttrAbstract); } if (info->attribute & ClassInfo::IsPrivate) { m_attrs = (Attr)(m_attrs | AttrPrivate); } else if (info->attribute & ClassInfo::IsProtected) { m_attrs = (Attr)(m_attrs | AttrProtected); } else { m_attrs = (Attr)(m_attrs | AttrPublic); } } for (unsigned i = 0; i < info->parameters.size(); ++i) { // For builtin only, we use a dummy ParamInfo FuncEmitter::ParamInfo pi; pi.setRef((bool)(info->parameters[i]->attribute & ClassInfo::IsReference)); appendParam(StringData::GetStaticString(info->parameters[i]->name), pi); } }