示例#1
0
int fbtBuildInfo::getLengths(fbtBuildStructs& struct_builders)
{


	makeBuiltinTypes();

	fbtBuildStructs::Iterator bit = struct_builders.iterator();
	while (bit.hasMoreElements())
	{
		fbtBuildStruct& bs = bit.getNext();
		bs.m_structId = addType(bs.m_name, 0);

		m_strc.push_back(bs.m_structId);
		m_strc.push_back((FBTint16)bs.m_data.size());

		m_alloc.m_strc += (sizeof(FBTtype) * 2);


		fbtVariables::Iterator it = bs.m_data.iterator();
		while (it.hasMoreElements())
		{
			fbtVariable& cvar = it.getNext();

			cvar.m_typeId = addType(cvar.m_type, 0);
			cvar.m_nameId = addName(cvar.m_name);

			m_strc.push_back(cvar.m_typeId);
			m_strc.push_back(cvar.m_nameId);

			m_alloc.m_strc += (sizeof(FBTtype) * 2);
		}
	}

	return getTLengths(struct_builders);
}
示例#2
0
		FunctionType
		FunctionType::substitute(const TemplateVarMap& templateVarMap,
		                         const Predicate& selfconst) const {
			if (templateVarMap.empty() && selfconst.isSelfConst()) {
				return *this;
			}
			
			const auto substitutedReturnType = returnType()->substitute(templateVarMap,
			                                                            selfconst);
			
			bool changed = (substitutedReturnType != returnType());
			
			TypeArray substitutedParameterTypes;
			
			for (const auto parameterType: parameterTypes()) {
				const auto substitutedParameterType = parameterType->substitute(templateVarMap,
				                                                                selfconst);
				changed |= (substitutedParameterType != parameterType);
				substitutedParameterTypes.push_back(substitutedParameterType);
			}
			
			auto noExceptPredicate = attributes().noExceptPredicate().substitute(templateVarMap,
			                                                                     selfconst);
			changed |= (noExceptPredicate != attributes().noExceptPredicate());
			
			if (changed) {
				FunctionAttributes newAttributes(attributes().isVarArg(),
				                                 attributes().isMethod(),
				                                 attributes().isTemplated(),
				                                 std::move(noExceptPredicate));
				return FunctionType(std::move(newAttributes), substitutedReturnType, std::move(substitutedParameterTypes));
			} else {
				return *this;
			}
		}