class SassC::FunctionsHandler

def arguments_from_native_list(native_argument_list)

def arguments_from_native_list(native_argument_list)
  native_argument_list.filter_map do |native_value|
    Script::ValueConversion.from_native(native_value, @options)
  end
end

def setup(_native_options, functions: Script::Functions)

def setup(_native_options, functions: Script::Functions)
  functions_wrapper = Class.new do
    attr_accessor :options
    include functions
  end.new
  functions_wrapper.options = @options
  Script.custom_functions(functions:).each_with_object({}) do |custom_function, callbacks|
    callback = lambda do |native_argument_list|
      function_arguments = arguments_from_native_list(native_argument_list)
      begin
        result = functions_wrapper.send(custom_function, *function_arguments)
      rescue StandardError
        raise ::Sass::ScriptError, "Error: error in C function #{custom_function}"
      end
      to_native_value(result)
    rescue StandardError => e
      warn "[SassC::FunctionsHandler] #{e.cause.message}"
      raise e
    end
    callbacks[Script.formatted_function_name(custom_function, functions:)] = callback
  end
end

def to_native_value(sass_value)

def to_native_value(sass_value)
  Script::ValueConversion.to_native(sass_value)
end