require_relative 'node'

module DeepCover
  class AstRoot
    include Node::Mixin
    include HasTracker
    include HasChild

    has_tracker :root
    has_child main: Node, flow_entry_count: :root_tracker_hits, rewrite: -> {
      "#{covered_code.trackers_setup_source};%{root_tracker};%{node}"
    }
    attr_reader :covered_code, :children

    def initialize(child_ast, covered_code)
      @covered_code = covered_code
      @children = augment_children([child_ast])
      super()
    end
  end
end

require_relative 'node'

module DeepCover
  class AstRoot < Node
    has_tracker :root
    has_child main: Node, flow_entry_count: :root_tracker_hits, rewrite: -> {
      "#{covered_code.trackers_setup_source};%{root_tracker};%{node}"
    }
    attr_reader :covered_code

    def initialize(child_ast, covered_code)
      @covered_code = covered_code
      super(nil, parent: nil, base_children: [child_ast])
    end
  end
end

Make AstRoot a full node
Make AstRoot a full node
