* @brief Creates function type. * * @param context Storage for already created functions, types. * @param returnType Function type return type. * @param parameters Function type parameters types. * @param callConvention Function type call convention. * @param varArgness Info that function takes variable number of arguments or not. * * @par Preconditions * - @a context is not null * - @a returnTy
| 42 | * has already been created and stored in @c context. |
| 43 | */ |
| 44 | std::shared_ptr<FunctionType> FunctionType::create( |
| 45 | const std::shared_ptr<Context> &context, |
| 46 | const std::shared_ptr<Type> &returnType, |
| 47 | const Parameters ¶meters, |
| 48 | const CallConvention &callConvention, |
| 49 | VarArgness varArgness) |
| 50 | { |
| 51 | assert(context && "violated precondition - context cannot be null"); |
| 52 | assert(returnType && "violated precondition - returnType cannot be null"); |
| 53 | |
| 54 | auto type = context->getFunctionType(returnType, parameters, callConvention, varArgness); |
| 55 | if (type) |
| 56 | { |
| 57 | return type; |
| 58 | } |
| 59 | |
| 60 | std::shared_ptr<FunctionType> newType( |
| 61 | new FunctionType(returnType, parameters, callConvention, varArgness)); |
| 62 | context->addFunctionType(newType); |
| 63 | return newType; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * @brief Returns function's return type. |
nothing calls this directly
no test coverage detected