lib/steep/ast/types/helper.rb



module Steep
  module AST
    module Types
      module Helper
        module ChildrenLevel
          def level_of_children(children)
            children.map(&:level).sort {|a, b| b.size <=> a.size }.inject() do |a, b|
              a.zip(b).map do |(x, y)|
                if x && y
                  x + y
                else
                  x || y
                end
              end
            end || []
          end
        end
      end
    end
  end
end