class RDoc::Context

def add_constant constant

def add_constant constant
  return constant unless @document_self
  # HACK: avoid duplicate 'PI' & 'E' in math.c (1.8.7 source code)
  # (this is a #ifdef: should be handled by the C parser)
  known = @constants_hash[constant.name]
  if known then
    known.comment = constant.comment if known.comment.empty?
    known.value = constant.value if
      known.value.nil? or known.value.strip.empty?
    known.is_alias_for ||= constant.is_alias_for
  else
    @constants_hash[constant.name] = constant
    add_to @constants, constant
  end
  constant
end