Class: Prism::Merge::FreezeNode::LocationWithOffsets

Inherits:
Struct
  • Object
show all
Defined in:
lib/prism/merge/freeze_node.rb

Overview

Extended location struct with byte offsets for compatibility with TopLevelMergeRunner's already_output? check, which compares byte offsets. Without real offsets, line numbers (e.g. 2..4) falsely fall within the byte range of real Prism nodes, causing FreezeNodes to be skipped.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_lineObject

Returns the value of attribute end_line

Returns:

  • (Object)

    the current value of end_line



42
43
44
# File 'lib/prism/merge/freeze_node.rb', line 42

def end_line
  @end_line
end

#end_offsetObject

Returns the value of attribute end_offset

Returns:

  • (Object)

    the current value of end_offset



42
43
44
# File 'lib/prism/merge/freeze_node.rb', line 42

def end_offset
  @end_offset
end

#start_lineObject

Returns the value of attribute start_line

Returns:

  • (Object)

    the current value of start_line



42
43
44
# File 'lib/prism/merge/freeze_node.rb', line 42

def start_line
  @start_line
end

#start_offsetObject

Returns the value of attribute start_offset

Returns:

  • (Object)

    the current value of start_offset



42
43
44
# File 'lib/prism/merge/freeze_node.rb', line 42

def start_offset
  @start_offset
end

Instance Method Details

#cover?(line) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/prism/merge/freeze_node.rb', line 43

def cover?(line)
  (start_line..end_line).cover?(line)
end

#leading_commentsObject



47
48
49
# File 'lib/prism/merge/freeze_node.rb', line 47

def leading_comments
  []
end

#trailing_commentsObject



51
52
53
# File 'lib/prism/merge/freeze_node.rb', line 51

def trailing_comments
  []
end