Sha256: 51f8747662ee04f2148e767252264eda4a6ae9006febb8c61423c252d6594f98

Contents?: true

Size: 1.59 KB

Versions: 19

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

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

19 entries across 19 versions & 2 rubygems

Version Path
deep-cover-core-0.6.4 lib/deep_cover/node/module.rb
deep-cover-core-0.6.3 lib/deep_cover/node/module.rb
deep-cover-core-0.6.3.pre lib/deep_cover/node/module.rb
deep-cover-0.6.2 lib/deep_cover/node/module.rb
deep-cover-0.6.1 lib/deep_cover/node/module.rb
deep-cover-0.6.0 lib/deep_cover/node/module.rb
deep-cover-0.5.7 lib/deep_cover/node/module.rb
deep-cover-0.5.6 lib/deep_cover/node/module.rb
deep-cover-0.5.5 lib/deep_cover/node/module.rb
deep-cover-0.5.4 lib/deep_cover/node/module.rb
deep-cover-0.5.3 lib/deep_cover/node/module.rb
deep-cover-0.5.2 lib/deep_cover/node/module.rb
deep-cover-0.5.1 lib/deep_cover/node/module.rb
deep-cover-0.5.0 lib/deep_cover/node/module.rb
deep-cover-0.4.0 lib/deep_cover/node/module.rb
deep-cover-0.3.0 lib/deep_cover/node/module.rb
deep-cover-0.2.0 lib/deep_cover/node/module.rb
deep-cover-0.1.16 lib/deep_cover/node/module.rb
deep-cover-0.1.15 lib/deep_cover/node/module.rb