furnace 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -119,9 +119,9 @@ module Furnace::CFG
119
119
 
120
120
  # Are we computing dominators or postdominators?
121
121
  if forward
122
- edges = node.sources
122
+ edges = node.sources + node.exception_sources
123
123
  else
124
- edges = node.targets
124
+ edges = node.targets + [ node.exception ]
125
125
  end
126
126
 
127
127
  # Key Idea [for dominators]
@@ -194,22 +194,33 @@ module Furnace::CFG
194
194
  loops
195
195
  end
196
196
 
197
- def sources_for(node)
197
+ def sources_for(node, exceptions=false)
198
198
  unless @source_map
199
199
  @source_map = Hash.new { |h, k| h[k] = [] }
200
+ @exception_source_map = Hash.new { |h, k| h[k] = [] }
200
201
 
201
202
  @nodes.each do |node|
202
203
  node.targets.each do |target|
203
204
  @source_map[target] << node
204
205
  end
206
+
207
+ @exception_source_map[node.exception] << node
205
208
  end
206
209
 
207
210
  @source_map.each do |node, sources|
208
211
  sources.freeze
209
212
  end
213
+
214
+ @exception_source_map.each do |node, sources|
215
+ sources.freeze
216
+ end
210
217
  end
211
218
 
212
- @source_map[node]
219
+ if exceptions
220
+ @exception_source_map[node]
221
+ else
222
+ @source_map[node]
223
+ end
213
224
  end
214
225
 
215
226
  def flush
@@ -43,6 +43,14 @@ module Furnace::CFG
43
43
  @cfg.find_node @exception_label if @exception_label
44
44
  end
45
45
 
46
+ def exception_source_labels
47
+ exception_sources.map &:label
48
+ end
49
+
50
+ def exception_sources
51
+ @cfg.sources_for(self, true)
52
+ end
53
+
46
54
  def exits?
47
55
  targets == [@cfg.exit]
48
56
  end
@@ -1,3 +1,3 @@
1
1
  module Furnace
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: furnace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-16 00:00:00.000000000 Z
12
+ date: 2012-06-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Furnace is a static code analysis framework for dynamic languages, aimed
15
15
  at efficient type and behavior inference.