class Ivar::TargetedPrismAnalysis

def analyze_methods

def analyze_methods
  # Group methods by file to avoid parsing the same file multiple times
  methods_by_file = @method_locations.group_by { |_, location| location[:path] }
  methods_by_file.each do |file_path, methods_in_file|
    code = File.read(file_path)
    result = Prism.parse(code)
    methods_in_file.each do |method_name, location|
      visitor = MethodTargetedInstanceVariableReferenceVisitor.new(
        file_path,
        method_name,
        location[:line]
      )
      result.value.accept(visitor)
      @references.concat(visitor.references)
    end
  end
end