src/sksl/SkSLIRGenerator.cpp
/**
 * Determines the cost of coercing the arguments of a function to the required types. Cost has no
 * particular meaning other than "lower costs are preferred". Returns CoercionCost::Impossible() if
 * the call is not valid.
 */
Determines the cost of coercing the arguments of a function to the required types. Cost has no
particular meaning other than "lower costs are preferred". Returns CoercionCost::Impossible() if
the call is not valid.
Determines the cost of coercing the arguments of a function to the required types . Cost has no particular meaning other than " lower costs are preferred " . Returns CoercionCost :: Impossible () if the call is not valid .
CoercionCost IRGenerator::callCost(const FunctionDeclaration& function,
                                   const std::vector<std::unique_ptr<Expression>>& arguments) {
    if (function.fParameters.size() != arguments.size()) {
        return CoercionCost::Impossible();
    }
    std::vector<const Type*> types;
    const Type* ignored;
    if (!function.determineFinalTypes(arguments, &types, &ignored)) {
        return CoercionCost::Impossible();
    }
    CoercionCost total = CoercionCost::Free();
    for (size_t i = 0; i < arguments.size(); i++) {
        total = total + arguments[i]->coercionCost(*types[i]);
    }
    return total;
}
CoercionCost IRGenerator :: callCost ( const FunctionDeclaration & function , const std :: vector < std :: unique_ptr < Expression > > & arguments ) { if ( function . fParameters . size ( ) != arguments . size ( ) ) { return CoercionCost :: Impossible ( ) ; } std :: vector < const Type * > types ; const Type * ignored ; if ( ! function . determineFinalTypes ( arguments , & types , & ignored ) ) { return CoercionCost :: Impossible ( ) ; } CoercionCost total = CoercionCost :: Free ( ) ; for ( size_t i = 0 ; i < arguments . size ( ) ; i ++ ) { total = total + arguments [ i ] -> coercionCost ( * types [ i ] ) ; } return total ; }
Determines the cost of coercing the arguments of a function to the required types.
Determines the cost of coercing the arguments of a function to the required types .