deep-cover 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87db799f1d293b8ec1f537de9d4da1f0e64fdc3d
4
- data.tar.gz: 7d2406c8639b80ddc55169983322074049b3726c
3
+ metadata.gz: ef02156435418688aa0934036aa4273c3179468c
4
+ data.tar.gz: ba37d24e7cbf1e34f0fbd0db4f3f2720527825f4
5
5
  SHA512:
6
- metadata.gz: 1a1307e9bd830c0eee32251b73a95a9933e85a57225e837231a2a77ba6c81eea69496918f95d7bec8fc650dc9655539f42d941076123dba031ac1c1c56a09548
7
- data.tar.gz: d379b6d29d5a7c4a9d60466e2aac46cc5fb6c6157c0798cb763bbf770f94de2b31fe555a7121a45891f9b9d1a216bb900b27f6eded6cc79e60c41471e6900c28
6
+ metadata.gz: 0c209ce060a984b41dc8e454fccebb6d9911a464a1b76de267ccdd326e567b9af9e427c42e66f75007b7fd81cdb27d4bc5b513772cf2d0d0e11c98a8d152a164
7
+ data.tar.gz: 492ebdb2f56861e7b9d8d195cfdc2818568ff245e7e64c778d9062290785d420c31e43cb1cdcd2efbd204ef40141ba6e80d7d05e220250beba4bf88759b39a1d
@@ -15,20 +15,13 @@ module DeepCover
15
15
  end
16
16
  end
17
17
 
18
- class SendWithBlock < Node
18
+ class SendWithBlock < SendBase
19
19
  include WithBlock
20
- has_child receiver: [Node, nil]
21
- has_child method_name: Symbol
22
- has_extra_children arguments: Node
20
+ end
23
21
 
24
- def rewriting_rules # TODO: test more with foo[42]. Factorize with Send.
25
- rules = super
26
- unless arguments.empty? || loc_hash[:begin]
27
- range = arguments.last.expression.with(begin_pos: loc_hash[:selector].end_pos)
28
- rules.unshift [range, '(%{node})']
29
- end
30
- rules
31
- end
22
+ class CsendWithBlock < Csend
23
+ include WithBlock
24
+ refine_child actual_send: {safe_send: SendWithBlock}
32
25
  end
33
26
 
34
27
  class SuperWithBlock < Node
@@ -39,7 +32,8 @@ module DeepCover
39
32
  class Block < Node
40
33
  check_completion
41
34
  has_tracker :body
42
- has_child call: {send: SendWithBlock, zsuper: SuperWithBlock, super: SuperWithBlock}
35
+ has_child call: { send: SendWithBlock, csend: CsendWithBlock,
36
+ zsuper: SuperWithBlock, super: SuperWithBlock }
43
37
  has_child args: Args
44
38
  has_child body: Node,
45
39
  can_be_empty: -> { base_node.loc.end.begin },
@@ -16,7 +16,7 @@ module DeepCover
16
16
  end
17
17
 
18
18
  class TrivialBranch < Node::EmptyBody
19
- def initialize(condition, other_branch, position: true)
19
+ def initialize(other_branch: raise, condition: raise, position: true)
20
20
  @condition = condition
21
21
  @other_branch = other_branch
22
22
  super(nil, parent: condition.parent, position: position)
@@ -3,8 +3,7 @@ require_relative 'branch'
3
3
 
4
4
  module DeepCover
5
5
  class Node
6
- class Send < Node
7
- check_completion
6
+ class SendBase < Node
8
7
  has_child receiver: [Node, nil]
9
8
  has_child message: Symbol
10
9
  has_extra_children arguments: Node
@@ -52,6 +51,10 @@ module DeepCover
52
51
  end
53
52
  end
54
53
 
54
+ class Send < SendBase
55
+ check_completion
56
+ end
57
+
55
58
  class Csend < Node
56
59
  include Branch
57
60
  has_tracker :conditional
@@ -69,7 +72,9 @@ module DeepCover
69
72
 
70
73
  executed_loc_keys :dot
71
74
 
72
- alias_method :execution_count, :flow_entry_count
75
+ def execution_count
76
+ receiver.flow_completion_count
77
+ end
73
78
 
74
79
  def message
75
80
  actual_send.message
@@ -77,7 +82,7 @@ module DeepCover
77
82
 
78
83
  def branches
79
84
  [ actual_send,
80
- TrivialBranch.new(receiver, actual_send)
85
+ TrivialBranch.new(condition: receiver, other_branch: actual_send)
81
86
  ]
82
87
  end
83
88
  end
@@ -5,14 +5,14 @@ module DeepCover
5
5
  class ShortCircuit < Node
6
6
  include Branch
7
7
  has_tracker :conditional
8
- has_child first: Node
8
+ has_child lhs: Node
9
9
  has_child conditional: Node, flow_entry_count: :conditional_tracker_hits,
10
10
  rewrite: '((%{conditional_tracker};%{node}))'
11
11
 
12
12
  def branches
13
13
  [
14
14
  conditional,
15
- TrivialBranch.new(first, conditional)
15
+ TrivialBranch.new(condition: lhs, other_branch: conditional)
16
16
  ]
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module DeepCover
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep-cover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Lafortune