* @brief Creates function type. * * @param context Storage for already created functions, types. * @param returnType Function return type. * @param parameters Function parameters. * @param callConvention Function call convention. * @param varArgness Info that function takes variable number of arguments or not. * * @par Preconditions * - @a context is not null * - @a returnType is not null */
| 192 | * - @a returnType is not null |
| 193 | */ |
| 194 | std::shared_ptr<FunctionType> Function::createFunctionType( |
| 195 | const std::shared_ptr<Context> &context, |
| 196 | const std::shared_ptr<Type> &returnType, |
| 197 | const Parameters ¶meters, |
| 198 | const CallConvention &callConvention, |
| 199 | VarArgness varArgness) |
| 200 | { |
| 201 | assert(context && "violated precondition - context cannot be null"); |
| 202 | assert(returnType && "violated precondition - returnType cannot be null"); |
| 203 | |
| 204 | FunctionType::Parameters paramTypes; |
| 205 | for (const auto ¶m: parameters) |
| 206 | { |
| 207 | paramTypes.push_back(param.getType()); |
| 208 | } |
| 209 | return FunctionType::create(context, returnType, paramTypes, callConvention, varArgness); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * @brief Sets function's call convention. |