class SyntaxTree::Not


not value
Not represents the unary not method being called on an expression.

def ===(other)

def ===(other)
  other.is_a?(Not) && statement === other.statement &&
    parentheses === other.parentheses
end

def accept(visitor)

def accept(visitor)
  visitor.visit_not(self)
end

def child_nodes

def child_nodes
  [statement]
end

def copy(statement: nil, parentheses: nil, location: nil)

def copy(statement: nil, parentheses: nil, location: nil)
  node =
    Not.new(
      statement: statement || self.statement,
      parentheses: parentheses || self.parentheses,
      location: location || self.location
    )
  node.comments.concat(comments.map(&:copy))
  node
end

def deconstruct_keys(_keys)

def deconstruct_keys(_keys)
  {
    statement: statement,
    parentheses: parentheses,
    location: location,
    comments: comments
  }
end

def format(q)

def format(q)
  q.text("not")
  if parentheses
    q.text("(")
    q.format(statement) if statement
    q.text(")")
  else
    grandparent = q.grandparent
    ternary =
      (grandparent.is_a?(IfNode) || grandparent.is_a?(UnlessNode)) &&
        Ternaryable.call(q, grandparent)
    if ternary
      q.if_break { q.text(" ") }.if_flat { q.text("(") }
      q.format(statement) if statement
      q.if_flat { q.text(")") } if ternary
    else
      q.text(" ")
      q.format(statement) if statement
    end
  end
end

def initialize(statement:, parentheses:, location:)

def initialize(statement:, parentheses:, location:)
  @statement = statement
  @parentheses = parentheses
  @location = location
  @comments = []
end