Sha256: 7da47eacaaf0a0cbd70dd02f707ecd6a723afcaac457c3c3a8a0434915ff78f1

Contents?: true

Size: 1.5 KB

Versions: 14

Compression:

Stored size: 1.5 KB

Contents

require_relative 'const'

module DeepCover
  class Node
    class ModuleName < Node
      has_child scope: [Node, nil]
      has_child const_name: Symbol

      def flow_completion_count
        parent.execution_count
      end

      def execution_count
        if scope
          scope.flow_completion_count
        else
          super
        end
      end
    end

    class Module < Node
      check_completion
      has_tracker :body_entry
      has_child const: {const: ModuleName}
      has_child body: Node,
        can_be_empty: -> { base_node.loc.end.begin },
        rewrite: '%{body_entry_tracker};%{local}=nil;%{node}',
        is_statement: true,
        flow_entry_count: :body_entry_tracker_hits
      executed_loc_keys :keyword

      def execution_count
        body_entry_tracker_hits
      end
    end

    class Class < Node
      check_completion
      has_tracker :body_entry
      has_child const: {const: ModuleName}
      has_child inherit: [Node, nil]  # TODO
      has_child body: Node,
        can_be_empty: -> { base_node.loc.end.begin },
        rewrite: '%{body_entry_tracker};%{node}',
        is_statement: true,
        flow_entry_count: :body_entry_tracker_hits
      executed_loc_keys :keyword

      def execution_count
        body_entry_tracker_hits
      end
    end

    # class << foo
    class Sclass < Node
      has_child object: Node
      has_child body: Node,
                can_be_empty: -> { base_node.loc.end.begin },
                is_statement: true
      # TODO
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
deep-cover-0.1.14 lib/deep_cover/node/module.rb
deep-cover-0.1.13 lib/deep_cover/node/module.rb
deep-cover-0.1.12 lib/deep_cover/node/module.rb
deep-cover-0.1.11 lib/deep_cover/node/module.rb
deep-cover-0.1.10 lib/deep_cover/node/module.rb
deep-cover-0.1.9 lib/deep_cover/node/module.rb
deep-cover-0.1.8 lib/deep_cover/node/module.rb
deep-cover-0.1.7 lib/deep_cover/node/module.rb
deep-cover-0.1.6 lib/deep_cover/node/module.rb
deep-cover-0.1.5 lib/deep_cover/node/module.rb
deep-cover-0.1.4 lib/deep_cover/node/module.rb
deep-cover-0.1.3 lib/deep_cover/node/module.rb
deep-cover-0.1.2 lib/deep_cover/node/module.rb
deep-cover-0.1.1 lib/deep_cover/node/module.rb