# File typeprof-0.21.1/lib/typeprof/code-range.rb, line 42
def <=>(other)
ret = @lineno <=> other.lineno
return ret if ret != 0
@column <=> other.column
end
# File typeprof-0.21.1/lib/typeprof/code-range.rb, line 24
def advance_cursor(offset, source_text)
new_lineno = @lineno
new_column = @column
while offset > 0
line_text = source_text.lines[new_lineno - 1]
if new_column + offset >= line_text.length
advanced = line_text.length - new_column
offset -= advanced
new_lineno += 1
new_column = 0
else
new_column += offset
break
end
end
CodeLocation.new(new_lineno, new_column)
end