class Prism::CodeUnitsCache
def [](byte_offset)
def [](byte_offset) @cache[byte_offset] ||= if (index = @offsets.bsearch_index { |offset| offset > byte_offset }).nil? @offsets << byte_offset @counter.count(0, byte_offset) elsif index == 0 @offsets.unshift(byte_offset) @counter.count(0, byte_offset) else @offsets.insert(index, byte_offset) offset = @offsets[index - 1] @cache[offset] + @counter.count(offset, byte_offset - offset) end end