class Sass::Script::Tree::Operation

def _perform(environment)

Raises:
  • (Sass::SyntaxError) - if the operation is undefined for the operands

Returns:
  • (Sass::Script::Value) - The SassScript object that is the value of the operation

Parameters:
  • environment (Sass::Environment) -- The environment in which to evaluate the SassScript
def _perform(environment)
  value1 = @operand1.perform(environment)
  # Special-case :and and :or to support short-circuiting.
  if @operator == :and
    return value1.to_bool ? @operand2.perform(environment) : value1
  elsif @operator == :or
    return value1.to_bool ? value1 : @operand2.perform(environment)
  end
  value2 = @operand2.perform(environment)
  if (value1.is_a?(Sass::Script::Value::Null) || value2.is_a?(Sass::Script::Value::Null)) &&
      @operator != :eq && @operator != :neq
    raise Sass::SyntaxError.new(
      "Invalid null operation: \"#{value1.inspect} #{@operator} #{value2.inspect}\".")
  end
  begin
    result = opts(value1.send(@operator, value2))
  rescue NoMethodError => e
    raise e unless e.name.to_s == @operator.to_s
    raise Sass::SyntaxError.new("Undefined operation: \"#{value1} #{@operator} #{value2}\".")
  end
  warn_for_color_arithmetic(value1, value2)
  warn_for_unitless_equals(value1, value2, result)
  result
end