class Solargraph::Source::Chain

def maybe_nil type

Returns:
  • (ComplexType) -

Parameters:
  • type (ComplexType) --
def maybe_nil type
  return type if type.undefined? || type.void? || type.nullable?
  return type unless nullable?
  ComplexType.new(type.items + [ComplexType::NIL])
end