furnace 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,31 @@
1
1
  module Furnace::AST
2
2
  module Visitor
3
3
  def visit(node)
4
- node.children.map! do |child|
4
+ replacements = {}
5
+
6
+ node.children.each_with_index do |child, index|
5
7
  if child.is_a? Node
6
8
  visit child
7
9
 
8
10
  if child.type == :expand
9
- child = child.children
11
+ replacements[index] = child.children
10
12
  end
11
13
  end
12
-
13
- child
14
14
  end
15
15
 
16
- node.children.flatten!
16
+ if replacements.any?
17
+ new_children = []
18
+
19
+ node.children.each_with_index do |child, index|
20
+ if replacements[index]
21
+ new_children.concat replacements[index]
22
+ else
23
+ new_children.push child
24
+ end
25
+ end
26
+
27
+ node.children.replace new_children
28
+ end
17
29
 
18
30
  node.children.delete_if do |child|
19
31
  if child.is_a? Node
@@ -1,3 +1,3 @@
1
1
  module Furnace
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
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.1.0
4
+ version: 0.1.1
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-04-11 00:00:00.000000000 Z
12
+ date: 2012-04-19 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.