Class: RBS::Types::Intersection

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/rbs/types.rb

Instance Method Summary collapse

Instance Method Details

#format(q) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/syntax_tree/rbs/types.rb', line 117

def format(q)
  separator =
    lambda do
      q.breakable
      q.text("& ")
    end

  q.text("(") if q.force_parens?
  q.group do
    q.force_parens { q.seplist(types, separator) { |type| type.format(q) } }
  end
  q.text(")") if q.force_parens?
end

#pretty_print(q) ⇒ Object



131
132
133
134
135
136
137
# File 'lib/syntax_tree/rbs/types.rb', line 131

def pretty_print(q)
  q.group(2, "(intersection", ")") do
    q.breakable
    q.text("types=")
    q.pp(types)
  end
end