Method: RBS::Writer#preserve_empty_line
- Defined in:
- lib/rbs/writer.rb
#preserve_empty_line(prev, decl) ⇒ Object
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/rbs/writer.rb', line 396 def preserve_empty_line(prev, decl) # @type var decl: _Located return unless prev if (_ = decl).respond_to?(:comment) if comment = (_ = decl).comment decl = comment end end prev_loc = prev.location decl_loc = decl.location if prev_loc && decl_loc prev_end_line = prev_loc.end_line start_line = decl_loc.start_line if start_line - prev_end_line > 1 puts end else # When the signature is not constructed by the parser, # it always inserts an empty line. puts end end |